Skip to contentSkip to conversation

staging: rtl8723bs: rename members of struct registry_priv

PATCH Superseded Ethan Tidmore 3 participants 4 messages Jan 26 – Jan 27 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: rename members of struct registry_priv

Rename CamelCase members of struct registry_priv to snake_case to comply with the Linux kernel coding style.

As some of these renames result in longer variable names, use a local pointer in deeply nested functions to avoid exceeding the 100-column limit and fix block braces where necessary to maintain style consistency.

---
 .../staging/rtl8723bs/hal/hal_com_phycfg.c    | 16 ++++++----
 .../staging/rtl8723bs/hal/rtl8723b_phycfg.c   | 32 ++++++++-----------
 drivers/staging/rtl8723bs/include/drv_types.h | 18 +++++------
 .../rtl8723bs/include/hal_com_phycfg.h        |  2 +-
 drivers/staging/rtl8723bs/os_dep/os_intfs.c   | 12 +++----
 5 files changed, 39 insertions(+), 41 deletions(-)
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +9 -7
index cd76e26e8..450bd2e38 100644
@@ -573,8 +573,9 @@ s8 PHY_GetTxPowerByRate(struct adapter *padapter, u8 RFPath, u8 Rate)
 	s8 value = 0;
 	u8 rateIndex = PHY_GetRateIndexOfTxPowerByRate(Rate);
 
-	if ((padapter->registrypriv.RegEnableTxPowerByRate == 2 && pHalData->EEPROMRegulatory == 2) ||
-		   padapter->registrypriv.RegEnableTxPowerByRate == 0)
+	if ((padapter->registrypriv.reg_enable_tx_power_by_rate == 2 &&
+	     pHalData->EEPROMRegulatory == 2) ||
+	    padapter->registrypriv.reg_enable_tx_power_by_rate == 0)
 		return 0;
 
 	if (RFPath >= RF_PATH_MAX)
@@ -690,12 +691,12 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel,
 	struct hal_com_data *hal_data = GET_HAL_DATA(adapter);
 	s8 limits[10] = {0}; u8 i = 0;
 
-	if (((adapter->registrypriv.RegEnableTxPowerLimit == 2) &&
+	if (((adapter->registrypriv.reg_enable_tx_power_limit == 2) &&
 	     (hal_data->EEPROMRegulatory != 1)) ||
-	    (adapter->registrypriv.RegEnableTxPowerLimit == 0))
+	    (adapter->registrypriv.reg_enable_tx_power_limit == 0))
 		return MAX_POWER_INDEX;
 
-	switch (adapter->registrypriv.RegPwrTblSel) {
+	switch (adapter->registrypriv.reg_pwr_tbl_sel) {
 	case 1:
 		idx_regulation = TXPWR_LMT_ETSI;
 		break;
@@ -750,7 +751,8 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel,
 
 void PHY_ConvertTxPowerLimitToPowerIndex(struct adapter *Adapter)
 {
-	struct hal_com_data	*pHalData = GET_HAL_DATA(Adapter);
+	struct hal_com_data *pHalData = GET_HAL_DATA(Adapter);
+	struct registry_priv *r = &Adapter->registrypriv;
 	u8 BW40PwrBasedBm2_4G = 0x2E;
 	u8 regulation, bw, channel, rateSection;
 	s8 tempValue = 0, tempPwrLmt = 0;
@@ -771,7 +773,7 @@ void PHY_ConvertTxPowerLimitToPowerIndex(struct adapter *Adapter)
 							else if (rateSection == 0) /*  CCK */
 								BW40PwrBasedBm2_4G = PHY_GetTxPowerByRateBase(Adapter, rfPath, CCK);
 						} else
-							BW40PwrBasedBm2_4G = Adapter->registrypriv.RegPowerBase * 2;
+							BW40PwrBasedBm2_4G = r->reg_power_base * 2;
 
 						if (tempPwrLmt != MAX_POWER_INDEX) {
 							tempValue = tempPwrLmt - BW40PwrBasedBm2_4G;
drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c +14 -18
index d8709d40c..897c3f98e 100644
@@ -338,13 +338,11 @@ static int phy_BB8723b_Config_ParaFile(struct adapter *Adapter)
 
 	/*  Read Tx Power Limit File */
 	PHY_InitTxPowerLimit(Adapter);
-	if (
-		Adapter->registrypriv.RegEnableTxPowerLimit == 1 ||
-		(Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1)
-	) {
-		ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,
-					   CONFIG_RF_TXPWR_LMT, 0);
-	}
+
+	if (Adapter->registrypriv.reg_enable_tx_power_limit == 1 ||
+	    (Adapter->registrypriv.reg_enable_tx_power_limit == 2 &&
+	   pHalData->EEPROMRegulatory == 1))
+		ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, CONFIG_RF_TXPWR_LMT, 0);
 
 	/*  */
 	/*  1. Read PHY_REG.TXT BB INIT!! */
@@ -353,20 +351,18 @@ static int phy_BB8723b_Config_ParaFile(struct adapter *Adapter)
 
 	/*  If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt */
 	PHY_InitTxPowerByRate(Adapter);
-	if (
-		Adapter->registrypriv.RegEnableTxPowerByRate == 1 ||
-		(Adapter->registrypriv.RegEnableTxPowerByRate == 2 && pHalData->EEPROMRegulatory != 2)
-	) {
-		ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv,
-					   CONFIG_BB_PHY_REG_PG);
+
+	if (Adapter->registrypriv.reg_enable_tx_power_by_rate == 1 ||
+	    (Adapter->registrypriv.reg_enable_tx_power_by_rate == 2 &&
+	   pHalData->EEPROMRegulatory != 2)) {
+		ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_PG);
 
 		if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_EXACT_VALUE)
 			PHY_TxPowerByRateConfiguration(Adapter);
 
-		if (
-			Adapter->registrypriv.RegEnableTxPowerLimit == 1 ||
-			(Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1)
-		)
+		if (Adapter->registrypriv.reg_enable_tx_power_limit == 1 ||
+		    (Adapter->registrypriv.reg_enable_tx_power_limit == 2 &&
+		   pHalData->EEPROMRegulatory == 1))
 			PHY_ConvertTxPowerLimitToPowerIndex(Adapter);
 	}
 
