staging: r8188eu: remove GetHalDefVar8188EUsb()
v2 cover staging: r8188eu: remove GetHalDefVar8188EUsb()
This series removes the function GetHalDefVar8188EUsb(). This is part of the ongoing effort to get rid of the unwanted hal layer.
Tested on x86_64 with Inter-Tech DMG-02.
v2:
- remove dead code first
- use better function names
- make one function static
Michael Straube (4):
staging: r8188eu: cur_ant is set but never used
staging: r8188eu: remove HAL_DEF_IS_SUPPORT_ANT_DIV
staging: r8188eu: remove HAL_DEF_CURRENT_ANTENNA
staging: r8188eu: remove GetHalDefVar8188EUsb()
drivers/staging/r8188eu/core/rtw_cmd.c | 11 ++++++++--- drivers/staging/r8188eu/core/rtw_mlme.c | 19 ++++++++++--------- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 +- drivers/staging/r8188eu/hal/usb_halinit.c | 20 -------------------- drivers/staging/r8188eu/include/hal_intf.h | 3 --- drivers/staging/r8188eu/include/rtw_mlme.h | 2 ++ drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +------- 7 files changed, 22 insertions(+), 43 deletions(-)
Signature · 1 line
2.35.1
PATCH v2 1/4 staging: r8188eu: cur_ant is set but never used
In rtw_select_and_join_from_scanned_queue() the local variable cur_ant is set but never used. Remove the variable and related dead code.
---
v2:
- made it the first patch in the series
- changed subject line
drivers/staging/r8188eu/core/rtw_mlme.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme.c +0 -7
@@ -1458,7 +1458,6 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv)struct __queue *queue = &pmlmepriv->scanned_queue;struct wlan_network *pnetwork =NULL ;struct wlan_network *candidate =NULL ; -u8 supp_ant_div = false;spin_lock_bh (&pmlmepriv->scanned_queue.lock); phead =get_list_head (queue);
@@ -1485,12 +1484,6 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv)rtw_free_assoc_resources (adapter,0 ); } -GetHalDefVar8188EUsb (adapter,HAL_DEF_IS_SUPPORT_ANT_DIV , &supp_ant_div); -if (supp_ant_div) { -u8 cur_ant; -GetHalDefVar8188EUsb (adapter,HAL_DEF_CURRENT_ANTENNA , &cur_ant); - } - ret =rtw_joinbss_cmd (adapter, candidate); exit:
Signature · 1 line
2.35.1
PATCH v2 2/4 staging: r8188eu: remove HAL_DEF_IS_SUPPORT_ANT_DIV
In reply to Michael StraubeIn order to get rid of the function GetHalDefVar8188EUsb(), remove the HAL_DEF_IS_SUPPORT_ANT_DIV case from it and move the functionality into a new function. This is part of the ongoing effort to get rid of the unwanted hal layer.
---
v2:
- made the function static
- used a more obvious function name
drivers/staging/r8188eu/core/rtw_cmd.c | 11 ++++++++--- drivers/staging/r8188eu/hal/usb_halinit.c | 3 --- drivers/staging/r8188eu/include/hal_intf.h | 1 - 3 files changed, 8 insertions(+), 7 deletions(-)
drivers/staging/r8188eu/core/rtw_cmd.c +8 -3
@@ -1094,16 +1094,21 @@ static void antenna_select_wk_hdl(struct adapter *padapter, u8 antenna) } } +static bool rtw_antenna_diversity (struct adapter *adapter) +{ +struct hal_data_8188e *haldata = &adapter->haldata; + +return haldata->AntDivCfg !=0 ; +} +u8 rtw_antenna_select_cmd (struct adapter *padapter,u8 antenna,u8 enqueue) {struct cmd_obj *ph2c;struct drvextra_cmd_parm *pdrvextra_cmd_parm;struct cmd_priv *pcmdpriv = &padapter->cmdpriv; -u8 support_ant_div;u8 res = _SUCCESS; -GetHalDefVar8188EUsb (padapter,HAL_DEF_IS_SUPPORT_ANT_DIV , &support_ant_div); -if (!support_ant_div) +if (!rtw_antenna_diversity (padapter))return res;if (enqueue) {
drivers/staging/r8188eu/hal/usb_halinit.c +0 -3
@@ -1204,9 +1204,6 @@ void GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariabstruct hal_data_8188e *haldata = &Adapter->haldata;switch (eVariable) { -case HAL_DEF_IS_SUPPORT_ANT_DIV : - *((u8 *)pValue) = (haldata->AntDivCfg ==0 ) ? false : true; -break ;case HAL_DEF_CURRENT_ANTENNA : *((u8 *)pValue) = haldata->CurAntenna;break ;
drivers/staging/r8188eu/include/hal_intf.h +0 -1
@@ -28,7 +28,6 @@ enum hw_variables { };enum hal_def_variable { -HAL_DEF_IS_SUPPORT_ANT_DIV ,HAL_DEF_CURRENT_ANTENNA ,HAL_DEF_DBG_DM_FUNC ,/* for dbg */ };
Signature · 1 line
2.35.1
PATCH v2 3/4 staging: r8188eu: remove HAL_DEF_CURRENT_ANTENNA
In reply to Michael StraubeIn order to get rid of the function GetHalDefVar8188EUsb(), remove the HAL_DEF_CURRENT_ANTENNA case from it and move the functionality into a new function. This is part of the ongoing effort to get rid of the unwanted hal layer.
---
v2:
- added rtw_ prefix to the function name
- added the function in rtw_mlme.c
drivers/staging/r8188eu/core/rtw_mlme.c | 12 ++++++++++-- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 +- drivers/staging/r8188eu/hal/usb_halinit.c | 3 --- drivers/staging/r8188eu/include/hal_intf.h | 1 - drivers/staging/r8188eu/include/rtw_mlme.h | 2 ++ 5 files changed, 13 insertions(+), 7 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme.c +10 -2
@@ -464,6 +464,13 @@ static void update_current_network(struct adapter *adapter, struct wlan_bssid_ex } +u8 rtw_current_antenna (struct adapter *adapter) +{ +struct hal_data_8188e *haldata = &adapter->haldata; + +return haldata->CurAntenna; +} +/* Caller must hold pmlmepriv->lock first. */
@@ -497,7 +504,8 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t/* If there are no more slots, expire the oldest */ pnetwork = oldest; -GetHalDefVar8188EUsb (adapter,HAL_DEF_CURRENT_ANTENNA , &target->PhyInfo.Optimum_antenna); + target->PhyInfo.Optimum_antenna =rtw_current_antenna (adapter); +memcpy (&pnetwork->network, target,get_wlan_bssid_ex_sz (target));/* variable initialize */ pnetwork->fixed = false;
@@ -520,7 +528,7 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t bssid_ex_sz =get_wlan_bssid_ex_sz (target); target->Length = bssid_ex_sz; -GetHalDefVar8188EUsb (adapter,HAL_DEF_CURRENT_ANTENNA , &target->PhyInfo.Optimum_antenna); + target->PhyInfo.Optimum_antenna =rtw_current_antenna (adapter);memcpy (&pnetwork->network, target, bssid_ex_sz); pnetwork->last_scanned = jiffies;
drivers/staging/r8188eu/core/rtw_mlme_ext.c +1 -1
@@ -5995,7 +5995,7 @@ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, st bssid->Rssi = precv_frame->attrib.phy_info.recvpower;/* in dBM.raw data */ bssid->PhyInfo.SignalQuality = precv_frame->attrib.phy_info.SignalQuality;/* in percentage */ bssid->PhyInfo.SignalStrength = precv_frame->attrib.phy_info.SignalStrength;/* in percentage */ -GetHalDefVar8188EUsb (padapter,HAL_DEF_CURRENT_ANTENNA , &bssid->PhyInfo.Optimum_antenna); + bssid->PhyInfo.Optimum_antenna =rtw_current_antenna (padapter);/* checking SSID */ p =rtw_get_ie (bssid->IEs + ie_offset, _SSID_IE_, &len, bssid->IELength - ie_offset);
drivers/staging/r8188eu/hal/usb_halinit.c +0 -3
@@ -1204,9 +1204,6 @@ void GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariabstruct hal_data_8188e *haldata = &Adapter->haldata;switch (eVariable) { -case HAL_DEF_CURRENT_ANTENNA : - *((u8 *)pValue) = haldata->CurAntenna; -break ;case HAL_DEF_DBG_DM_FUNC : *((u32 *)pValue) = haldata->odmpriv.SupportAbility;break ;
drivers/staging/r8188eu/include/hal_intf.h +0 -1
@@ -28,7 +28,6 @@ enum hw_variables { };enum hal_def_variable { -HAL_DEF_CURRENT_ANTENNA ,HAL_DEF_DBG_DM_FUNC ,/* for dbg */ };
drivers/staging/r8188eu/include/rtw_mlme.h +2 -0
@@ -598,4 +598,6 @@ void rtw_set_max_rpt_macid(struct adapter *adapter, u8 macid);void rtw_sta_media_status_rpt (struct adapter *adapter,struct sta_info *psta,u32 mstatus); +u8 rtw_current_antenna (struct adapter *adapter); +#endif /* __RTL871X_MLME_H_ */
Signature · 1 line
2.35.1
PATCH v2 4/4 staging: r8188eu: remove GetHalDefVar8188EUsb()
In reply to Michael StraubeThe local variable odm_flag in rtw_dbg_port() is set but never used. This are the last two remaining calls to GetHalDefVar8188EUsb(). Both calls can be removed and we finally can remove GetHalDefVar8188EUsb() itself. This is part of the ongoing effort to get rid of the unwanted hal layer.
---
v2: no changes
drivers/staging/r8188eu/hal/usb_halinit.c | 14 -------------- drivers/staging/r8188eu/include/hal_intf.h | 1 - drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +------- 3 files changed, 1 insertion(+), 22 deletions(-)
drivers/staging/r8188eu/hal/usb_halinit.c +0 -14
@@ -1198,20 +1198,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) } -/* Query setting of specified variable. */ -void GetHalDefVar8188EUsb (struct adapter *Adapter,enum hal_def_variable eVariable,void *pValue) -{ -struct hal_data_8188e *haldata = &Adapter->haldata; - -switch (eVariable) { -case HAL_DEF_DBG_DM_FUNC : - *((u32 *)pValue) = haldata->odmpriv.SupportAbility; -break ; -default : -break ; - } -} -/* Change default setting of specified variable. */ void SetHalDefVar8188EUsb (struct adapter *Adapter,enum hal_def_variable eVariable,void *pValue) {
drivers/staging/r8188eu/include/hal_intf.h +0 -1
@@ -52,7 +52,6 @@ int rtl8188e_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt);void SetHalDefVar8188EUsb (struct adapter *Adapter,enum hal_def_variable eVariable,void *pValue); -void GetHalDefVar8188EUsb (struct adapter *Adapter,enum hal_def_variable eVariable,void *pValue);unsigned int rtl8188eu_inirp_init (struct adapter *Adapter);
drivers/staging/r8188eu/os_dep/ioctl_linux.c +1 -7
@@ -3675,22 +3675,16 @@ static int rtw_dbg_port(struct net_device *dev,break ;case 0xee :/* turn on/off dynamic funcs */ { -u32 odm_flag; - -if (0xf == extra_arg) { -GetHalDefVar8188EUsb (padapter,HAL_DEF_DBG_DM_FUNC , &odm_flag); - }else { +if (extra_arg !=0xf ) {/* extra_arg = 0 - disable all dynamic func extra_arg = 1 - disable DIG extra_arg = 2 - disable tx power tracking extra_arg = 3 - turn on all dynamic func */ SetHalDefVar8188EUsb (padapter,HAL_DEF_DBG_DM_FUNC , &extra_arg); -GetHalDefVar8188EUsb (padapter,HAL_DEF_DBG_DM_FUNC , &odm_flag); } }break ; -case 0xfd :rtw_write8 (padapter,0xc50 , arg);rtw_write8 (padapter,0xc58 , arg);
Signature · 1 line
2.35.1
Greg KH
maintainerQuoted 10 lines · Michael Straube
This series removes the function
GetHalDefVar8188EUsb(). This is part of the ongoing effort to get rid of the unwanted hal layer.Tested on
x86_64with Inter-Tech DMG-02.v2:
- remove dead code first
- use better function names
- make one function static
Thanks for the changes, now queued up.
greg k-h