From 763b4247cafdb978630d4da7ff48c8113c7d961e Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Wed, 9 Apr 2014 23:20:14 +0200 Subject: [PATCH] staging: rtl8723au: Remove a bunch of calls via indirect HAL interface and call functions directly The 'HW' variable interface is confusing and simply obfuscates the code, so this is the first patch in a series to remove it and make direct calls to the functions in place. Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 10 +++---- .../staging/rtl8723au/core/rtw_wlan_util.c | 9 +++--- .../staging/rtl8723au/hal/rtl8723a_hal_init.c | 30 ++----------------- drivers/staging/rtl8723au/include/hal_intf.h | 8 ++--- .../staging/rtl8723au/os_dep/ioctl_cfg80211.c | 3 +- drivers/staging/rtl8723au/os_dep/os_intfs.c | 2 +- 6 files changed, 16 insertions(+), 46 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index 4c753639ea5a..7be834f996ab 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -7561,7 +7561,7 @@ unsigned int send_beacon23a(struct rtw_adapter *padapter) unsigned long start = jiffies; unsigned int passing_time; - rtw_hal_set_hwreg23a(padapter, HW_VAR_BCN_VALID, NULL); + rtl8723a_bcn_valid(padapter); do { issue_beacon23a(padapter, 100); issue++; @@ -8832,7 +8832,7 @@ void mlmeext_sta_del_event_callback23a(struct rtw_adapter *padapter) { /* set_opmode_cmd(padapter, infra_client_with_mlme); */ - rtw_hal_set_hwreg23a(padapter, HW_VAR_MLME_DISCONNECT, NULL); + hw_var_set_mlme_disconnect(padapter); rtw_hal_set_hwreg23a(padapter, HW_VAR_BSSID, null_addr); /* restore to initial setting. */ @@ -9305,7 +9305,7 @@ u8 join_cmd_hdl23a(struct rtw_adapter *padapter, u8 *pbuf) /* Set_MSR23a(padapter, _HW_STATE_NOLINK_); */ Set_MSR23a(padapter, _HW_STATE_STATION_); - rtw_hal_set_hwreg23a(padapter, HW_VAR_MLME_DISCONNECT, NULL); + hw_var_set_mlme_disconnect(padapter); } rtw_joinbss_reset23a(padapter); @@ -9424,7 +9424,7 @@ u8 disconnect_hdl23a(struct rtw_adapter *padapter, unsigned char *pbuf) /* pmlmeinfo->state = WIFI_FW_NULL_STATE; */ - rtw_hal_set_hwreg23a(padapter, HW_VAR_MLME_DISCONNECT, NULL); + hw_var_set_mlme_disconnect(padapter); rtw_hal_set_hwreg23a(padapter, HW_VAR_BSSID, null_addr); /* restore to initial setting. */ @@ -9644,7 +9644,7 @@ u8 setkey_hdl23a(struct rtw_adapter *padapter, u8 *pbuf) write_cam23a(padapter, pparm->keyid, ctrl, null_sta, pparm->key); /* allow multicast packets to driver */ - padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_ON_RCR_AM, null_addr); + rtl8723a_on_rcr_am(padapter); return H2C_SUCCESS; } diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c b/drivers/staging/rtl8723au/core/rtw_wlan_util.c index 0dfcfbce3b52..3ed3beb2e6d3 100644 --- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c @@ -490,7 +490,7 @@ void CAM_empty_entry23a(struct rtw_adapter *Adapter, u8 ucIndex) void invalidate_cam_all23a(struct rtw_adapter *padapter) { - rtw_hal_set_hwreg23a(padapter, HW_VAR_CAM_INVALID_ALL, NULL); + rtl8723a_cam_invalid_all(padapter); } void write_cam23a(struct rtw_adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key) @@ -561,7 +561,7 @@ void flush_all_cam_entry23a(struct rtw_adapter *padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - rtw_hal_set_hwreg23a(padapter, HW_VAR_CAM_INVALID_ALL, NULL); + rtl8723a_cam_invalid_all(padapter); memset((u8 *)(pmlmeinfo->FW_sta_info), 0, sizeof(pmlmeinfo->FW_sta_info)); } @@ -1726,9 +1726,10 @@ void update_TSF23a(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len) pmlmeext->TSFValue |= le32_to_cpu(*pbuf); } -void correct_TSF23a(struct rtw_adapter *padapter, struct mlme_ext_priv *pmlmeext) +void correct_TSF23a(struct rtw_adapter *padapter, + struct mlme_ext_priv *pmlmeext) { - rtw_hal_set_hwreg23a(padapter, HW_VAR_CORRECT_TSF, NULL); + hw_var_set_correct_tsf(padapter); } void beacon_timing_control23a(struct rtw_adapter *padapter) diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index 0982b0a4ab9b..a09716907569 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -3018,7 +3018,7 @@ static void hw_var_set_bssid(struct rtw_adapter *padapter, u8 *val) rtw_write8(padapter, (reg_bssid + idx), val[idx]); } -static void hw_var_set_correct_tsf(struct rtw_adapter *padapter) +void hw_var_set_correct_tsf(struct rtw_adapter *padapter) { u64 tsf; u32 reg_tsftr; @@ -3055,7 +3055,7 @@ static void hw_var_set_correct_tsf(struct rtw_adapter *padapter) ResumeTxBeacon(padapter); } -static void hw_var_set_mlme_disconnect(struct rtw_adapter *padapter) +void hw_var_set_mlme_disconnect(struct rtw_adapter *padapter) { /* reject all data frames */ rtw_write16(padapter, REG_RXFLTMAP2, 0); @@ -3167,18 +3167,10 @@ void SetHwReg8723A(struct rtw_adapter *padapter, u8 variable, u8 *val) rtl8723a_set_bcn_func(padapter, *val); break; - case HW_VAR_CORRECT_TSF: - hw_var_set_correct_tsf(padapter); - break; - case HW_VAR_CHECK_BSSID: rtl8723a_check_bssid(padapter, *val); break; - case HW_VAR_MLME_DISCONNECT: - hw_var_set_mlme_disconnect(padapter); - break; - case HW_VAR_MLME_SITESURVEY: rtl8723a_mlme_sitesurvey(padapter, *val); break; @@ -3187,14 +3179,6 @@ void SetHwReg8723A(struct rtw_adapter *padapter, u8 variable, u8 *val) hw_var_set_mlme_join(padapter, *val); break; - case HW_VAR_ON_RCR_AM: - rtl8723a_on_rcr_am(padapter); - break; - - case HW_VAR_OFF_RCR_AM: - rtl8723a_off_rcr_am(padapter); - break; - case HW_VAR_BEACON_INTERVAL: rtl8723a_set_beacon_interval(padapter, *((u16 *) val)); break; @@ -3234,10 +3218,6 @@ void SetHwReg8723A(struct rtw_adapter *padapter, u8 variable, u8 *val) rtl8723a_cam_empty_entry(padapter, *val); break; - case HW_VAR_CAM_INVALID_ALL: - rtl8723a_cam_invalid_all(padapter); - break; - case HW_VAR_CAM_WRITE: rtl8723a_cam_write(padapter, val32[0], val32[1]); break; @@ -3297,9 +3277,6 @@ void SetHwReg8723A(struct rtw_adapter *padapter, u8 variable, u8 *val) case HW_VAR_EFUSE_BT_BYTES: pHalData->BTEfuseUsedBytes = *((u16 *) val); break; - case HW_VAR_FIFO_CLEARN_UP: - rtl8723a_fifo_cleanup(padapter); - break; case HW_VAR_CHECK_TXBUF: break; case HW_VAR_APFM_ON_MAC: @@ -3309,9 +3286,6 @@ void SetHwReg8723A(struct rtw_adapter *padapter, u8 variable, u8 *val) case HW_VAR_NAV_UPPER: rtl8723a_set_nav_upper(padapter, *val32); break; - case HW_VAR_BCN_VALID: - rtl8723a_bcn_valid(padapter); - break; default: break; } diff --git a/drivers/staging/rtl8723au/include/hal_intf.h b/drivers/staging/rtl8723au/include/hal_intf.h index d183f4ba1ecb..5bd47136def7 100644 --- a/drivers/staging/rtl8723au/include/hal_intf.h +++ b/drivers/staging/rtl8723au/include/hal_intf.h @@ -45,13 +45,9 @@ enum HW_VARIABLES { HW_VAR_BASIC_RATE, HW_VAR_TXPAUSE, HW_VAR_BCN_FUNC, - HW_VAR_CORRECT_TSF, HW_VAR_CHECK_BSSID, - HW_VAR_MLME_DISCONNECT, HW_VAR_MLME_SITESURVEY, HW_VAR_MLME_JOIN, - HW_VAR_ON_RCR_AM, - HW_VAR_OFF_RCR_AM, HW_VAR_BEACON_INTERVAL, HW_VAR_SLOT_TIME, HW_VAR_RESP_SIFS, @@ -64,7 +60,6 @@ enum HW_VARIABLES { HW_VAR_DM_FUNC_SET, HW_VAR_DM_FUNC_CLR, HW_VAR_CAM_EMPTY_ENTRY, - HW_VAR_CAM_INVALID_ALL, HW_VAR_CAM_WRITE, HW_VAR_CAM_READ, HW_VAR_AC_PARAM_VO, @@ -94,7 +89,6 @@ enum HW_VARIABLES { HW_VAR_SWITCH_EPHY_WoWLAN, HW_VAR_EFUSE_BYTES, HW_VAR_EFUSE_BT_BYTES, - HW_VAR_FIFO_CLEARN_UP, HW_VAR_CHECK_TXBUF, HW_VAR_APFM_ON_MAC, /* Auto FSM to Turn On, include clock, isolation, power control for MAC only */ /* The valid upper nav range for the HW updating, if the true value is larger than the upper range, the HW won't update it. */ @@ -388,5 +382,7 @@ void rtw_hal_reset_security_engine23a(struct rtw_adapter *adapter); s32 rtw_hal_c2h_handler23a(struct rtw_adapter *adapter, struct c2h_evt_hdr *c2h_evt); c2h_id_filter rtw_hal_c2h_id_filter_ccx23a(struct rtw_adapter *adapter); +void hw_var_set_correct_tsf(struct rtw_adapter *padapter); +void hw_var_set_mlme_disconnect(struct rtw_adapter *padapter); #endif /* __HAL_INTF_H__ */ diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index 50840b9a11fa..58366236777f 100644 --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c @@ -1883,7 +1883,6 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter *padapter, const u8 *pie, int wpa_ielen = 0; int wpa2_ielen = 0; u8 *pwpa, *pwpa2; - u8 null_addr[] = { 0, 0, 0, 0, 0, 0 }; int i; if (!pie || !ielen) { @@ -2097,7 +2096,7 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter *padapter, const u8 *pie, padapter->securitypriv.dot11PrivacyAlgrthm == _AES_) /* WPS open need to enable multicast */ /* check_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS) == true)*/ - rtw_hal_set_hwreg23a(padapter, HW_VAR_OFF_RCR_AM, null_addr); + rtl8723a_off_rcr_am(padapter); RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, ("rtw_set_wpa_ie: pairwise_cipher = 0x%08x padapter->" diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c b/drivers/staging/rtl8723au/os_dep/os_intfs.c index 57eca7a45672..eab40d21fb3d 100644 --- a/drivers/staging/rtl8723au/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c @@ -887,7 +887,7 @@ void rtw_ips_pwr_down23a(struct rtw_adapter *padapter) void rtw_ips_dev_unload23a(struct rtw_adapter *padapter) { - rtw_hal_set_hwreg23a(padapter, HW_VAR_FIFO_CLEARN_UP, NULL); + rtl8723a_fifo_cleanup(padapter); if (padapter->intf_stop) padapter->intf_stop(padapter); -- 2.30.2