@@ -541,7 +537,7 @@ u8 PHY_GetTxPowerIndex(
 
 	limit = phy_get_tx_pwr_lmt(
 		padapter,
-		padapter->registrypriv.RegPwrTblSel,
+		padapter->registrypriv.reg_pwr_tbl_sel,
 		pHalData->CurrentChannelBW,
 		RFPath,
 		Rate,
drivers/staging/rtl8723bs/include/drv_types.h +9 -9
index f86180dc3..a63eb722c 100644
@@ -156,15 +156,15 @@ struct registry_priv {
 	u8 notch_filter;
 
 	/* define for tx power adjust */
-	u8 RegEnableTxPowerLimit;
-	u8 RegEnableTxPowerByRate;
-	u8 RegPowerBase;
-	u8 RegPwrTblSel;
-	s8	TxBBSwing_2G;
-	u8 AmplifierType_2G;
-	u8 bEn_RFE;
-	u8 RFE_Type;
-	u8  check_fw_ps;
+	u8 reg_enable_tx_power_limit;
+	u8 reg_enable_tx_power_by_rate;
+	u8 reg_power_base;
+	u8 reg_pwr_tbl_sel;
+	s8 tx_bb_swing_2g;
+	u8 amplifier_type_2g;
+	u8 b_en_rfe;
+	u8 rfe_type;
+	u8 check_fw_ps;
 
 	u8 qos_opt_enable;
 
drivers/staging/rtl8723bs/include/hal_com_phycfg.h +1 -1
index cb7c7ed74..deb5ec16f 100644
@@ -90,7 +90,7 @@ void PHY_TxPowerByRateConfiguration(struct adapter *padapter);
 u8 PHY_GetTxPowerIndexBase(struct adapter *padapter, u8 RFPath, u8 Rate,
 			   enum channel_width BandWidth, u8 Channel);
 
-s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 RegPwrTblSel,
+s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel,
 		      enum channel_width Bandwidth, u8 RfPath, u8 DataRate,
 		      u8 Channel);
 
drivers/staging/rtl8723bs/os_dep/os_intfs.c +6 -6
index bc02db137..b67b4997f 100644
@@ -259,13 +259,13 @@ static void loadparam(struct adapter *padapter, struct net_device *pnetdev)
 
 	registry_par->notch_filter = (u8)rtw_notch_filter;
 
-	registry_par->RegEnableTxPowerLimit = (u8)rtw_tx_pwr_lmt_enable;
-	registry_par->RegEnableTxPowerByRate = (u8)rtw_tx_pwr_by_rate;
+	registry_par->reg_enable_tx_power_limit = (u8)rtw_tx_pwr_lmt_enable;
+	registry_par->reg_enable_tx_power_by_rate = (u8)rtw_tx_pwr_by_rate;
 
-	registry_par->RegPowerBase = 14;
-	registry_par->TxBBSwing_2G = 0xFF;
-	registry_par->bEn_RFE = 1;
-	registry_par->RFE_Type = 64;
+	registry_par->reg_power_base = 14;
+	registry_par->tx_bb_swing_2g = 0xFF;
+	registry_par->b_en_rfe = 1;
+	registry_par->rfe_type = 64;
 
 	registry_par->qos_opt_enable = (u8)rtw_qos_opt_enable;
 
Signature · 1 line
2.52.0
#1 lore raw
Quoted 2 lines · Ethan Tidmore

Rename CamelCase members of struct registry_priv to snake_case to comply with the Linux kernel coding style.

Close, but:

drivers/staging/rtl8723bs/include/drv_types.h struct registry_priv { · line 165

Quoted 1 line
drivers/staging/rtl8723bs/include/drv_types.h +1 -0
+	u8 b_en_rfe;

What does the "b_" here mean? The original variable name had it, but that was because it was attempting to do a "hungarian notation" type of name, which is not the correct way to name Linux kernel variables, sorry.

Also:

drivers/staging/rtl8723bs/include/hal_com_phycfg.h void PHY_TxPowerByRateConfiguration(struct adapter *padapter); · line 93

Quoted 8 lines
drivers/staging/rtl8723bs/include/hal_com_phycfg.h +1 -1
@@ -90,7 +90,7 @@ void PHY_TxPowerByRateConfiguration(struct adapter *padapter);
 u8 PHY_GetTxPowerIndexBase(struct adapter *padapter, u8 RFPath, u8 Rate,
 			   enum channel_width BandWidth, u8 Channel);
 
-s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 RegPwrTblSel,
+s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel,

That was not a change needed do to the structure name changes. Please only do one logical change per patch. Maybe one per variable name change to make it more obvious and easy to review?

thanks,

greg k-h

#2 lore raw
In reply to Ethan Tidmore

drivers/staging/rtl8723bs/hal/hal_com_phycfg.c s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, · line 754

Quoted 6 lines · Ethan Tidmore
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +1 -1
@@ -750,7 +751,8 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel,
 
 void PHY_ConvertTxPowerLimitToPowerIndex(struct adapter *Adapter)
 {
-	struct hal_com_data	*pHalData = GET_HAL_DATA(Adapter);
+	struct hal_com_data *pHalData = GET_HAL_DATA(Adapter);

This is an unrelated white-space change. Don't make unrelated changes.

drivers/staging/rtl8723bs/hal/hal_com_phycfg.c s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, · line 755

Quoted 1 line
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +1 -0
+	struct registry_priv *r = &Adapter->registrypriv;

I feel like you did this to avoid going over the 100 character limit, but please do that in a separate patch. I use a script to review these changes and I want it to be a straight s/old/new/ change. Plus, "r" is a bad name.

regards,
dan carpenter

#3 lore raw
Quoted 8 lines · Dan Carpenter

This is an unrelated white-space change. Don't make unrelated changes.

Quoted 1 line

+ struct registry_priv *r = &Adapter->registrypriv;

I feel like you did this to avoid going over the 100 character limit, but please do that in a separate patch. I use a script to review these changes and I want it to be a straight s/old/new/ change. Plus, "r" is a bad name.

Hi Dan,

Thanks for the review. I actually sent a v2 patchset earlier today which should fix the whitespace issues you mentioned here.

However, I realized v2 still uses a local struct registry_priv *r shortcut in one of the patches which is inconsistent with the rest of the series. I will fix that in v3.

I'll wait a bit longer to see if there are any other comments on v2 before sending the v3 series.

Thanks,
Ethan

Quoted 21 lines · Dan Carpenter

drivers/staging/rtl8723bs/hal/hal_com_phycfg.c s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, · line 754

Quoted 6 lines · Ethan Tidmore
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +1 -1
@@ -750,7 +751,8 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel,
 
 void PHY_ConvertTxPowerLimitToPowerIndex(struct adapter *Adapter)
 {
-     struct hal_com_data     *pHalData = GET_HAL_DATA(Adapter);
+     struct hal_com_data *pHalData = GET_HAL_DATA(Adapter);

This is an unrelated white-space change. Don't make unrelated changes.

drivers/staging/rtl8723bs/hal/hal_com_phycfg.c s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, · line 755

Quoted 1 line
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +1 -0
+     struct registry_priv *r = &Adapter->registrypriv;

I feel like you did this to avoid going over the 100 character limit, but please do that in a separate patch. I use a script to review these changes and I want it to be a straight s/old/new/ change. Plus, "r" is a bad name.

regards,
dan carpenter