[PATCH v2 0/3] staging: rtl8723bs: refactor PHY_ConvertTxPowerLimitToPowerIndex()

From: Leonardo Martins Martins

Date: Fri Oct 02 2026 - 00:08:26 EST


The function PHY_ConvertTxPowerLimitToPowerIndex() has several style
problems, such as mixed-case names, deeply nested code, and redundant
bounds checking.

Patch 1 renames mixed-case variables that are on the same scope as this
function, struct fields such as TxPwrLimit_2_4G were left as is. Patch 2
removes redundant parts of the code, and patch 3 solves the nesting
issue by extracting the inner loop into an auxiliary function like it is
done in rtw_phy_tx_power_limit_config(), at
drivers/net/wireless/realtek/rtw88/phy.c

Checkpatch issues a few warnings and checks for deep nesting and long
lines, but these are solved by the last patch.

Compile tested only.

Signed-off-by: Leonardo Martins Martins <dev.lmmrtns@xxxxxxxxx>
---
Changes in v2:
- Rebase on staging-testing and drop the patch that was already applied:
"staging: rtl8723bs: rename PHY_ConvertTxPowerLimitToPowerIndex()"
- Dropped these two name changes, keeping the original names:
regulation -> reg
channel -> ch
- Link to v1: https://lore.kernel.org/r/20260926-rtl8723bs-tx-pwr-limit-v1-0-989dcbc113fd@xxxxxxxxx

---
Leonardo Martins Martins (3):
staging: rtl8723bs: rename local vars in phy_tx_power_limit_to_index()
staging: rtl8723bs: access TxPowerByRateBase2_4G directly
staging: rtl8723bs: extract inner loop in phy_tx_power_limit_to_index()

drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 87 ++++++++--------------
drivers/staging/rtl8723bs/include/hal_com_phycfg.h | 3 -
2 files changed, 30 insertions(+), 60 deletions(-)
---
base-commit: dbc2fa996f44602af72ea56efa68c043407eaaac
change-id: 20260922-rtl8723bs-tx-pwr-limit-9a19bb9f901e

Best regards,
--
Leonardo Martins Martins <dev.lmmrtns@xxxxxxxxx>