From 7958aaa91b27a5b3c4ed6f626ade5d62dd51340c Mon Sep 17 00:00:00 2001 From: Nikolay Kulikov Date: Sun, 21 Jun 2026 19:12:28 +0300 Subject: [PATCH] staging: rtl8723bs: remove 'NumTotalRFPath' from 'struct hal_com_data' This variable is assigned the value 1, after which it is used as a loop delimiter. Since it always stores 1, only one loop iteration is performed. We can remove the 'NumTotalRFPath' field and remove the loop by calling its body directly to simplify the code. Signed-off-by: Nikolay Kulikov Link: https://patch.msgid.link/20260621161611.111461-2-nikolayof23@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8723bs/hal/rtl8723b_rf6052.c | 86 ++++++++----------- drivers/staging/rtl8723bs/include/hal_data.h | 2 - 2 files changed, 38 insertions(+), 50 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c b/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c index da4cb28276b2..86759516838b 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c @@ -81,61 +81,58 @@ void PHY_RF6052SetBandwidth8723B( static int phy_RF6052_Config_ParaFile(struct adapter *Adapter) { u32 u4RegValue = 0; - u8 eRFPath; + u8 eRFPath = 0; struct bb_register_def *pPhyReg; struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); /* 3----------------------------------------------------------------- */ /* 3 <2> Initialize RF */ /* 3----------------------------------------------------------------- */ - /* for (eRFPath = RF_PATH_A; eRFPath NumTotalRFPath; eRFPath++) */ - for (eRFPath = 0; eRFPath < pHalData->NumTotalRFPath; eRFPath++) { - pPhyReg = &pHalData->PHYRegDef[eRFPath]; + pPhyReg = &pHalData->PHYRegDef[eRFPath]; - /*----Store original RFENV control type----*/ - switch (eRFPath) { - case RF_PATH_A: - u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV); - break; - case RF_PATH_B: - u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV << 16); - break; - } + /*----Store original RFENV control type----*/ + switch (eRFPath) { + case RF_PATH_A: + u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV); + break; + case RF_PATH_B: + u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV << 16); + break; + } - /*----Set RF_ENV enable----*/ - PHY_SetBBReg(Adapter, pPhyReg->rfintfe, bRFSI_RFENV << 16, 0x1); - udelay(1);/* PlatformStallExecution(1); */ + /*----Set RF_ENV enable----*/ + PHY_SetBBReg(Adapter, pPhyReg->rfintfe, bRFSI_RFENV << 16, 0x1); + udelay(1);/* PlatformStallExecution(1); */ - /*----Set RF_ENV output high----*/ - PHY_SetBBReg(Adapter, pPhyReg->rfintfo, bRFSI_RFENV, 0x1); - udelay(1);/* PlatformStallExecution(1); */ + /*----Set RF_ENV output high----*/ + PHY_SetBBReg(Adapter, pPhyReg->rfintfo, bRFSI_RFENV, 0x1); + udelay(1);/* PlatformStallExecution(1); */ - /* Set bit number of Address and Data for RF register */ - PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireAddressLength, 0x0); /* Set 1 to 4 bits for 8255 */ - udelay(1);/* PlatformStallExecution(1); */ + /* Set bit number of Address and Data for RF register */ + PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireAddressLength, 0x0); /* Set 1 to 4 bits for 8255 */ + udelay(1);/* PlatformStallExecution(1); */ - PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireDataLength, 0x0); /* Set 0 to 12 bits for 8255 */ - udelay(1);/* PlatformStallExecution(1); */ + PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireDataLength, 0x0); /* Set 0 to 12 bits for 8255 */ + udelay(1);/* PlatformStallExecution(1); */ - /*----Initialize RF fom connfiguration file----*/ - switch (eRFPath) { - case RF_PATH_A: - case RF_PATH_B: - ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, - CONFIG_RF_RADIO, eRFPath); - break; - } + /*----Initialize RF fom connfiguration file----*/ + switch (eRFPath) { + case RF_PATH_A: + case RF_PATH_B: + ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, + CONFIG_RF_RADIO, eRFPath); + break; + } - /*----Restore RFENV control type----*/ - switch (eRFPath) { - case RF_PATH_A: - PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue); - break; - case RF_PATH_B: - PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV << 16, u4RegValue); - break; - } + /*----Restore RFENV control type----*/ + switch (eRFPath) { + case RF_PATH_A: + PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue); + break; + case RF_PATH_B: + PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV << 16, u4RegValue); + break; } /* 3 ----------------------------------------------------------------- */ @@ -149,13 +146,6 @@ static int phy_RF6052_Config_ParaFile(struct adapter *Adapter) int PHY_RF6052_Config8723B(struct adapter *Adapter) { - struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - - /* */ - /* Initialize general global value */ - /* */ - pHalData->NumTotalRFPath = 1; - /* */ /* Config BB and RF */ /* */ diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h index 78dec6e5db19..a03e32e4884c 100644 --- a/drivers/staging/rtl8723bs/include/hal_data.h +++ b/drivers/staging/rtl8723bs/include/hal_data.h @@ -187,7 +187,6 @@ struct hal_com_data { /* rf_ctrl */ u8 rf_chip; u8 PackageType; - u8 NumTotalRFPath; u8 InterfaceSel; u8 framesync; @@ -391,7 +390,6 @@ struct hal_com_data { }; #define GET_HAL_DATA(__padapter) ((struct hal_com_data *)((__padapter)->HalData)) -#define GET_HAL_RFPATH_NUM(__padapter) (((struct hal_com_data *)((__padapter)->HalData))->NumTotalRFPath) #define RT_GetInterfaceSelection(_Adapter) (GET_HAL_DATA(_Adapter)->InterfaceSel) #endif /* __HAL_DATA_H__ */