staging: r8188eu: clean up odm phy functions
cover staging: r8188eu: clean up odm phy functions
This set cleans up the error handling for some of the odm phy functions and merges small functions. While at it, it also removes a couple of unused defines.
Martin Kaiser (9):
staging: r8188eu: fix phy_RF6052_Config_ParaFile error handling
staging: r8188eu: remove a constant variable
staging: r8188eu: remove unused function parameter
staging: r8188eu: remove constant function parameter
staging: r8188eu: replace the READ_AND_CONFIG
staging: r8188eu: relay errors from ODM_ReadAndConfig_...
staging: r8188eu: merge ODM_ConfigMACWithHeaderFile into
PHY_MACConfig8188E
staging: r8188eu: remove unused cck, ofdm and mcs rate defines
staging: r8188eu: merge ODM_ConfigBBWithHeaderFile with its callers
drivers/staging/r8188eu/hal/odm_HWConfig.c | 34 +--------------- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 10 ++--- drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 11 +----- .../staging/r8188eu/include/odm_HWConfig.h | 39 +------------------ 4 files changed, 9 insertions(+), 85 deletions(-)
Signature · 1 line
2.30.2
PATCH 1/9 staging: r8188eu: fix phy_RF6052_Config_ParaFile error handling
Fix the error handling in phy_RF6052_Config_ParaFile. We can simply return rtStatus.
--- drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_rf6052.c +0 -6
@@ -406,12 +406,6 @@ static int phy_RF6052_Config_ParaFile(struct adapter *Adapter)/*----Restore RFENV control type----*/ ;rtl8188e_PHY_SetBBReg (Adapter, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue); -if (rtStatus != _SUCCESS) - goto phy_RF6052_Config_ParaFile_Fail; - -return rtStatus; - -phy_RF6052_Config_ParaFile_Fail:return rtStatus; }
Signature · 1 line
2.30.2
PATCH 2/9 staging: r8188eu: remove a constant variable
In reply to Martin KaiserThe eRFPath variable in phy_RF6052_Config_ParaFile is always 0.
Remove the variable and use 0 directly. (enum rf_radio_path)eRFPath can be replaced with RF_PATH_A, which is defined as 0.
--- drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_rf6052.c +2 -3
@@ -374,12 +374,11 @@ static int phy_RF6052_Config_ParaFile(struct adapter *Adapter)struct bb_reg_def *pPhyReg;struct hal_data_8188e *pHalData = &Adapter->haldata;u32 u4RegValue =0 ; -u8 eRFPath =0 ;int rtStatus = _SUCCESS;/* Initialize RF */ - pPhyReg = &pHalData->PHYRegDef[eRFPath]; + pPhyReg = &pHalData->PHYRegDef[0 ];/*----Store original RFENV control type----*/ u4RegValue =rtl8188e_PHY_QueryBBReg (Adapter, pPhyReg->rfintfs, bRFSI_RFENV);
@@ -400,7 +399,7 @@ static int phy_RF6052_Config_ParaFile(struct adapter *Adapter)udelay (1 );/* PlatformStallExecution(1); */ /*----Initialize RF fom connfiguration file----*/ -if (HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile (&pHalData->odmpriv, (enum rf_radio_path )eRFPath, (enum rf_radio_path )eRFPath)) +if (HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile (&pHalData->odmpriv,RF_PATH_A ,RF_PATH_A )) rtStatus = _FAIL;/*----Restore RFENV control type----*/ ;
Signature · 1 line
2.30.2
PATCH 3/9 staging: r8188eu: remove unused function parameter
In reply to Martin KaiserODM_ConfigRFWithHeaderFile does not use its content parameter. Remove it.
--- drivers/staging/r8188eu/hal/odm_HWConfig.c | 1 - drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 2 +- drivers/staging/r8188eu/include/odm_HWConfig.h | 1 - 3 files changed, 1 insertion(+), 3 deletions(-)
drivers/staging/r8188eu/hal/odm_HWConfig.c +0 -1
@@ -363,7 +363,6 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm, }enum HAL_STATUS ODM_ConfigRFWithHeaderFile (struct odm_dm_struct *dm_odm, -enum rf_radio_path content,enum rf_radio_path rfpath) {if (rfpath ==RF_PATH_A )
drivers/staging/r8188eu/hal/rtl8188e_rf6052.c +1 -1
@@ -399,7 +399,7 @@ static int phy_RF6052_Config_ParaFile(struct adapter *Adapter)udelay (1 );/* PlatformStallExecution(1); */ /*----Initialize RF fom connfiguration file----*/ -if (HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile (&pHalData->odmpriv,RF_PATH_A ,RF_PATH_A )) +if (HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile (&pHalData->odmpriv,RF_PATH_A )) rtStatus = _FAIL;/*----Restore RFENV control type----*/ ;
drivers/staging/r8188eu/include/odm_HWConfig.h +0 -1
@@ -96,7 +96,6 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *pDM_Odm, struct adapter *adapt);enum HAL_STATUS ODM_ConfigRFWithHeaderFile (struct odm_dm_struct *pDM_Odm, -enum rf_radio_path Content,enum rf_radio_path eRFPath); enum HAL_STATUS ODM_ConfigBBWithHeaderFile(struct odm_dm_struct *pDM_Odm,
Signature · 1 line
2.30.2
PATCH 4/9 staging: r8188eu: remove constant function parameter
In reply to Martin KaiserThe only caller of ODM_ConfigRFWithHeaderFile sets rfpath to RF_PATH_A. Remove the parameter and the check for RF_PATH_A inside the function.
--- drivers/staging/r8188eu/hal/odm_HWConfig.c | 6 ++---- drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 2 +- drivers/staging/r8188eu/include/odm_HWConfig.h | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-)
drivers/staging/r8188eu/hal/odm_HWConfig.c +2 -4
@@ -362,11 +362,9 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm,odm_Process_RSSIForDM (dm_odm, pPhyInfo, pPktinfo); } -enum HAL_STATUS ODM_ConfigRFWithHeaderFile (struct odm_dm_struct *dm_odm, -enum rf_radio_path rfpath) +enum HAL_STATUS ODM_ConfigRFWithHeaderFile (struct odm_dm_struct *dm_odm) { -if (rfpath ==RF_PATH_A ) -READ_AND_CONFIG (8188E , _RadioA_1T_); +READ_AND_CONFIG (8188E , _RadioA_1T_);return HAL_STATUS_SUCCESS ; }
drivers/staging/r8188eu/hal/rtl8188e_rf6052.c +1 -1
@@ -399,7 +399,7 @@ static int phy_RF6052_Config_ParaFile(struct adapter *Adapter)udelay (1 );/* PlatformStallExecution(1); */ /*----Initialize RF fom connfiguration file----*/ -if (HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile (&pHalData->odmpriv,RF_PATH_A )) +if (HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile (&pHalData->odmpriv)) rtStatus = _FAIL;/*----Restore RFENV control type----*/ ;
drivers/staging/r8188eu/include/odm_HWConfig.h +1 -2
@@ -95,8 +95,7 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *pDM_Odm,struct odm_per_pkt_info *pPktinfo, struct adapter *adapt); -enum HAL_STATUS ODM_ConfigRFWithHeaderFile (struct odm_dm_struct *pDM_Odm, -enum rf_radio_path eRFPath); +enum HAL_STATUS ODM_ConfigRFWithHeaderFile (struct odm_dm_struct *pDM_Odm);enum HAL_STATUS ODM_ConfigBBWithHeaderFile (struct odm_dm_struct *pDM_Odm,enum odm_bb_config_type ConfigType);
Signature · 1 line
2.30.2
PATCH 5/9 staging: r8188eu: replace the READ_AND_CONFIG
In reply to Martin KaiserThe READ_AND_CONFIG macro builds a function name from chip type and table name.
Remove the macro and use the resulting function names directly. This makes the code easier to read.
--- drivers/staging/r8188eu/hal/odm_HWConfig.c | 23 ++++++++-------------- 1 file changed, 8 insertions(+), 15 deletions(-)
drivers/staging/r8188eu/hal/odm_HWConfig.c +8 -15
@@ -3,10 +3,6 @@#include "../include/drv_types.h" -#define READ_AND_CONFIG READ_AND_CONFIG_MP - -#define READ_AND_CONFIG_MP (ic, txt) (ODM_ReadAndConfig##txt##ic(dm_odm)) -static u8 odm_QueryRxPwrPercentage (s8 AntPower) {if ((AntPower <=-100 ) || (AntPower >=20 ))
@@ -364,7 +360,7 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm,enum HAL_STATUS ODM_ConfigRFWithHeaderFile (struct odm_dm_struct *dm_odm) { -READ_AND_CONFIG (8188E , _RadioA_1T_); +ODM_ReadAndConfig_RadioA_1T_8188E (dm_odm);return HAL_STATUS_SUCCESS ; }
@@ -372,20 +368,17 @@ enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *dm_odm)enum HAL_STATUS ODM_ConfigBBWithHeaderFile (struct odm_dm_struct *dm_odm,enum odm_bb_config_type config_tp) { -if (config_tp ==CONFIG_BB_PHY_REG ) { -READ_AND_CONFIG (8188E , _PHY_REG_1T_); - }else if (config_tp ==CONFIG_BB_AGC_TAB ) { -READ_AND_CONFIG (8188E , _AGC_TAB_1T_); - }else if (config_tp ==CONFIG_BB_PHY_REG_PG ) { -READ_AND_CONFIG (8188E , _PHY_REG_PG_); - } +if (config_tp ==CONFIG_BB_PHY_REG ) +ODM_ReadAndConfig_PHY_REG_1T_8188E (dm_odm); +else if (config_tp ==CONFIG_BB_AGC_TAB ) +ODM_ReadAndConfig_AGC_TAB_1T_8188E (dm_odm); +else if (config_tp ==CONFIG_BB_PHY_REG_PG ) +ODM_ReadAndConfig_PHY_REG_PG_8188E (dm_odm);return HAL_STATUS_SUCCESS ; }enum HAL_STATUS ODM_ConfigMACWithHeaderFile (struct odm_dm_struct *dm_odm) { -u8 result =HAL_STATUS_SUCCESS ; - result =READ_AND_CONFIG (8188E , _MAC_REG_); -return result; +return ODM_ReadAndConfig_MAC_REG_8188E (dm_odm); }
Signature · 1 line
2.30.2
PATCH 6/9 staging: r8188eu: relay errors from ODM_ReadAndConfig_...
In reply to Martin KaiserMost of the ODM_ReadAndConfig_... functions return an error status. Update their callers to process these return values.
--- drivers/staging/r8188eu/hal/odm_HWConfig.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/staging/r8188eu/hal/odm_HWConfig.c +9 -9
@@ -360,22 +360,22 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm,enum HAL_STATUS ODM_ConfigRFWithHeaderFile (struct odm_dm_struct *dm_odm) { -ODM_ReadAndConfig_RadioA_1T_8188E (dm_odm); - -return HAL_STATUS_SUCCESS ; +return ODM_ReadAndConfig_RadioA_1T_8188E (dm_odm); }enum HAL_STATUS ODM_ConfigBBWithHeaderFile (struct odm_dm_struct *dm_odm,enum odm_bb_config_type config_tp) { -if (config_tp ==CONFIG_BB_PHY_REG ) -ODM_ReadAndConfig_PHY_REG_1T_8188E (dm_odm); -else if (config_tp ==CONFIG_BB_AGC_TAB ) -ODM_ReadAndConfig_AGC_TAB_1T_8188E (dm_odm); -else if (config_tp ==CONFIG_BB_PHY_REG_PG ) +if (config_tp ==CONFIG_BB_PHY_REG ) { +return ODM_ReadAndConfig_PHY_REG_1T_8188E (dm_odm); + }else if (config_tp ==CONFIG_BB_AGC_TAB ) { +return ODM_ReadAndConfig_AGC_TAB_1T_8188E (dm_odm); + }else if (config_tp ==CONFIG_BB_PHY_REG_PG ) {ODM_ReadAndConfig_PHY_REG_PG_8188E (dm_odm); +return HAL_STATUS_SUCCESS ; + } -return HAL_STATUS_SUCCESS ; +return HAL_STATUS_FAILURE ; }enum HAL_STATUS ODM_ConfigMACWithHeaderFile (struct odm_dm_struct *dm_odm)
Signature · 1 line
2.30.2
PATCH 7/9 staging: r8188eu: merge ODM_ConfigMACWithHeaderFile into PHY_MACConfig8188E
In reply to Martin KaiserThe ODM_ConfigMACWithHeaderFile function is only one line. Merge it into PHY_MACConfig8188E, which is its only caller.
--- drivers/staging/r8188eu/hal/odm_HWConfig.c | 5 ----- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 2 +- drivers/staging/r8188eu/include/odm_HWConfig.h | 3 --- 3 files changed, 1 insertion(+), 9 deletions(-)
drivers/staging/r8188eu/hal/odm_HWConfig.c +0 -5
@@ -377,8 +377,3 @@ enum HAL_STATUS ODM_ConfigBBWithHeaderFile(struct odm_dm_struct *dm_odm,return HAL_STATUS_FAILURE ; } - -enum HAL_STATUS ODM_ConfigMACWithHeaderFile (struct odm_dm_struct *dm_odm) -{ -return ODM_ReadAndConfig_MAC_REG_8188E (dm_odm); -}
drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +1 -1
@@ -342,7 +342,7 @@ s32 PHY_MACConfig8188E(struct adapter *Adapter)/* */ /* Config MAC */ /* */ -if (HAL_STATUS_FAILURE ==ODM_ConfigMACWithHeaderFile (&pHalData->odmpriv)) +if (HAL_STATUS_FAILURE ==ODM_ReadAndConfig_MAC_REG_8188E (&pHalData->odmpriv)) rtStatus = _FAIL;/* 2010.07.13 AMPDU aggregation number B */
drivers/staging/r8188eu/include/odm_HWConfig.h +0 -3
@@ -99,7 +99,4 @@ enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *pDM_Odm);enum HAL_STATUS ODM_ConfigBBWithHeaderFile (struct odm_dm_struct *pDM_Odm,enum odm_bb_config_type ConfigType); - -enum HAL_STATUS ODM_ConfigMACWithHeaderFile (struct odm_dm_struct *pDM_Odm); -#endif
Signature · 1 line
2.30.2
PATCH 8/9 staging: r8188eu: remove unused cck, ofdm and mcs rate defines
In reply to Martin KaiserRemove some unused defines for cck, ofdm and mcs rates.
--- .../staging/r8188eu/include/odm_HWConfig.h | 29 ------------------- 1 file changed, 29 deletions(-)
drivers/staging/r8188eu/include/odm_HWConfig.h +0 -29
@@ -4,42 +4,13 @@#ifndef __HALHWOUTSRC_H__#define __HALHWOUTSRC_H__ -/* Definition */ /* CCK Rates, TxHT = 0 */ #define DESC92C_RATE1M 0x00 -#define DESC92C_RATE2M 0x01 -#define DESC92C_RATE5_5M 0x02#define DESC92C_RATE11M 0x03 -/* OFDM Rates, TxHT = 0 */ -#define DESC92C_RATE6M 0x04 -#define DESC92C_RATE9M 0x05 -#define DESC92C_RATE12M 0x06 -#define DESC92C_RATE18M 0x07 -#define DESC92C_RATE24M 0x08 -#define DESC92C_RATE36M 0x09 -#define DESC92C_RATE48M 0x0a -#define DESC92C_RATE54M 0x0b -/* MCS Rates, TxHT = 1 */ -#define DESC92C_RATEMCS0 0x0c -#define DESC92C_RATEMCS1 0x0d -#define DESC92C_RATEMCS2 0x0e -#define DESC92C_RATEMCS3 0x0f -#define DESC92C_RATEMCS4 0x10 -#define DESC92C_RATEMCS5 0x11 -#define DESC92C_RATEMCS6 0x12 -#define DESC92C_RATEMCS7 0x13#define DESC92C_RATEMCS8 0x14 -#define DESC92C_RATEMCS9 0x15 -#define DESC92C_RATEMCS10 0x16 -#define DESC92C_RATEMCS11 0x17 -#define DESC92C_RATEMCS12 0x18 -#define DESC92C_RATEMCS13 0x19 -#define DESC92C_RATEMCS14 0x1a#define DESC92C_RATEMCS15 0x1b -#define DESC92C_RATEMCS15_SG 0x1c -#define DESC92C_RATEMCS32 0x20/* structure and define */
Signature · 1 line
2.30.2
PATCH 9/9 staging: r8188eu: merge ODM_ConfigBBWithHeaderFile with its callers
In reply to Martin KaiserODM_ConfigBBWithHeaderFile is a "multiplexer" for ODM_ReadAndConfig_... functions. It's called only from phy_BB8188E_Config_ParaFile.
We can remove ODM_ConfigBBWithHeaderFile and call the ODM_ReadAndConfig_... functions directly.
ODM_ReadAndConfig_PHY_REG_PG_8188E does not return an error status, there's no need for a check.
--- drivers/staging/r8188eu/hal/odm_HWConfig.c | 15 --------------- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 8 +++----- drivers/staging/r8188eu/include/odm_HWConfig.h | 3 --- 3 files changed, 3 insertions(+), 23 deletions(-)
drivers/staging/r8188eu/hal/odm_HWConfig.c +0 -15
@@ -362,18 +362,3 @@ enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *dm_odm) {return ODM_ReadAndConfig_RadioA_1T_8188E (dm_odm); } - -enum HAL_STATUS ODM_ConfigBBWithHeaderFile (struct odm_dm_struct *dm_odm, -enum odm_bb_config_type config_tp) -{ -if (config_tp ==CONFIG_BB_PHY_REG ) { -return ODM_ReadAndConfig_PHY_REG_1T_8188E (dm_odm); - }else if (config_tp ==CONFIG_BB_AGC_TAB ) { -return ODM_ReadAndConfig_AGC_TAB_1T_8188E (dm_odm); - }else if (config_tp ==CONFIG_BB_PHY_REG_PG ) { -ODM_ReadAndConfig_PHY_REG_PG_8188E (dm_odm); -return HAL_STATUS_SUCCESS ; - } - -return HAL_STATUS_FAILURE ; -}
drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +3 -5
@@ -493,7 +493,7 @@ static int phy_BB8188E_Config_ParaFile(struct adapter *Adapter)/* 1. Read PHY_REG.TXT BB INIT!! */ /* We will separate as 88C / 92C according to chip version */ /* */ -if (HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile (&pHalData->odmpriv,CONFIG_BB_PHY_REG )) +if (HAL_STATUS_FAILURE ==ODM_ReadAndConfig_PHY_REG_1T_8188E (&pHalData->odmpriv)) rtStatus = _FAIL;if (rtStatus != _SUCCESS) goto phy_BB8190_Config_ParaFile_Fail;
@@ -501,16 +501,14 @@ static int phy_BB8188E_Config_ParaFile(struct adapter *Adapter)/* 2. If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt */ if (!pEEPROM->bautoload_fail_flag) { pHalData->pwrGroupCnt =0 ; - -if (HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile (&pHalData->odmpriv,CONFIG_BB_PHY_REG_PG )) - rtStatus = _FAIL; +ODM_ReadAndConfig_PHY_REG_PG_8188E (&pHalData->odmpriv); }if (rtStatus != _SUCCESS) goto phy_BB8190_Config_ParaFile_Fail;/* 3. BB AGC table Initialization */ -if (HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile (&pHalData->odmpriv,CONFIG_BB_AGC_TAB )) +if (HAL_STATUS_FAILURE ==ODM_ReadAndConfig_AGC_TAB_1T_8188E (&pHalData->odmpriv)) rtStatus = _FAIL;if (rtStatus != _SUCCESS)
drivers/staging/r8188eu/include/odm_HWConfig.h +0 -3
@@ -67,7 +67,4 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *pDM_Odm, struct adapter *adapt);enum HAL_STATUS ODM_ConfigRFWithHeaderFile (struct odm_dm_struct *pDM_Odm); - -enum HAL_STATUS ODM_ConfigBBWithHeaderFile (struct odm_dm_struct *pDM_Odm, -enum odm_bb_config_type ConfigType);#endif
Signature · 1 line
2.30.2