linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] staging: r8188eu: clean up odm phy functions
@ 2022-01-10 12:46 Martin Kaiser
  2022-01-10 12:46 ` [PATCH 1/9] staging: r8188eu: fix phy_RF6052_Config_ParaFile error handling Martin Kaiser
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-10 12:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

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(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/9] staging: r8188eu: fix phy_RF6052_Config_ParaFile error handling
  2022-01-10 12:46 [PATCH 0/9] staging: r8188eu: clean up odm phy functions Martin Kaiser
@ 2022-01-10 12:46 ` Martin Kaiser
  2022-01-10 12:46 ` [PATCH 2/9] staging: r8188eu: remove a constant variable Martin Kaiser
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-10 12:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Fix the error handling in phy_RF6052_Config_ParaFile.
We can simply return rtStatus.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
index 6e0231099986..7e4744989a66 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
@@ -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;
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/9] staging: r8188eu: remove a constant variable
  2022-01-10 12:46 [PATCH 0/9] staging: r8188eu: clean up odm phy functions Martin Kaiser
  2022-01-10 12:46 ` [PATCH 1/9] staging: r8188eu: fix phy_RF6052_Config_ParaFile error handling Martin Kaiser
@ 2022-01-10 12:46 ` Martin Kaiser
  2022-01-10 12:46 ` [PATCH 3/9] staging: r8188eu: remove unused function parameter Martin Kaiser
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-10 12:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

The 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.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
index 7e4744989a66..7474db05e8af 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
@@ -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----*/;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/9] staging: r8188eu: remove unused function parameter
  2022-01-10 12:46 [PATCH 0/9] staging: r8188eu: clean up odm phy functions Martin Kaiser
  2022-01-10 12:46 ` [PATCH 1/9] staging: r8188eu: fix phy_RF6052_Config_ParaFile error handling Martin Kaiser
  2022-01-10 12:46 ` [PATCH 2/9] staging: r8188eu: remove a constant variable Martin Kaiser
@ 2022-01-10 12:46 ` Martin Kaiser
  2022-01-10 12:46 ` [PATCH 4/9] staging: r8188eu: remove constant " Martin Kaiser
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-10 12:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

ODM_ConfigRFWithHeaderFile does not use its content parameter.
Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 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(-)

diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c
index d5212a166dd2..a62af532ac82 100644
--- a/drivers/staging/r8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c
@@ -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)
diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
index 7474db05e8af..a5c94be95ccb 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
@@ -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----*/;
diff --git a/drivers/staging/r8188eu/include/odm_HWConfig.h b/drivers/staging/r8188eu/include/odm_HWConfig.h
index 3ed265e00ac1..efc809354720 100644
--- a/drivers/staging/r8188eu/include/odm_HWConfig.h
+++ b/drivers/staging/r8188eu/include/odm_HWConfig.h
@@ -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,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/9] staging: r8188eu: remove constant function parameter
  2022-01-10 12:46 [PATCH 0/9] staging: r8188eu: clean up odm phy functions Martin Kaiser
                   ` (2 preceding siblings ...)
  2022-01-10 12:46 ` [PATCH 3/9] staging: r8188eu: remove unused function parameter Martin Kaiser
@ 2022-01-10 12:46 ` Martin Kaiser
  2022-01-10 12:46 ` [PATCH 5/9] staging: r8188eu: replace the READ_AND_CONFIG Martin Kaiser
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-10 12:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

The only caller of ODM_ConfigRFWithHeaderFile sets rfpath to RF_PATH_A.
Remove the parameter and the check for RF_PATH_A inside the function.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 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(-)

diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c
index a62af532ac82..ef35e3c31794 100644
--- a/drivers/staging/r8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c
@@ -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;
 }
diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
index a5c94be95ccb..d10a6cc2d4ab 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
@@ -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----*/;
diff --git a/drivers/staging/r8188eu/include/odm_HWConfig.h b/drivers/staging/r8188eu/include/odm_HWConfig.h
index efc809354720..aa468ce34b7e 100644
--- a/drivers/staging/r8188eu/include/odm_HWConfig.h
+++ b/drivers/staging/r8188eu/include/odm_HWConfig.h
@@ -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);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/9] staging: r8188eu: replace the READ_AND_CONFIG
  2022-01-10 12:46 [PATCH 0/9] staging: r8188eu: clean up odm phy functions Martin Kaiser
                   ` (3 preceding siblings ...)
  2022-01-10 12:46 ` [PATCH 4/9] staging: r8188eu: remove constant " Martin Kaiser
@ 2022-01-10 12:46 ` Martin Kaiser
  2022-01-10 12:46 ` [PATCH 6/9] staging: r8188eu: relay errors from ODM_ReadAndConfig_ Martin Kaiser
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-10 12:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

The 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.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/odm_HWConfig.c | 23 ++++++++--------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c
index ef35e3c31794..2f0752418fe2 100644
--- a/drivers/staging/r8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c
@@ -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);
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/9] staging: r8188eu: relay errors from ODM_ReadAndConfig_...
  2022-01-10 12:46 [PATCH 0/9] staging: r8188eu: clean up odm phy functions Martin Kaiser
                   ` (4 preceding siblings ...)
  2022-01-10 12:46 ` [PATCH 5/9] staging: r8188eu: replace the READ_AND_CONFIG Martin Kaiser
