staging: r8188eu: odm cleanups
cover staging: r8188eu: odm cleanups
This set removes two more functions from the unwanted hal/odm layer. Tested on x86_64 with Inter-Tech DMG-02.
Michael Straube (5):
staging: r8188eu: remove ODM_CmnInfoHook()
staging: r8188eu: convert two u8 variables to bool
staging: r8188eu: remove enum odm_bw
staging: r8188eu: convert type of pBandWidth in odm_dm_struct
staging: r8188eu: remove ODM_CmnInfoUpdate()
drivers/staging/r8188eu/hal/odm.c | 56 +------------------ drivers/staging/r8188eu/hal/rtl8188e_dm.c | 19 ++++--- drivers/staging/r8188eu/include/odm.h | 29 +--------- drivers/staging/r8188eu/include/rtw_mlme.h | 2 +- drivers/staging/r8188eu/include/rtw_pwrctrl.h | 2 +- 5 files changed, 16 insertions(+), 92 deletions(-)
Signature · 1 line
2.35.1
PATCH 1/5 staging: r8188eu: remove ODM_CmnInfoHook()
Each case in ODM_CmnInfoHook() just sets a single variable. Set the variables directly and remove ODM_CmnInfoHook().
--- drivers/staging/r8188eu/hal/odm.c | 31 ----------------------- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 13 +++++----- drivers/staging/r8188eu/include/odm.h | 14 ---------- 3 files changed, 7 insertions(+), 51 deletions(-)
drivers/staging/r8188eu/hal/odm.c +0 -31
@@ -639,37 +639,6 @@ void ODM_CmnInfoInit(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def Cmn pDM_Odm->BbSwingFlagOfdm = false; } -void ODM_CmnInfoHook (struct odm_dm_struct *pDM_Odm,enum odm_common_info_def CmnInfo,void *pValue) -{ -/* */ -/* Hook call by reference pointer. */ -/* */ -switch (CmnInfo) { -/* Dynamic call by reference pointer. */ -case ODM_CMNINFO_WM_MODE : - pDM_Odm->pWirelessMode = (u8 *)pValue; -break ; -case ODM_CMNINFO_SEC_CHNL_OFFSET : - pDM_Odm->pSecChOffset = (u8 *)pValue; -break ; -case ODM_CMNINFO_BW : - pDM_Odm->pBandWidth = (u8 *)pValue; -break ; -case ODM_CMNINFO_CHNL : - pDM_Odm->pChannel = (u8 *)pValue; -break ; -case ODM_CMNINFO_SCAN : - pDM_Odm->pbScanInProcess = (bool *)pValue; -break ; -case ODM_CMNINFO_POWER_SAVING : - pDM_Odm->pbPowerSaving = (bool *)pValue; -break ; -default : -/* do nothing */ -break ; - } -} -/* Update Band/CHannel/.. The values are dynamic but non-per-packet. */ void ODM_CmnInfoUpdate (struct odm_dm_struct *pDM_Odm,u32 CmnInfo,u64 Value) {
drivers/staging/r8188eu/hal/rtl8188e_dm.c +7 -6
@@ -38,12 +38,13 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter)ODM_CmnInfoUpdate (dm_odm,ODM_CMNINFO_ABILITY , pdmpriv->InitODMFlag); -ODM_CmnInfoHook (dm_odm,ODM_CMNINFO_WM_MODE , &pmlmeext->cur_wireless_mode); -ODM_CmnInfoHook (dm_odm,ODM_CMNINFO_SEC_CHNL_OFFSET , &hal_data->nCur40MhzPrimeSC); -ODM_CmnInfoHook (dm_odm,ODM_CMNINFO_BW , &hal_data->CurrentChannelBW); -ODM_CmnInfoHook (dm_odm,ODM_CMNINFO_CHNL , &hal_data->CurrentChannel); -ODM_CmnInfoHook (dm_odm,ODM_CMNINFO_SCAN , &pmlmepriv->bScanInProcess); -ODM_CmnInfoHook (dm_odm,ODM_CMNINFO_POWER_SAVING , &pwrctrlpriv->bpower_saving); + dm_odm->pWirelessMode = &pmlmeext->cur_wireless_mode; + dm_odm->pSecChOffset = &hal_data->nCur40MhzPrimeSC; + dm_odm->pBandWidth = (u8 *)&hal_data->CurrentChannelBW; + dm_odm->pChannel = &hal_data->CurrentChannel; + dm_odm->pbScanInProcess = (bool *)&pmlmepriv->bScanInProcess; + dm_odm->pbPowerSaving = (bool *)&pwrctrlpriv->bpower_saving; +ODM_CmnInfoInit (dm_odm,ODM_CMNINFO_RF_ANTENNA_TYPE , hal_data->TRxAntDivType);for (i =0 ; i <NUM_STA ; i++)
drivers/staging/r8188eu/include/odm.h +0 -14
@@ -126,17 +126,6 @@ enum odm_common_info_def {ODM_CMNINFO_MP_TEST_CHIP ,/* HOOK BEFORE REG INIT----------- */ -/* Dynamic value: */ -/* POINTER REFERENCE----------- */ -ODM_CMNINFO_WM_MODE ,/* ODM_WIRELESS_MODE_E */ -ODM_CMNINFO_SEC_CHNL_OFFSET ,/* ODM_SEC_CHNL_OFFSET_E */ -ODM_CMNINFO_BW ,/* ODM_BW_E */ -ODM_CMNINFO_CHNL , - -ODM_CMNINFO_SCAN , -ODM_CMNINFO_POWER_SAVING , -/* POINTER REFERENCE----------- */ -/* CALL BY VALUE------------- */ ODM_CMNINFO_LINK , ODM_CMNINFO_RSSI_MIN,
@@ -472,9 +461,6 @@ void ODM_DMWatchdog(struct odm_dm_struct *pDM_Odm);void ODM_CmnInfoInit (struct odm_dm_struct *pDM_Odm,enum odm_common_info_def CmnInfo,u32 Value); -void ODM_CmnInfoHook (struct odm_dm_struct *pDM_Odm, -enum odm_common_info_def CmnInfo,void *pValue); -void ODM_CmnInfoUpdate (struct odm_dm_struct *pDM_Odm,u32 CmnInfo,u64 Value);#endif
Signature · 1 line
2.35.1
PATCH 2/5 staging: r8188eu: convert two u8 variables to bool
In reply to Michael StraubeThe variables bScanInProcess in struct mlme_priv and bpower_saving in struct pwrctrl_priv are both unsed to store only boolean values true and false. Convert them from u8 to bool to avoid type casts in the function Update_ODM_ComInfo_88E().
--- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 4 ++-- drivers/staging/r8188eu/include/rtw_mlme.h | 2 +- drivers/staging/r8188eu/include/rtw_pwrctrl.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_dm.c +2 -2
@@ -42,8 +42,8 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter) dm_odm->pSecChOffset = &hal_data->nCur40MhzPrimeSC; dm_odm->pBandWidth = (u8 *)&hal_data->CurrentChannelBW; dm_odm->pChannel = &hal_data->CurrentChannel; - dm_odm->pbScanInProcess = (bool *)&pmlmepriv->bScanInProcess; - dm_odm->pbPowerSaving = (bool *)&pwrctrlpriv->bpower_saving; + dm_odm->pbScanInProcess = &pmlmepriv->bScanInProcess; + dm_odm->pbPowerSaving = &pwrctrlpriv->bpower_saving;ODM_CmnInfoInit (dm_odm,ODM_CMNINFO_RF_ANTENNA_TYPE , hal_data->TRxAntDivType);
drivers/staging/r8188eu/include/rtw_mlme.h +1 -1
@@ -310,7 +310,7 @@ struct qos_priv {struct mlme_priv {spinlock_t lock;int fw_state;/* shall we protect this variable? maybe not necessarily... */ -u8 bScanInProcess; +bool bScanInProcess;u8 to_join;/* flag */ u8 to_roaming;/* roaming trying times */
drivers/staging/r8188eu/include/rtw_pwrctrl.h +1 -1
@@ -49,7 +49,7 @@ struct pwrctrl_priv {u32 alives;struct work_struct cpwm_event; -u8 bpower_saving; +bool bpower_saving;u8 reg_rfoff;u8 reg_pdnmode;/* powerdown mode */
Signature · 1 line
2.35.1
PATCH 3/5 staging: r8188eu: remove enum odm_bw
In reply to Michael StraubeThe enums odm_bw and ht_channel_width are redundant. Keep ht_channel_width and remove odm_bw.
--- drivers/staging/r8188eu/hal/odm.c | 4 ++-- drivers/staging/r8188eu/include/odm.h | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-)
drivers/staging/r8188eu/hal/odm.c +2 -2
@@ -266,7 +266,7 @@ static void odm_CommonInfoSelfUpdate(struct odm_dm_struct *pDM_Odm)u8 i;struct sta_info *pEntry; -if (*pDM_Odm->pBandWidth ==ODM_BW40M ) { +if (*pDM_Odm->pBandWidth ==HT_CHANNEL_WIDTH_40 ) {if (*pDM_Odm->pSecChOffset ==1 ) pDM_Odm->ControlChannel = *pDM_Odm->pChannel -2 ;else if (*pDM_Odm->pSecChOffset ==2 )
@@ -766,7 +766,7 @@ u32 ODM_Get_Rate_Bitmap(struct odm_dm_struct *pDM_Odm, u32 macid, u32 ra_mask, u }else if (rssi_level ==DM_RATR_STA_MIDDLE ) { rate_bitmap =0x000ff000 ; }else { -if (*pDM_Odm->pBandWidth ==ODM_BW40M ) +if (*pDM_Odm->pBandWidth ==HT_CHANNEL_WIDTH_40 ) rate_bitmap =0x000ff015 ;else rate_bitmap =0x000ff005 ;
drivers/staging/r8188eu/include/odm.h +0 -6
@@ -166,12 +166,6 @@ enum odm_wireless_mode { ODM_WM_AUTO = BIT(5), }; -/* ODM_CMNINFO_BW */ -enum odm_bw { -ODM_BW20M =0 , -ODM_BW40M =1 , -}; -struct odm_ra_info {u8 RateID;u32 RateMask;
Signature · 1 line
2.35.1
PATCH 4/5 staging: r8188eu: convert type of pBandWidth in odm_dm_struct
In reply to Michael StraubeThe variable pBandWidth in odm_dm_struct stores constants from enum ht_channel_width. Change the type of pBandWidth from u8 pointer to enum ht_channel_width pointer to get rid of a type cast in function Update_ODM_ComInfo_88E().
--- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 2 +- drivers/staging/r8188eu/include/odm.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_dm.c +1 -1
@@ -40,7 +40,7 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter) dm_odm->pWirelessMode = &pmlmeext->cur_wireless_mode; dm_odm->pSecChOffset = &hal_data->nCur40MhzPrimeSC; - dm_odm->pBandWidth = (u8 *)&hal_data->CurrentChannelBW; + dm_odm->pBandWidth = &hal_data->CurrentChannelBW; dm_odm->pChannel = &hal_data->CurrentChannel; dm_odm->pbScanInProcess = &pmlmepriv->bScanInProcess; dm_odm->pbPowerSaving = &pwrctrlpriv->bpower_saving;
drivers/staging/r8188eu/include/odm.h +1 -1
@@ -324,7 +324,7 @@ struct odm_dm_struct {/* Secondary channel offset don't_care/below/above = 0/1/2 */ u8 *pSecChOffset;/* BW info 20M/40M/80M = 0/1/2 */ -u8 *pBandWidth; +enum ht_channel_width *pBandWidth;/* Central channel location Ch1/Ch2/.... */ u8 *pChannel;/* central channel number */
Signature · 1 line
2.35.1
PATCH 5/5 staging: r8188eu: remove ODM_CmnInfoUpdate()
In reply to Michael StraubeEach case in ODM_CmnInfoUpdate() just sets a single variable. Set the variables directly and remove ODM_CmnInfoUpdate().
--- drivers/staging/r8188eu/hal/odm.c | 21 +-------------------- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 4 ++-- drivers/staging/r8188eu/include/odm.h | 7 ------- 3 files changed, 3 insertions(+), 29 deletions(-)
drivers/staging/r8188eu/hal/odm.c +1 -20
@@ -464,7 +464,7 @@ static void odm_RSSIMonitorCheck(struct odm_dm_struct *pDM_Odm) pdmpriv->EntryMinUndecoratedSmoothedPWDB =0 ;FindMinimumRSSI (Adapter); -ODM_CmnInfoUpdate (&pHalData->odmpriv,ODM_CMNINFO_RSSI_MIN , pdmpriv->MinUndecoratedPWDBForDM); + pHalData->odmpriv.RSSI_Min = pdmpriv->MinUndecoratedPWDBForDM; }static void odm_TXPowerTrackingThermalMeterInit (struct odm_dm_struct *pDM_Odm)
@@ -639,25 +639,6 @@ void ODM_CmnInfoInit(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def Cmn pDM_Odm->BbSwingFlagOfdm = false; } -/* Update Band/CHannel/.. The values are dynamic but non-per-packet. */ -void ODM_CmnInfoUpdate (struct odm_dm_struct *pDM_Odm,u32 CmnInfo,u64 Value) -{ -/* */ -/* This init variable may be changed in run time. */ -/* */ -switch (CmnInfo) { -case ODM_CMNINFO_ABILITY : - pDM_Odm->SupportAbility = (u32 )Value; -break ; -case ODM_CMNINFO_LINK : - pDM_Odm->bLinked = (bool )Value; -break ; -case ODM_CMNINFO_RSSI_MIN : - pDM_Odm->RSSI_Min = (u8 )Value; -break ; - } -} -void ODM_Write_DIG (struct odm_dm_struct *pDM_Odm,u8 CurrentIGI) {struct rtw_dig *pDM_DigTable = &pDM_Odm->DM_DigTable;
drivers/staging/r8188eu/hal/rtl8188e_dm.c +2 -2
@@ -36,7 +36,7 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter)if (hal_data->AntDivCfg) pdmpriv->InitODMFlag |=ODM_BB_ANT_DIV ; -ODM_CmnInfoUpdate (dm_odm,ODM_CMNINFO_ABILITY , pdmpriv->InitODMFlag); + dm_odm->SupportAbility = pdmpriv->InitODMFlag; dm_odm->pWirelessMode = &pmlmeext->cur_wireless_mode; dm_odm->pSecChOffset = &hal_data->nCur40MhzPrimeSC;
@@ -80,7 +80,7 @@ void rtl8188e_HalDmWatchDog(struct adapter *Adapter) bLinked = true; } -ODM_CmnInfoUpdate (&hal_data->odmpriv,ODM_CMNINFO_LINK , bLinked); + hal_data->odmpriv.bLinked = bLinked;ODM_DMWatchdog (&hal_data->odmpriv); }
drivers/staging/r8188eu/include/odm.h +0 -7
@@ -122,19 +122,14 @@ enum odm_common_info_def {/* Fixed value: */ /* HOOK BEFORE REG INIT----------- */ -ODM_CMNINFO_ABILITY ,/* ODM_ABILITY_E */ ODM_CMNINFO_MP_TEST_CHIP ,/* HOOK BEFORE REG INIT----------- */ /* CALL BY VALUE------------- */ -ODM_CMNINFO_LINK , -ODM_CMNINFO_RSSI_MIN , ODM_CMNINFO_RF_ANTENNA_TYPE, /* u8 */ /* CALL BY VALUE-------------*/ }; -/* 2011/10/20 MH Define ODM support ability. ODM_CMNINFO_ABILITY */ -enum odm_ability_def {/* BB ODM section BIT 0-15 */ ODM_BB_RSSI_MONITOR = BIT(4),
@@ -455,6 +450,4 @@ void ODM_DMWatchdog(struct odm_dm_struct *pDM_Odm);void ODM_CmnInfoInit (struct odm_dm_struct *pDM_Odm,enum odm_common_info_def CmnInfo,u32 Value); -void ODM_CmnInfoUpdate (struct odm_dm_struct *pDM_Odm,u32 CmnInfo,u64 Value); -#endif
Signature · 1 line
2.35.1