From: Nikolay Kulikov <nikolayof23@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-staging@lists.linux.dev, Nikolay Kulikov <nikolayof23@gmail.com>
Subject: [PATCH 1/2] staging: rtl8723bs: remove 'NumTotalRFPath' from 'struct hal_com_data'
Date: Sun, 21 Jun 2026 19:12:28 +0300 [thread overview]
Message-ID: <20260621161611.111461-2-nikolayof23@gmail.com> (raw)
In-Reply-To: <20260621161611.111461-1-nikolayof23@gmail.com>
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 <nikolayof23@gmail.com>
---
.../staging/rtl8723bs/hal/rtl8723b_rf6052.c | 102 ++++++++----------
drivers/staging/rtl8723bs/include/hal_data.h | 2 -
2 files changed, 46 insertions(+), 58 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 <pHalData->NumTotalRFPath; eRFPath++) */
- for (eRFPath = 0; eRFPath < pHalData->NumTotalRFPath; 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;
- }
-
- /*----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 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); */
-
- /*----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;
- }
+
+ 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;
+ }
+
+ /*----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 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); */
+
+ /*----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;
}
/* 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 3a93ac312ded..5796e477dcb5 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;
@@ -392,7 +391,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__ */
--
2.54.0
next prev parent reply other threads:[~2026-06-21 16:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-21 16:12 [PATCH 0/2] staging: rtl8723bs: simplify the phy_RF6052_Config_ParaFile() function Nikolay Kulikov
2026-06-21 16:12 ` Nikolay Kulikov [this message]
2026-06-21 16:12 ` [PATCH 2/2] staging: rtl8723bs: remove local variable 'eRFPath' Nikolay Kulikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260621161611.111461-2-nikolayof23@gmail.com \
--to=nikolayof23@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox