staging: r8188eu: remove GetHalDefVar8188EUsb()
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.
Michael Straube (5):
staging: r8188eu: remove HAL_DEF_IS_SUPPORT_ANT_DIV
staging: r8188eu: use support_ant_div()
staging: r8188eu: remove dead code
staging: r8188eu: remove HAL_DEF_CURRENT_ANTENNA
staging: r8188eu: remove GetHalDefVar8188EUsb()
drivers/staging/r8188eu/core/rtw_cmd.c | 4 +-- drivers/staging/r8188eu/core/rtw_mlme.c | 11 ++---- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 +- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 8 ++--- drivers/staging/r8188eu/hal/usb_halinit.c | 36 ++++++++------------ drivers/staging/r8188eu/include/hal_intf.h | 6 ++-- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 8 +---- 7 files changed, 26 insertions(+), 49 deletions(-)
Signature · 1 line
2.35.1
PATCH 1/5 staging: r8188eu: remove HAL_DEF_IS_SUPPORT_ANT_DIV
In 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.
--- drivers/staging/r8188eu/core/rtw_cmd.c | 4 +--- drivers/staging/r8188eu/core/rtw_mlme.c | 4 +--- drivers/staging/r8188eu/hal/usb_halinit.c | 10 +++++++--- drivers/staging/r8188eu/include/hal_intf.h | 3 ++- 4 files changed, 11 insertions(+), 10 deletions(-)
drivers/staging/r8188eu/core/rtw_cmd.c +1 -3
@@ -1099,11 +1099,9 @@ 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 (!support_ant_div (padapter))return res;if (enqueue) {
drivers/staging/r8188eu/core/rtw_mlme.c +1 -3
@@ -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,8 +1484,7 @@ 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) { +if (support_ant_div (adapter)) {u8 cur_ant;GetHalDefVar8188EUsb (adapter,HAL_DEF_CURRENT_ANTENNA , &cur_ant); }
drivers/staging/r8188eu/hal/usb_halinit.c +7 -3
@@ -481,6 +481,13 @@ static void _BBTurnOnBlock(struct adapter *Adapter)rtl8188e_PHY_SetBBReg (Adapter, rFPGA0_RFMOD, bOFDMEn,0x1 ); } +bool support_ant_div (struct adapter *adapter) +{ +struct hal_data_8188e *haldata = &adapter->haldata; + +return haldata->AntDivCfg !=0 ; +} +static void _InitAntenna_Selection (struct adapter *Adapter) {struct hal_data_8188e *haldata = &Adapter->haldata;
@@ -1204,9 +1211,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 +2 -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 */ };
@@ -64,6 +63,8 @@ uint rtw_hal_init(struct adapter *padapter);uint rtw_hal_deinit (struct adapter *padapter);void rtw_hal_stop (struct adapter *padapter); +bool support_ant_div (struct adapter *adapter); +u32 rtl8188eu_hal_init (struct adapter *Adapter);u32 rtl8188eu_hal_deinit (struct adapter *Adapter);
Signature · 1 line
2.35.1
Greg KH
maintainerRe: [PATCH 1/5] staging: r8188eu: remove HAL_DEF_IS_SUPPORT_ANT_DIV
Quoted 57 lines · Michael Straube
In order to get rid of the function
GetHalDefVar8188EUsb(), remove theHAL_DEF_IS_SUPPORT_ANT_DIVcase 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.Signed-off-by Michael Straube <[email protected]>--- drivers/staging/r8188eu/core/rtw_cmd.c | 4 +--- drivers/staging/r8188eu/core/rtw_mlme.c | 4 +--- drivers/staging/r8188eu/hal/usb_halinit.c | 10 +++++++--- drivers/staging/r8188eu/include/hal_intf.h | 3 ++- 4 files changed, 11 insertions(+), 10 deletions(-)drivers/staging/r8188eu/core/rtw_cmd.c +1
-3@@ -1099,11 +1099,9 @@ 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 (!support_ant_div (padapter))return res;if (enqueue) {drivers/staging/r8188eu/core/rtw_mlme.c +1
-3@@ -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,8 +1484,7 @@ 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) { +if (support_ant_div (adapter)) {u8 cur_ant;GetHalDefVar8188EUsb (adapter,HAL_DEF_CURRENT_ANTENNA , &cur_ant); }drivers/staging/r8188eu/hal/usb_halinit.c +0
-0
drivers/staging/r8188eu/hal/usb_halinit.c static void _BBTurnOnBlock(struct adapter *Adapter) · line 484
Quoted 4 lines
drivers/staging/r8188eu/hal/usb_halinit.c +1
-0@@ -481,6 +481,13 @@ static void _BBTurnOnBlock(struct adapter *Adapter)rtl8188e_PHY_SetBBReg (Adapter, rFPGA0_RFMOD, bOFDMEn,0x1 ); } +bool support_ant_div (struct adapter *adapter)
That's a very odd function name to add to the kernel's global namespace :(
Pleas emake it more obvious what this is for, with the driver name as part of the prefix?
thanks,
greg k-h
Re: [PATCH 1/5] staging: r8188eu: remove HAL_DEF_IS_SUPPORT_ANT_DIV
Hi Greg,
Quoted 8 lines · Greg KH
Quoted 1 line
+bool
support_ant_div(struct adapter *adapter)That's a very odd function name to add to the kernel's global namespace :(
Pleas emake it more obvious what this is for, with the driver name as part of the prefix?
Looking again at this I notice it can be made a static function in rtw_cmd.c.
I'll rework the series and make the function static with a more descriptive name.
thanks,
Michael
PATCH 2/5 staging: r8188eu: use support_ant_div()
In reply to Michael StraubeUse support_ant_div() instead of checking haldata->AntDivCfg directly. This improves readability and makes future cleanups, e.g. removing the hal_data_8188e structure, easier.
--- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 8 +++----- drivers/staging/r8188eu/hal/usb_halinit.c | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_dm.c +3 -5
@@ -33,7 +33,7 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter)int i; pdmpriv->InitODMFlag =ODM_BB_RSSI_MONITOR ; -if (hal_data->AntDivCfg) +if (support_ant_div (Adapter)) pdmpriv->InitODMFlag |=ODM_BB_ANT_DIV ; dm_odm->SupportAbility = pdmpriv->InitODMFlag;
@@ -102,9 +102,7 @@ void rtl8188e_init_dm_priv(struct adapter *Adapter)/* Compare RSSI for deciding antenna */ void AntDivCompare8188E (struct adapter *Adapter,struct wlan_bssid_ex *dst,struct wlan_bssid_ex *src) { -struct hal_data_8188e *hal_data = &Adapter->haldata; - -if (0 != hal_data->AntDivCfg) { +if (support_ant_div (Adapter)) {/* select optimum_antenna for before linked =>For antenna diversity */ if (dst->Rssi >= src->Rssi) {/* keep org parameter */ src->Rssi = dst->Rssi;
@@ -122,7 +120,7 @@ u8 AntDivBeforeLink8188E(struct adapter *Adapter)struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;/* Condition that does not need to use antenna diversity. */ -if (hal_data->AntDivCfg ==0 ) +if (!support_ant_div (Adapter))return false;if (check_fwstate (pmlmepriv, _FW_LINKED))
drivers/staging/r8188eu/hal/usb_halinit.c +1 -1
@@ -492,7 +492,7 @@ static void _InitAntenna_Selection(struct adapter *Adapter) {struct hal_data_8188e *haldata = &Adapter->haldata; -if (haldata->AntDivCfg ==0 ) +if (!support_ant_div (Adapter))return ;rtw_write32 (Adapter,REG_LEDCFG0 ,rtw_read32 (Adapter,REG_LEDCFG0 ) |BIT (23 ));
Signature · 1 line
2.35.1
PATCH 3/5 staging: r8188eu: remove dead code
In reply to Michael StraubeIn rtw_select_and_join_from_scanned_queue() the local variable cur_ant is set but never used. Remove this dead code.
--- drivers/staging/r8188eu/core/rtw_mlme.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme.c +0 -5
@@ -1484,11 +1484,6 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv)rtw_free_assoc_resources (adapter,0 ); } -if (support_ant_div (adapter)) { -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 4/5 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.
--- drivers/staging/r8188eu/core/rtw_mlme.c | 4 ++-- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 +- drivers/staging/r8188eu/hal/usb_halinit.c | 10 +++++++--- drivers/staging/r8188eu/include/hal_intf.h | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme.c +2 -2
@@ -497,7 +497,7 @@ 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 =current_antenna (adapter);memcpy (&pnetwork->network, target,get_wlan_bssid_ex_sz (target));/* variable initialize */ pnetwork->fixed = false;
@@ -520,7 +520,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 =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 =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 +7 -3
@@ -488,6 +488,13 @@ bool support_ant_div(struct adapter *adapter)return haldata->AntDivCfg !=0 ; } +u8 current_antenna (struct adapter *adapter) +{ +struct hal_data_8188e *haldata = &adapter->haldata; + +return haldata->CurAntenna; +} +static void _InitAntenna_Selection (struct adapter *Adapter) {struct hal_data_8188e *haldata = &Adapter->haldata;
@@ -1211,9 +1218,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 +1 -1
@@ -28,7 +28,6 @@ enum hw_variables { };enum hal_def_variable { -HAL_DEF_CURRENT_ANTENNA ,HAL_DEF_DBG_DM_FUNC ,/* for dbg */ };
@@ -64,6 +63,7 @@ uint rtw_hal_deinit(struct adapter *padapter);void rtw_hal_stop (struct adapter *padapter);bool support_ant_div (struct adapter *adapter); +u8 current_antenna (struct adapter *adapter);u32 rtl8188eu_hal_init (struct adapter *Adapter);u32 rtl8188eu_hal_deinit (struct adapter *Adapter);
Signature · 1 line
2.35.1
PATCH 5/5 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.
--- 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
@@ -1212,20 +1212,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