@ 2022-01-10 12:46 ` Martin Kaiser
  2022-01-10 12:46 ` [PATCH 7/9] staging: r8188eu: merge ODM_ConfigMACWithHeaderFile into PHY_MACConfig8188E Martin Kaiser
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-10 12:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Most of the ODM_ReadAndConfig_... functions return an error status.
Update their callers to process these return values.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/odm_HWConfig.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c
index 2f0752418fe2..5ec9a04be26b 100644
--- a/drivers/staging/r8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c
@@ -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)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 7/9] staging: r8188eu: merge ODM_ConfigMACWithHeaderFile into PHY_MACConfig8188E
  2022-01-10 12:46 [PATCH 0/9] staging: r8188eu: clean up odm phy functions Martin Kaiser
                   ` (5 preceding siblings ...)
  2022-01-10 12:46 ` [PATCH 6/9] staging: r8188eu: relay errors from ODM_ReadAndConfig_ Martin Kaiser
@ 2022-01-10 12:46 ` Martin Kaiser
  2022-01-10 12:46 ` [PATCH 8/9] staging: r8188eu: remove unused cck, ofdm and mcs rate defines Martin Kaiser
  2022-01-10 12:46 ` [PATCH 9/9] staging: r8188eu: merge ODM_ConfigBBWithHeaderFile with its callers Martin Kaiser
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-10 12:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

The ODM_ConfigMACWithHeaderFile function is only one line. Merge it into
PHY_MACConfig8188E, which is its only caller.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 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(-)

diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c
index 5ec9a04be26b..1c3074fc6be4 100644
--- a/drivers/staging/r8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c
@@ -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);
-}
diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
index c1639df8b1e7..15370b674e53 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
@@ -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 */
diff --git a/drivers/staging/r8188eu/include/odm_HWConfig.h b/drivers/staging/r8188eu/include/odm_HWConfig.h
index aa468ce34b7e..3a8c041dbb66 100644
--- a/drivers/staging/r8188eu/include/odm_HWConfig.h
+++ b/drivers/staging/r8188eu/include/odm_HWConfig.h
@@ -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
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 8/9] staging: r8188eu: remove unused cck, ofdm and mcs rate defines
  2022-01-10 12:46 [PATCH 0/9] staging: r8188eu: clean up odm phy functions Martin Kaiser
                   ` (6 preceding siblings ...)
  2022-01-10 12:46 ` [PATCH 7/9] staging: r8188eu: merge ODM_ConfigMACWithHeaderFile into PHY_MACConfig8188E Martin Kaiser
@ 2022-01-10 12:46 ` Martin Kaiser
  2022-01-10 12:46 ` [PATCH 9/9] staging: r8188eu: merge ODM_ConfigBBWithHeaderFile with its callers Martin Kaiser
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-10 12:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Remove some unused defines for cck, ofdm and mcs rates.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 .../staging/r8188eu/include/odm_HWConfig.h    | 29 -------------------
 1 file changed, 29 deletions(-)

diff --git a/drivers/staging/r8188eu/include/odm_HWConfig.h b/drivers/staging/r8188eu/include/odm_HWConfig.h
index 3a8c041dbb66..1bd6f254bf53 100644
--- a/drivers/staging/r8188eu/include/odm_HWConfig.h
+++ b/drivers/staging/r8188eu/include/odm_HWConfig.h
@@ -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 */
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 9/9] staging: r8188eu: merge ODM_ConfigBBWithHeaderFile with its callers
  2022-01-10 12:46 [PATCH 0/9] staging: r8188eu: clean up odm phy functions Martin Kaiser
                   ` (7 preceding siblings ...)
  2022-01-10 12:46 ` [PATCH 8/9] staging: r8188eu: remove unused cck, ofdm and mcs rate defines Martin Kaiser
@ 2022-01-10 12:46 ` Martin Kaiser
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-10 12:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

ODM_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.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 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(-)

diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c
index 1c3074fc6be4..dcc38b036280 100644
--- a/drivers/staging/r8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c
@@ -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;
-}
diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
index 15370b674e53..0b0690dfb947 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
@@ -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)
diff --git a/drivers/staging/r8188eu/include/odm_HWConfig.h b/drivers/staging/r8188eu/include/odm_HWConfig.h
index 1bd6f254bf53..b37962edb2ed 100644
--- a/drivers/staging/r8188eu/include/odm_HWConfig.h
+++ b/drivers/staging/r8188eu/include/odm_HWConfig.h
@@ -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
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-01-10 12:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10 12:46 [PATCH 0/9] staging: r8188eu: clean up odm phy functions Martin Kaiser
2022-01-10 12:46 ` [PATCH 1/9] staging: r8188eu: fix phy_RF6052_Config_ParaFile error handling Martin Kaiser
2022-01-10 12:46 ` [PATCH 2/9] staging: r8188eu: remove a constant variable Martin Kaiser
2022-01-10 12:46 ` [PATCH 3/9] staging: r8188eu: remove unused function parameter Martin Kaiser
2022-01-10 12:46 ` [PATCH 4/9] staging: r8188eu: remove constant " Martin Kaiser
2022-01-10 12:46 ` [PATCH 5/9] staging: r8188eu: replace the READ_AND_CONFIG Martin Kaiser
2022-01-10 12:46 ` [PATCH 6/9] staging: r8188eu: relay errors from ODM_ReadAndConfig_ Martin Kaiser
2022-01-10 12:46 ` [PATCH 7/9] staging: r8188eu: merge ODM_ConfigMACWithHeaderFile into PHY_MACConfig8188E Martin Kaiser
2022-01-10 12:46 ` [PATCH 8/9] staging: r8188eu: remove unused cck, ofdm and mcs rate defines Martin Kaiser
2022-01-10 12:46 ` [PATCH 9/9] staging: r8188eu: merge ODM_ConfigBBWithHeaderFile with its callers Martin Kaiser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).