All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix
@ 2026-07-15 12:47 Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 01/61] staging: rtl8723bs: remove redundant rtw_ap_set_group_key wrapper Arsenii Pashchenko
                   ` (61 more replies)
  0 siblings, 62 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Hello,

This patch series performs a massive, systematic cleanup of the legacy 
vendor HAL layer and redundant abstraction wrappers in the rtl8723bs 
driver, concluding with a functional fix for the TX power limit lookup.

The primary goal of this refactoring is to drastically improve the 
readability and maintainability of the codebase, transforming the 
highly tangled, Windows-legacy Realtek abstractions into a cleaner, 
more idiomatic Linux driver structure.

KEY CHANGES IN THIS SERIES:

1. Dead Code & Stub Removal: Eliminated several unimplemented functions, 
   empty stubs (like OnAtim, DoReserved), duplicate prototypes, and 
   completely unused helpers (NULL_hdl, set_csa_hdl, tdls_hdl).
2. Wrapper Collapse & Inlining: Removed multiple layers of superficial 
   wrappers around core operations (e.g., rtw_ap_set_group_key, 
   issue_deauth, issue_probereq, rtw_free_mlme_priv, etc.). High-frequency 
   or single-use HAL entry points (like SetHwReg8723BS, GetHwReg8723BS, 
   and xmit helpers) have been carefully inlined directly into their 
   respective dispatchers to enhance readability.
3. Scope & Warning Fixes: Restructured local functions (like 
   lps_ctrl_wk_hdl) by marking them static and aligning headers, which 
   resolves missing-prototypes compiler warnings.
4. Logical Fixes: In the final patch, a critical copy-paste bug in 
   phy_get_tx_pwr_lmt() was resolved. The computed channel index from 
   phy_GetChannelIndexOfTxPowerLimit() was mistakenly assigned back to 
   the 'channel' parameter and discarded, leaving 'idx_channel' at -1. 
   This caused the function to always fail validation and return 
   MAX_POWER_INDEX. Correcting this restores the intended hardware tx 
   power limit logic and resolves a compiler warning.
5. Refined Abstractions: In places where removing a wrapper would 
   decrease overall elegance or require awkward type workarounds, the 
   cleanest architectural approach was intentionally preserved.

TESTING & VERIFICATION:

- Hardware: I do not possess the physical rtl8723bs hardware, so 
  real-world runtime wireless testing was not performed.
- Compilation: The entire series compiles flawlessly against the 
  latest tree.
- Code Style: All 61 patches have been fully validated with 
  `scripts/checkpatch.pl` and return 0 errors / 0 warnings per patch. 
  (Note: A few pre-existing vendor style warnings remain in the modified 
  files, but no new ones were introduced).

This cleanup significantly reduces the boilerplate footprint, making 
future maintenance and eventual mac80211 migration tasks much more 
approachable.

Please review.

Thanks,
Arsenii

Arsenii Pashchenko (61):
  staging: rtl8723bs: remove redundant rtw_ap_set_group_key wrapper
  staging: rtl8723bs: replace is_same_ess with rtw_ssid_differ
  staging: rtl8723bs: remove redundant rtw_to_roam wrapper
  staging: rtl8723bs: remove redundant rtw_dec_to_roam helper
  staging: rtl8723bs: remove unused OnAtim stub function
  staging: rtl8723bs: remove DoReserved stub and clean up OnAction_tbl
  staging: rtl8723bs: remove redundant issue_deauth wrapper
  staging: rtl8723bs: remove unused NULL_hdl function
  staging: rtl8723bs: remove unused set_csa_hdl function
  staging: rtl8723bs: remove unused tdls_hdl function
  staging: rtl8723bs: inline rtw_ps_deny_get() and remove dead code
  staging: rtl8723bs: replace custom CMAC with kernel Crypto API helper
  staging: rtl8723bs: remove redundant rtw_get_oper_ch() wrapper
  staging: rtl8723bs: remove ODM_CheckPowerStatus and dead branches
  staging: rtl8723bs: remove unimplemented halbtcoutsrc_GetBtReg helper
  staging: rtl8723bs: remove rtw_free_evt_priv wrapper and rename helper
  staging: rtl8723bs: remove rtw_free_cmd_priv wrapper and rename helper
  staging: rtl8723bs: replace rtw_dm_in_lps_hdl with direct hal call
  staging: rtl8723bs: make lps_ctrl_wk_hdl() static
  staging: rtl8723bs: sanitize and align efuse read function headers
  staging: rtl8723bs: replace rtw_reset_continual_io_error with
    atomic_set
  staging: rtl8723bs: inline single-use init_mlme_default_rate_set
  staging: rtl8723bs: remove issue_probereq wrapper and rename helper
  staging: rtl8723bs: remove register_task_alive inline helper
  staging: rtl8723bs: remove unregister_task_alive inline helper
  staging: rtl8723bs: clean up Michael MIC pseudo header logic
  staging: rtl8723bs: replace rtw_set_oper_bw with direct assignment
  staging: rtl8723bs: inline single-use _clear_cam_entry helper
  staging: rtl8723bs: collapse set_sta_rate and Update_RA_Entry wrappers
  staging: rtl8723bs: replace correct_TSF with direct HAL call
  staging: rtl8723bs: replace rtw_sctx_done with direct status call
  staging: rtl8723bs: remove rtw_free_mlme_priv wrapper and rename
    helper
  staging: rtl8723bs: remove duplicate prototype of
    rtw_free_network_nolock
  staging: rtl8723bs: replace rtw_get_beacon_interval_from_ie with
    define
  staging: rtl8723bs: inline _rtw_free_network_nolock into wrapper
  staging: rtl8723bs: remove rtw_wmm_event_callback and update handler
  staging: rtl8723bs: replace halbtc8723b1ant_SwMechanism with direct
    call
  staging: rtl8723bs: remove redundant ternary operators from bool
    returns
  staging: rtl8723bs: remove redundant DM wrapper
  staging: rtl8723bs: remove EXhalbtc8723b2ant_InitHwConfig
  staging: rtl8723bs: remove EXhalbtc8723b1ant_InitHwConfig
  staging: rtl8723bs: remove ConfigureTxpowerTrack wrapper
  staging: rtl8723bs: remove hal_init_macaddr wrapper
  staging: rtl8723bs: remove rtw_init_hal_com_default_value
  staging: rtl8723bs: remove c2h_evt_clear wrapper
  staging: rtl8723bs: remove rtw_get_mgntframe_raid helper
  staging: rtl8723bs: clean up phy power conversion function
  staging: rtl8723bs: remove PHY_TxPowerByRateConfiguration wrapper
  staging: rtl8723bs: remove phy_GetChannelIndexOfTxPowerLimit helper
  staging: rtl8723bs: inline SetHwReg8723BS into rtw_hal_set_hwreg
  staging: rtl8723bs: inline GetHwReg8723BS into rtw_hal_get_hwreg
  staging: rtl8723bs: inline SetHwRegWithBuf8723B into helper
  staging: rtl8723bs: inline GetHalDefVar8723BSDIO into helper
  staging: rtl8723bs: inline SetHalODMVar into rtw_hal_set_odm_var
  staging: rtl8723bs: inline CheckIPSStatus logic with defines
  staging: rtl8723bs: inline rtl8723bs_hal_xmitframe_enqueue helper
  staging: rtl8723bs: inline rtl8723bs_hal_xmit into rtw_hal_xmit
  staging: rtl8723bs: extend rtw_hal_mgnt_xmit functionality
  staging: rtl8723bs: inline rtl8723bs_init_xmit_priv helper
  staging: rtl8723bs: inline recv private data freeing helper
  staging: rtl8723bs: fix tx power limit lookup by using correct channel
    index

 drivers/staging/rtl8723bs/core/rtw_ap.c       |  19 +-
 drivers/staging/rtl8723bs/core/rtw_cmd.c      |  43 +--
 drivers/staging/rtl8723bs/core/rtw_efuse.c    |  30 +-
 drivers/staging/rtl8723bs/core/rtw_io.c       |   6 -
 .../staging/rtl8723bs/core/rtw_ioctl_set.c    |   4 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c     |  99 ++----
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 144 +++-----
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c  |  34 +-
 drivers/staging/rtl8723bs/core/rtw_recv.c     |  47 ++-
 drivers/staging/rtl8723bs/core/rtw_security.c | 142 +-------
 .../staging/rtl8723bs/core/rtw_wlan_util.c    |  56 +--
 drivers/staging/rtl8723bs/core/rtw_xmit.c     |   7 +-
 .../staging/rtl8723bs/hal/HalBtc8723b1Ant.c   |  25 +-
 .../staging/rtl8723bs/hal/HalBtc8723b1Ant.h   |   5 +-
 .../staging/rtl8723bs/hal/HalBtc8723b2Ant.c   |  18 +-
 .../staging/rtl8723bs/hal/HalBtc8723b2Ant.h   |   5 +-
 drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h  |  11 +-
 drivers/staging/rtl8723bs/hal/HalPhyRf.c      |   7 +-
 drivers/staging/rtl8723bs/hal/HalPhyRf.h      |   1 -
 .../staging/rtl8723bs/hal/HalPhyRf_8723B.c    |   8 -
 drivers/staging/rtl8723bs/hal/hal_btcoex.c    |  13 +-
 drivers/staging/rtl8723bs/hal/hal_com.c       |  66 +---
 .../staging/rtl8723bs/hal/hal_com_phycfg.c    |  40 +--
 drivers/staging/rtl8723bs/hal/hal_intf.c      | 334 +++++++++++++++++-
 drivers/staging/rtl8723bs/hal/odm_HWConfig.c  |   2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c  |  32 +-
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c |   4 +-
 .../staging/rtl8723bs/hal/rtl8723b_phycfg.c   |   7 +-
 .../staging/rtl8723bs/hal/rtl8723bs_recv.c    | 123 +------
 .../staging/rtl8723bs/hal/rtl8723bs_xmit.c    | 115 ------
 drivers/staging/rtl8723bs/hal/sdio_halinit.c  | 110 +-----
 drivers/staging/rtl8723bs/hal/sdio_ops.c      |  16 -
 drivers/staging/rtl8723bs/include/cmd_osdep.h |   2 -
 drivers/staging/rtl8723bs/include/hal_com.h   |  10 +-
 .../rtl8723bs/include/hal_com_phycfg.h        |   1 -
 drivers/staging/rtl8723bs/include/hal_intf.h  |   4 -
 drivers/staging/rtl8723bs/include/ieee80211.h |   6 +-
 .../staging/rtl8723bs/include/rtl8723b_cmd.h  |   1 -
 .../staging/rtl8723bs/include/rtl8723b_hal.h  |   6 +
 .../staging/rtl8723bs/include/rtl8723b_recv.h |   3 +-
 .../staging/rtl8723bs/include/rtl8723b_xmit.h |   5 +-
 drivers/staging/rtl8723bs/include/rtw_ap.h    |   2 +-
 drivers/staging/rtl8723bs/include/rtw_io.h    |   2 +-
 drivers/staging/rtl8723bs/include/rtw_mlme.h  |  11 +-
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  23 +-
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |   3 +-
 .../staging/rtl8723bs/include/rtw_security.h  |  10 +-
 drivers/staging/rtl8723bs/include/rtw_xmit.h  |   2 +-
 drivers/staging/rtl8723bs/include/sdio_ops.h  |   4 +-
 .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c |  16 +-
 drivers/staging/rtl8723bs/os_dep/os_intfs.c   |   7 +-
 .../staging/rtl8723bs/os_dep/osdep_service.c  |   4 +-
 drivers/staging/rtl8723bs/os_dep/sdio_intf.c  |   2 +-
 .../staging/rtl8723bs/os_dep/sdio_ops_linux.c |   4 +-
 54 files changed, 626 insertions(+), 1075 deletions(-)

-- 
2.55.0


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

* [PATCH 01/61] staging: rtl8723bs: remove redundant rtw_ap_set_group_key wrapper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 13:15   ` Greg Kroah-Hartman
  2026-07-15 12:47 ` [PATCH 02/61] staging: rtl8723bs: replace is_same_ess with rtw_ssid_differ Arsenii Pashchenko
                   ` (60 subsequent siblings)
  61 siblings, 1 reply; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Eliminate the redundant rtw_ap_set_group_key() wrapper function by
calling rtw_ap_set_key() directly with the set_tx parameter set to 1.
This reduces boilerplate code and cleans up the driver interface.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_ap.c           | 7 +------
 drivers/staging/rtl8723bs/include/rtw_ap.h        | 2 +-
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 8 ++++++--
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 065850a9e..a6640cd7a 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -1195,7 +1195,7 @@ u8 rtw_ap_set_pairwise_key(struct adapter *padapter, struct sta_info *psta)
 	return res;
 }
 
-static int rtw_ap_set_key(struct adapter *padapter,
+int rtw_ap_set_key(struct adapter *padapter,
 			  u8 *key,
 			  u8 alg,
 			  int keyid,
@@ -1258,11 +1258,6 @@ static int rtw_ap_set_key(struct adapter *padapter,
 	return res;
 }
 
-int rtw_ap_set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid)
-{
-	return rtw_ap_set_key(padapter, key, alg, keyid, 1);
-}
-
 int rtw_ap_set_wep_key(struct adapter *padapter,
 		       u8 *key,
 		       u8 keylen,
diff --git a/drivers/staging/rtl8723bs/include/rtw_ap.h b/drivers/staging/rtl8723bs/include/rtw_ap.h
index 83e835eb6..cdd9f291f 100644
--- a/drivers/staging/rtl8723bs/include/rtw_ap.h
+++ b/drivers/staging/rtl8723bs/include/rtw_ap.h
@@ -22,7 +22,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr);
 void rtw_acl_remove_sta(struct adapter *padapter, u8 *addr);
 
 u8 rtw_ap_set_pairwise_key(struct adapter *padapter, struct sta_info *psta);
-int rtw_ap_set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid);
+int rtw_ap_set_key(struct adapter *padapter, u8 *key, u8 alg, int keyid, u8 set_tx);
 int rtw_ap_set_wep_key(struct adapter *padapter, u8 *key, u8 keylen, int keyid, u8 set_tx);
 
 void associated_clients_update(struct adapter *padapter, u8 updated);
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 1484336d7..ce76a8586 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -604,7 +604,9 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
 
 			psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;/*  */
 
-			rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx);
+			rtw_ap_set_key(padapter, param->u.crypt.key,
+						   psecuritypriv->dot118021XGrpPrivacy,
+						   param->u.crypt.idx, 1);
 
 			pbcmc_sta = rtw_get_bcmc_stainfo(padapter);
 			if (pbcmc_sta) {
@@ -678,7 +680,9 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
 
 				psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;/*  */
 
-				rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx);
+				rtw_ap_set_key(padapter, param->u.crypt.key,
+							   psecuritypriv->dot118021XGrpPrivacy,
+							   param->u.crypt.idx, 1);
 
 				pbcmc_sta = rtw_get_bcmc_stainfo(padapter);
 				if (pbcmc_sta) {
-- 
2.55.0


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

* [PATCH 02/61] staging: rtl8723bs: replace is_same_ess with rtw_ssid_differ
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 01/61] staging: rtl8723bs: remove redundant rtw_ap_set_group_key wrapper Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 03/61] staging: rtl8723bs: remove redundant rtw_to_roam wrapper Arsenii Pashchenko
                   ` (59 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

The helper function is_same_ess() is only used in an inverted context
to check if SSIDs are different. Flip the logic by introducing a new
static inline helper rtw_ssid_differ() that returns true when SSIDs
do not match.

This eliminates the need for the logical negation operator '!' at call
sites, improves code readability, and optimizes the check to
short-circuit early if the SSID lengths are not equal. While at it,
switch the return type to bool, use the proper 'rtw_' prefix.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 1196ec011..b1a268728 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -340,10 +340,12 @@ bool rtw_is_same_ibss(struct adapter *adapter, struct wlan_network *pnetwork)
 	return true;
 }
 
-inline int is_same_ess(struct wlan_bssid_ex *a, struct wlan_bssid_ex *b)
+static inline bool rtw_ssid_differ(struct wlan_bssid_ex *a, struct wlan_bssid_ex *b)
 {
-	return (a->ssid.ssid_length == b->ssid.ssid_length)
-		&&  !memcmp(a->ssid.ssid, b->ssid.ssid, a->ssid.ssid_length);
+	if (a->ssid.ssid_length != b->ssid.ssid_length)
+		return true;
+
+	return memcmp(a->ssid.ssid, b->ssid.ssid, a->ssid.ssid_length) != 0;
 }
 
 int is_same_network(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst, u8 feature)
@@ -1673,7 +1675,7 @@ static int rtw_check_roaming_candidate(struct mlme_priv *mlme
 	int updated = false;
 	struct adapter *adapter = container_of(mlme, struct adapter, mlmepriv);
 
-	if (!is_same_ess(&competitor->network, &mlme->cur_network.network))
+	if (rtw_ssid_differ(&competitor->network, &mlme->cur_network.network))
 		goto exit;
 
 	if (!rtw_is_desired_network(adapter, competitor))
@@ -1774,7 +1776,7 @@ static int rtw_check_join_candidate(struct mlme_priv *mlme
 	if (rtw_to_roam(adapter) > 0) {
 		if (jiffies_to_msecs(jiffies - competitor->last_scanned) >=
 		    mlme->roam_scanr_exp_ms ||
-		    !is_same_ess(&competitor->network, &mlme->cur_network.network))
+		    rtw_ssid_differ(&competitor->network, &mlme->cur_network.network))
 			goto exit;
 	}
 
-- 
2.55.0


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

* [PATCH 03/61] staging: rtl8723bs: remove redundant rtw_to_roam wrapper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 01/61] staging: rtl8723bs: remove redundant rtw_ap_set_group_key wrapper Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 02/61] staging: rtl8723bs: replace is_same_ess with rtw_ssid_differ Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 04/61] staging: rtl8723bs: remove redundant rtw_dec_to_roam helper Arsenii Pashchenko
                   ` (58 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Eliminate the redundant rtw_to_roam() helper function by accessing the
mlmepriv.to_roam field directly at all call sites. This removes unnecessary
boilerplate code and simplifies driver interface readability.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 .../staging/rtl8723bs/core/rtw_ioctl_set.c    |  4 ++--
 drivers/staging/rtl8723bs/core/rtw_mlme.c     | 24 ++++++++-----------
 drivers/staging/rtl8723bs/include/rtw_mlme.h  |  1 -
 .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c |  2 +-
 4 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
index 12bf7780b..9872467b8 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
@@ -59,7 +59,7 @@ u8 rtw_do_join(struct adapter *padapter)
 		/* when set_ssid/set_bssid for rtw_do_join(), but scanning queue is empty */
 		/* we try to issue sitesurvey firstly */
 
-		if (!pmlmepriv->link_detect_info.busy_traffic || rtw_to_roam(padapter) > 0) {
+		if (!pmlmepriv->link_detect_info.busy_traffic || padapter->mlmepriv.to_roam > 0) {
 			/*  submit site_survey_cmd */
 			ret = rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1, NULL, 0);
 			if (ret != _SUCCESS)
@@ -110,7 +110,7 @@ u8 rtw_do_join(struct adapter *padapter)
 				/* when set_ssid/set_bssid for rtw_do_join(), but there are no desired bss in scanning queue */
 				/* we try to issue sitesurvey firstly */
 				if (!pmlmepriv->link_detect_info.busy_traffic ||
-				    rtw_to_roam(padapter) > 0) {
+				    padapter->mlmepriv.to_roam > 0) {
 					ret = rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1, NULL, 0);
 					if (ret != _SUCCESS)
 						pmlmepriv->to_join = false;
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index b1a268728..6c042de11 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -744,7 +744,7 @@ void rtw_surveydone_event_callback(struct adapter	*adapter, u8 *pbuf)
 				_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
 				rtw_indicate_connect(adapter);
 			} else {
-				if (rtw_to_roam(adapter) != 0) {
+				if (adapter->mlmepriv.to_roam != 0) {
 					if (rtw_dec_to_roam(adapter) == 0 ||
 					    rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid,
 							       1, NULL, 0) != _SUCCESS) {
@@ -893,10 +893,10 @@ void rtw_indicate_disconnect(struct adapter *padapter)
 
 	_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING | WIFI_UNDER_WPS);
 
-	if (rtw_to_roam(padapter) > 0)
+	if (padapter->mlmepriv.to_roam > 0)
 		_clr_fwstate_(pmlmepriv, _FW_LINKED);
 
-	if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) || rtw_to_roam(padapter) <= 0) {
+	if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) || padapter->mlmepriv.to_roam <= 0) {
 		/*  Do it first for tx broadcast pkt after disconnection issue! */
 		netif_carrier_off(padapter->pnetdev);
 
@@ -1420,9 +1420,9 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf)
 		}
 
 		if (roam) {
-			if (rtw_to_roam(adapter) > 0)
+			if (adapter->mlmepriv.to_roam > 0)
 				rtw_dec_to_roam(adapter); /* this stadel_event is caused by roaming, decrease to_roam */
-			else if (rtw_to_roam(adapter) == 0)
+			else if (adapter->mlmepriv.to_roam == 0)
 				rtw_set_to_roam(adapter, adapter->registrypriv.max_roaming_times);
 		} else {
 			rtw_set_to_roam(adapter, 0);
@@ -1516,10 +1516,10 @@ void _rtw_join_timeout_handler(struct timer_list *t)
 
 	spin_lock_bh(&pmlmepriv->lock);
 
-	if (rtw_to_roam(adapter) > 0) { /* join timeout caused by roaming */
+	if (adapter->mlmepriv.to_roam > 0) { /* join timeout caused by roaming */
 		while (1) {
 			rtw_dec_to_roam(adapter);
-			if (rtw_to_roam(adapter) != 0) { /* try another */
+			if (adapter->mlmepriv.to_roam != 0) { /* try another */
 				int do_join_r;
 
 				do_join_r = rtw_do_join(adapter);
@@ -1773,7 +1773,7 @@ static int rtw_check_join_candidate(struct mlme_priv *mlme
 	if (!rtw_is_desired_network(adapter, competitor))
 		goto exit;
 
-	if (rtw_to_roam(adapter) > 0) {
+	if (adapter->mlmepriv.to_roam > 0) {
 		if (jiffies_to_msecs(jiffies - competitor->last_scanned) >=
 		    mlme->roam_scanr_exp_ms ||
 		    rtw_ssid_differ(&competitor->network, &mlme->cur_network.network))
@@ -2540,10 +2540,6 @@ inline u8 rtw_dec_to_roam(struct adapter *adapter)
 	return adapter->mlmepriv.to_roam;
 }
 
-inline u8 rtw_to_roam(struct adapter *adapter)
-{
-	return adapter->mlmepriv.to_roam;
-}
 
 void rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network)
 {
@@ -2559,14 +2555,14 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network)
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct wlan_network *cur_network = &pmlmepriv->cur_network;
 
-	if (rtw_to_roam(padapter) > 0) {
+	if (padapter->mlmepriv.to_roam > 0) {
 		memcpy(&pmlmepriv->assoc_ssid, &cur_network->network.ssid, sizeof(struct ndis_802_11_ssid));
 
 		pmlmepriv->assoc_by_bssid = false;
 
 		while (rtw_do_join(padapter) != _SUCCESS) {
 			rtw_dec_to_roam(padapter);
-			if (rtw_to_roam(padapter) <= 0) {
+			if (padapter->mlmepriv.to_roam <= 0) {
 				rtw_indicate_disconnect(padapter);
 				break;
 			}
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h
index 8cc96164e..b5276c429 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h
@@ -389,7 +389,6 @@ void _rtw_roaming(struct adapter *adapter, struct wlan_network *tgt_network);
 void rtw_roaming(struct adapter *adapter, struct wlan_network *tgt_network);
 void rtw_set_to_roam(struct adapter *adapter, u8 to_roam);
 u8 rtw_dec_to_roam(struct adapter *adapter);
-u8 rtw_to_roam(struct adapter *adapter);
 int rtw_select_roaming_candidate(struct mlme_priv *pmlmepriv);
 
 void rtw_sta_media_status_rpt(struct adapter *adapter, struct sta_info *psta, u32 mstatus);
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index ce76a8586..397440af8 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -436,7 +436,7 @@ void rtw_cfg80211_indicate_connect(struct adapter *padapter)
 			   FUNC_ADPT_FMT " BSS not found !!\n",
 			   FUNC_ADPT_ARG(padapter));
 
-	if (rtw_to_roam(padapter) > 0) {
+	if (padapter->mlmepriv.to_roam > 0) {
 		struct wiphy *wiphy = pwdev->wiphy;
 		struct ieee80211_channel *notify_channel;
 		u32 freq;
-- 
2.55.0


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

* [PATCH 04/61] staging: rtl8723bs: remove redundant rtw_dec_to_roam helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (2 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 03/61] staging: rtl8723bs: remove redundant rtw_to_roam wrapper Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 05/61] staging: rtl8723bs: remove unused OnAtim stub function Arsenii Pashchenko
                   ` (57 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Eliminate the redundant rtw_dec_to_roam() inline helper function by
replacing it with the open-coded prefix decrement operator '--' at all
call sites.

Since the original helper merely decrements the mlmepriv.to_roam field
and returns its updated value, using '--adapter->mlmepriv.to_roam' acts
as a direct, native language equivalent. This reduces boilerplate and
improves code scannability.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c    | 15 +++++----------
 drivers/staging/rtl8723bs/include/rtw_mlme.h |  1 -
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 6c042de11..b038233af 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -745,7 +745,7 @@ void rtw_surveydone_event_callback(struct adapter	*adapter, u8 *pbuf)
 				rtw_indicate_connect(adapter);
 			} else {
 				if (adapter->mlmepriv.to_roam != 0) {
-					if (rtw_dec_to_roam(adapter) == 0 ||
+					if (--adapter->mlmepriv.to_roam == 0 ||
 					    rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid,
 							       1, NULL, 0) != _SUCCESS) {
 						rtw_set_to_roam(adapter, 0);
@@ -1421,7 +1421,8 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf)
 
 		if (roam) {
 			if (adapter->mlmepriv.to_roam > 0)
-				rtw_dec_to_roam(adapter); /* this stadel_event is caused by roaming, decrease to_roam */
+				/* this stadel_event is caused by roaming, decrease to_roam */
+				--adapter->mlmepriv.to_roam;
 			else if (adapter->mlmepriv.to_roam == 0)
 				rtw_set_to_roam(adapter, adapter->registrypriv.max_roaming_times);
 		} else {
@@ -1518,7 +1519,7 @@ void _rtw_join_timeout_handler(struct timer_list *t)
 
 	if (adapter->mlmepriv.to_roam > 0) { /* join timeout caused by roaming */
 		while (1) {
-			rtw_dec_to_roam(adapter);
+			--adapter->mlmepriv.to_roam;
 			if (adapter->mlmepriv.to_roam != 0) { /* try another */
 				int do_join_r;
 
@@ -2534,12 +2535,6 @@ inline void rtw_set_to_roam(struct adapter *adapter, u8 to_roam)
 	adapter->mlmepriv.to_roam = to_roam;
 }
 
-inline u8 rtw_dec_to_roam(struct adapter *adapter)
-{
-	adapter->mlmepriv.to_roam--;
-	return adapter->mlmepriv.to_roam;
-}
-
 
 void rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network)
 {
@@ -2561,7 +2556,7 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network)
 		pmlmepriv->assoc_by_bssid = false;
 
 		while (rtw_do_join(padapter) != _SUCCESS) {
-			rtw_dec_to_roam(padapter);
+			--padapter->mlmepriv.to_roam;
 			if (padapter->mlmepriv.to_roam <= 0) {
 				rtw_indicate_disconnect(padapter);
 				break;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h
index b5276c429..233bf98e2 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h
@@ -388,7 +388,6 @@ int is_same_network(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst, u8 fea
 void _rtw_roaming(struct adapter *adapter, struct wlan_network *tgt_network);
 void rtw_roaming(struct adapter *adapter, struct wlan_network *tgt_network);
 void rtw_set_to_roam(struct adapter *adapter, u8 to_roam);
-u8 rtw_dec_to_roam(struct adapter *adapter);
 int rtw_select_roaming_candidate(struct mlme_priv *pmlmepriv);
 
 void rtw_sta_media_status_rpt(struct adapter *adapter, struct sta_info *psta, u32 mstatus);
-- 
2.55.0


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

* [PATCH 05/61] staging: rtl8723bs: remove unused OnAtim stub function
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (3 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 04/61] staging: rtl8723bs: remove redundant rtw_dec_to_roam helper Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 06/61] staging: rtl8723bs: remove DoReserved stub and clean up OnAction_tbl Arsenii Pashchenko
                   ` (56 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

The OnAtim() function is an empty stub that merely returns _SUCCESS
without performing any actual work. Since ATIM frame processing is
not required for this driver, remove the redundant function definition,
its prototype, and replace its reference in mlme_sta_tbl[] with NULL.

The internal _mgt_dispatcher() already safely checks if ptable->func is
not NULL before dereferencing, making this change completely safe.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c    | 7 +------
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index a86d6f97c..774fa9e32 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -23,7 +23,7 @@ static struct mlme_handler mlme_sta_tbl[] = {
 	{0,					"DoReserved",		&DoReserved},
 	{0,					"DoReserved",		&DoReserved},
 	{WIFI_BEACON,		"OnBeacon",		&OnBeacon},
-	{WIFI_ATIM,			"OnATIM",		&OnAtim},
+	{WIFI_ATIM,			"OnATIM",		NULL},
 	{WIFI_DISASSOC,		"OnDisassoc",		&OnDisassoc},
 	{WIFI_AUTH,			"OnAuth",		&OnAuthClient},
 	{WIFI_DEAUTH,		"OnDeAuth",		&OnDeAuth},
@@ -1531,11 +1531,6 @@ unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame)
 	return _SUCCESS;
 }
 
-unsigned int OnAtim(struct adapter *padapter, union recv_frame *precv_frame)
-{
-	return _SUCCESS;
-}
-
 unsigned int on_action_spct(struct adapter *padapter, union recv_frame *precv_frame)
 {
 	struct sta_info *psta = NULL;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index cb23c6939..332411ead 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -564,7 +564,6 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame)
 unsigned int OnProbeRsp(struct adapter *padapter, union recv_frame *precv_frame);
 unsigned int DoReserved(struct adapter *padapter, union recv_frame *precv_frame);
 unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame);
-unsigned int OnAtim(struct adapter *padapter, union recv_frame *precv_frame);
 unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame);
 unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame);
 unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_frame);
-- 
2.55.0


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

* [PATCH 06/61] staging: rtl8723bs: remove DoReserved stub and clean up OnAction_tbl
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (4 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 05/61] staging: rtl8723bs: remove unused OnAtim stub function Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 07/61] staging: rtl8723bs: remove redundant issue_deauth wrapper Arsenii Pashchenko
                   ` (55 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

The DoReserved() function is an empty stub that merely returns _SUCCESS
without performing any actual work. Remove the redundant function
definition and its prototype.

Concurrently, clean up the OnAction_tbl array by physically removing the
now-unused elements that referenced DoReserved or contained NULL. Since
OnAction() iterates through this table sequentially using ARRAY_SIZE(),
removing these entries safely shrinks the array size and eliminates dead
code.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c    | 16 ++--------------
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h |  2 +-
 2 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 774fa9e32..48043dae7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -20,8 +20,8 @@ static struct mlme_handler mlme_sta_tbl[] = {
 	{WIFI_PROBERSP,		"OnProbeRsp",		&OnProbeRsp},
 
 	/* below 2 are reserved */
-	{0,					"DoReserved",		&DoReserved},
-	{0,					"DoReserved",		&DoReserved},
+	{0,					"DoReserved",		NULL},
+	{0,					"DoReserved",		NULL},
 	{WIFI_BEACON,		"OnBeacon",		&OnBeacon},
 	{WIFI_ATIM,			"OnATIM",		NULL},
 	{WIFI_DISASSOC,		"OnDisassoc",		&OnDisassoc},
@@ -33,18 +33,10 @@ static struct mlme_handler mlme_sta_tbl[] = {
 
 static struct action_handler OnAction_tbl[] = {
 	{RTW_WLAN_CATEGORY_SPECTRUM_MGMT,	 "ACTION_SPECTRUM_MGMT", on_action_spct},
-	{RTW_WLAN_CATEGORY_QOS, "ACTION_QOS", &DoReserved},
-	{RTW_WLAN_CATEGORY_DLS, "ACTION_DLS", &DoReserved},
 	{RTW_WLAN_CATEGORY_BACK, "ACTION_BACK", &OnAction_back},
 	{RTW_WLAN_CATEGORY_PUBLIC, "ACTION_PUBLIC", on_action_public},
-	{RTW_WLAN_CATEGORY_RADIO_MEASUREMENT, "ACTION_RADIO_MEASUREMENT", &DoReserved},
-	{RTW_WLAN_CATEGORY_FT, "ACTION_FT",	&DoReserved},
 	{RTW_WLAN_CATEGORY_HT,	"ACTION_HT",	&OnAction_ht},
 	{RTW_WLAN_CATEGORY_SA_QUERY, "ACTION_SA_QUERY", &OnAction_sa_query},
-	{RTW_WLAN_CATEGORY_UNPROTECTED_WNM, "ACTION_UNPROTECTED_WNM", &DoReserved},
-	{RTW_WLAN_CATEGORY_SELF_PROTECTED, "ACTION_SELF_PROTECTED", &DoReserved},
-	{RTW_WLAN_CATEGORY_WMM, "ACTION_WMM", &DoReserved},
-	{RTW_WLAN_CATEGORY_P2P, "ACTION_P2P", &DoReserved},
 };
 
 static u8 null_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
@@ -1836,10 +1828,6 @@ unsigned int OnAction(struct adapter *padapter, union recv_frame *precv_frame)
 	return _SUCCESS;
 }
 
-unsigned int DoReserved(struct adapter *padapter, union recv_frame *precv_frame)
-{
-	return _SUCCESS;
-}
 
 static struct xmit_frame *_alloc_mgtxmitframe(struct xmit_priv *pxmitpriv, bool once)
 {
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 332411ead..9d42b7494 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -562,7 +562,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
 unsigned int OnAssocRsp(struct adapter *padapter, union recv_frame *precv_frame);
 unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame);
 unsigned int OnProbeRsp(struct adapter *padapter, union recv_frame *precv_frame);
-unsigned int DoReserved(struct adapter *padapter, union recv_frame *precv_frame);
+
 unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame);
 unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame);
 unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame);
-- 
2.55.0


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

* [PATCH 07/61] staging: rtl8723bs: remove redundant issue_deauth wrapper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (5 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 06/61] staging: rtl8723bs: remove DoReserved stub and clean up OnAction_tbl Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 08/61] staging: rtl8723bs: remove unused NULL_hdl function Arsenii Pashchenko
                   ` (54 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant issue_deauth() wrapper function. Make the
underlying internal function global and rename it from _issue_deauth()
to issue_deauth() by removing the leading underscore.

Update all call sites across the driver to use the updated
issue_deauth() function directly, passing the explicit trailing
'false' argument where the wrapper was previously used. This
eliminates unnecessary boilerplate and simplifies code traceability.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_ap.c       |  4 ++--
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 11 +++-------
 drivers/staging/rtl8723bs/core/rtw_recv.c     | 20 +++++++++++++++----
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  2 +-
 4 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index a6640cd7a..274d99e6a 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -1775,7 +1775,7 @@ u8 ap_free_sta(struct adapter *padapter,
 		/* tear down TX AMPDU */
 		send_delba(padapter, 1, psta->hwaddr);/*  // originator */
 
-		issue_deauth(padapter, psta->hwaddr, reason);
+		issue_deauth(padapter, psta->hwaddr, reason, false);
 	}
 
 	psta->htpriv.agg_enable_bitmap = 0x0;/* reset */
@@ -1824,7 +1824,7 @@ void rtw_sta_flush(struct adapter *padapter)
 	}
 	spin_unlock_bh(&pstapriv->asoc_list_lock);
 
-	issue_deauth(padapter, bc_addr, WLAN_REASON_DEAUTH_LEAVING);
+	issue_deauth(padapter, bc_addr, WLAN_REASON_DEAUTH_LEAVING, false);
 
 	associated_clients_update(padapter, true);
 }
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 48043dae7..84283bb22 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1296,7 +1296,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
 
 asoc_class2_error:
 
-	issue_deauth(padapter, GetAddr2Ptr(pframe), status);
+	issue_deauth(padapter, GetAddr2Ptr(pframe), status, false);
 
 	return _FAIL;
 
@@ -3152,7 +3152,7 @@ int issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 tid, int
 	return ret;
 }
 
-static int _issue_deauth(struct adapter *padapter, unsigned char *da,
+int issue_deauth(struct adapter *padapter, unsigned char *da,
 			 unsigned short reason, bool wait_ack)
 {
 	struct xmit_frame			*pmgntframe;
@@ -3210,11 +3210,6 @@ static int _issue_deauth(struct adapter *padapter, unsigned char *da,
 	return ret;
 }
 
-int issue_deauth(struct adapter *padapter, unsigned char *da, unsigned short reason)
-{
-	return _issue_deauth(padapter, da, reason, false);
-}
-
 int issue_deauth_ex(struct adapter *padapter, u8 *da, unsigned short reason, int try_cnt,
 	int wait_ms)
 {
@@ -3222,7 +3217,7 @@ int issue_deauth_ex(struct adapter *padapter, u8 *da, unsigned short reason, int
 	int i = 0;
 
 	do {
-		ret = _issue_deauth(padapter, da, reason, wait_ms > 0);
+		ret = issue_deauth(padapter, da, reason, wait_ms > 0);
 
 		i++;
 
diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 86c5e2c4e..78bd04982 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -798,7 +798,10 @@ static signed int ap2sta_data_frame(struct adapter *adapter, union recv_frame *p
 		    is_zero_ether_addr(mybssid) ||
 		    (memcmp(pattrib->bssid, mybssid, ETH_ALEN))) {
 			if (!bmcast)
-				issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
+				issue_deauth(adapter,
+							 pattrib->bssid,
+							 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA,
+							 false);
 
 			ret = _FAIL;
 			goto exit;
@@ -852,7 +855,10 @@ static signed int ap2sta_data_frame(struct adapter *adapter, union recv_frame *p
 				if (jiffies_to_msecs(jiffies - send_issue_deauth_time) > 10000 || send_issue_deauth_time == 0) {
 					send_issue_deauth_time = jiffies;
 
-					issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
+					issue_deauth(adapter,
+						pattrib->bssid,
+						WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA,
+						false);
 				}
 			}
 		}
@@ -883,7 +889,10 @@ static signed int sta2ap_data_frame(struct adapter *adapter, union recv_frame *p
 
 		*psta = rtw_get_stainfo(pstapriv, pattrib->src);
 		if (!*psta) {
-			issue_deauth(adapter, pattrib->src, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
+			issue_deauth(adapter,
+						 pattrib->src,
+						 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA,
+						 false);
 
 			ret = RTW_RX_HANDLED;
 			goto exit;
@@ -907,7 +916,10 @@ static signed int sta2ap_data_frame(struct adapter *adapter, union recv_frame *p
 			ret = RTW_RX_HANDLED;
 			goto exit;
 		}
-		issue_deauth(adapter, pattrib->src, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
+		issue_deauth(adapter,
+					 pattrib->src,
+					 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA,
+					 false);
 		ret = RTW_RX_HANDLED;
 		goto exit;
 	}
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 9d42b7494..578708cb3 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -546,7 +546,7 @@ s32 issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid,
 int issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned int power_mode, int try_cnt, int wait_ms);
 s32 issue_nulldata_in_interrupt(struct adapter *padapter, u8 *da);
 int issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 tid, int try_cnt, int wait_ms);
-int issue_deauth(struct adapter *padapter, unsigned char *da, unsigned short reason);
+int issue_deauth(struct adapter *padapter, unsigned char *da, unsigned short reason, bool wait_ack);
 int issue_deauth_ex(struct adapter *padapter, u8 *da, unsigned short reason, int try_cnt, int wait_ms);
 void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned char action, unsigned short status);
 void issue_action_SA_Query(struct adapter *padapter, unsigned char *raddr, unsigned char action, unsigned short tid);
-- 
2.55.0


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

* [PATCH 08/61] staging: rtl8723bs: remove unused NULL_hdl function
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (6 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 07/61] staging: rtl8723bs: remove redundant issue_deauth wrapper Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 09/61] staging: rtl8723bs: remove unused set_csa_hdl function Arsenii Pashchenko
                   ` (53 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

The NULL_hdl() function is completely unused across the entire driver
and serves as dead code. Remove the redundant function definition and
its prototype to clean up the codebase and reduce the driver footprint

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c         | 12 ++++++------
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c    |  5 +----
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h |  2 --
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index b932670f5..0c8fb2754 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -86,12 +86,12 @@ static struct _cmd_callback rtw_cmd_callback[] = {
 };
 
 static struct cmd_hdl wlancmds[] = {
-	GEN_DRV_CMD_HANDLER(0, NULL) /*0*/
-	GEN_DRV_CMD_HANDLER(0, NULL)
-	GEN_DRV_CMD_HANDLER(0, NULL)
-	GEN_DRV_CMD_HANDLER(0, NULL)
-	GEN_DRV_CMD_HANDLER(0, NULL)
-	GEN_DRV_CMD_HANDLER(0, NULL)
+	{0, NULL}, /*0*/
+	{0, NULL},
+	{0, NULL},
+	{0, NULL},
+	{0, NULL},
+	{0, NULL},
 	GEN_MLME_EXT_HANDLER(0, NULL)
 	GEN_MLME_EXT_HANDLER(0, NULL)
 	GEN_MLME_EXT_HANDLER(0, NULL)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 84283bb22..e1503b054 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -5005,10 +5005,7 @@ void sa_query_timer_hdl(struct timer_list *t)
 	spin_unlock_bh(&pmlmepriv->lock);
 }
 
-u8 NULL_hdl(struct adapter *padapter, u8 *pbuf)
-{
-	return H2C_SUCCESS;
-}
+
 
 u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf)
 {
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 578708cb3..0f606357d 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -628,7 +628,6 @@ u8 read_rfreg_hdl(struct adapter *padapter, u8 *pbuf);
 u8 write_rfreg_hdl(struct adapter *padapter, u8 *pbuf);
 
 
-u8 NULL_hdl(struct adapter *padapter, u8 *pbuf);
 u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf);
 u8 disconnect_hdl(struct adapter *padapter, u8 *pbuf);
 u8 createbss_hdl(struct adapter *padapter, u8 *pbuf);
@@ -652,7 +651,6 @@ u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 run_in_thread_hdl(struct adapter *padapter, u8 *pbuf);
 
 
-#define GEN_DRV_CMD_HANDLER(size, cmd)	{size, &cmd ## _hdl},
 #define GEN_MLME_EXT_HANDLER(size, cmd)	{size, cmd},
 
 struct C2HEvent_Header {
-- 
2.55.0


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

* [PATCH 09/61] staging: rtl8723bs: remove unused set_csa_hdl function
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (7 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 08/61] staging: rtl8723bs: remove unused NULL_hdl function Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 10/61] staging: rtl8723bs: remove unused tdls_hdl function Arsenii Pashchenko
                   ` (52 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

The function set_csa_hdl() always returns H2C_REJECTED and is
not actively used. Replace its handler reference with NULL and
remove the dead code and its declaration.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c         | 2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c    | 4 ----
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
 3 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 0c8fb2754..9f1efbd25 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -149,7 +149,7 @@ static struct cmd_hdl wlancmds[] = {
 	GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/
 	GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param), set_chplan_hdl) /*59*/
 
-	GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param), set_csa_hdl) /*60*/
+	GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param), NULL) /*60*/
 	GEN_MLME_EXT_HANDLER(sizeof(struct TDLSoption_param), tdls_hdl) /*61*/
 	GEN_MLME_EXT_HANDLER(0, chk_bmc_sleepq_hdl) /*62*/
 	GEN_MLME_EXT_HANDLER(sizeof(struct RunInThread_param), run_in_thread_hdl) /*63*/
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index e1503b054..aca6111ff 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -5787,10 +5787,6 @@ u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf)
 	return	H2C_SUCCESS;
 }
 
-u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf)
-{
-	return	H2C_REJECTED;
-}
 
 /*  TDLS_ESTABLISHED	: write RCR DATA BIT */
 /*  TDLS_CS_OFF		: go back to the channel linked with AP, terminating channel switch procedure */
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 0f606357d..a0124eee5 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -646,7 +646,6 @@ u8 chk_bmc_sleepq_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf);
 u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf);
-u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf);	/* Kurt: Handling DFS channel switch announcement ie. */
 u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 run_in_thread_hdl(struct adapter *padapter, u8 *pbuf);
 
-- 
2.55.0


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

* [PATCH 10/61] staging: rtl8723bs: remove unused tdls_hdl function
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (8 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 09/61] staging: rtl8723bs: remove unused set_csa_hdl function Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 11/61] staging: rtl8723bs: inline rtw_ps_deny_get() and remove dead code Arsenii Pashchenko
                   ` (51 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

The function tdls_hdl() always returns H2C_REJECTED and is not
actively used. Replace its handler reference with NULL and remove
the dead code and its declaration.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c         | 2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c    | 5 +----
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 9f1efbd25..d2c6d48a8 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -150,7 +150,7 @@ static struct cmd_hdl wlancmds[] = {
 	GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param), set_chplan_hdl) /*59*/
 
 	GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param), NULL) /*60*/
-	GEN_MLME_EXT_HANDLER(sizeof(struct TDLSoption_param), tdls_hdl) /*61*/
+	GEN_MLME_EXT_HANDLER(sizeof(struct TDLSoption_param), NULL) /*61*/
 	GEN_MLME_EXT_HANDLER(0, chk_bmc_sleepq_hdl) /*62*/
 	GEN_MLME_EXT_HANDLER(sizeof(struct RunInThread_param), run_in_thread_hdl) /*63*/
 };
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index aca6111ff..7f101adcc 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -5799,10 +5799,7 @@ u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf)
 /*  TDLS_P_BASE_CH	: periodically go back to base channel */
 /*  TDLS_RS_RCR		: restore RCR */
 /*  TDLS_TEAR_STA	: free tdls sta */
-u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf)
-{
-	return H2C_REJECTED;
-}
+
 
 u8 run_in_thread_hdl(struct adapter *padapter, u8 *pbuf)
 {
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index a0124eee5..09f4d66cc 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -646,7 +646,6 @@ u8 chk_bmc_sleepq_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf);
 u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf);
-u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf);
 u8 run_in_thread_hdl(struct adapter *padapter, u8 *pbuf);
 
 
-- 
2.55.0


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

* [PATCH 11/61] staging: rtl8723bs: inline rtw_ps_deny_get() and remove dead code
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (9 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 10/61] staging: rtl8723bs: remove unused tdls_hdl function Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 12/61] staging: rtl8723bs: replace custom CMAC with kernel Crypto API helper Arsenii Pashchenko
                   ` (50 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

The function rtw_ps_deny_get() is a simple wrapper that returns the
ps_deny value. Replace its sole usage with direct access to the
structure member under the pwrctrl lock. Then, remove the now unused
function, its warning comment, and its declaration.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c    | 12 +-----------
 drivers/staging/rtl8723bs/include/rtw_pwrctrl.h |  1 -
 2 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index b9f8cf101..1d6fe3734 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -139,7 +139,7 @@ void rtw_ps_processor(struct adapter *padapter)
 	u32 ps_deny = 0;
 
 	mutex_lock(&adapter_to_pwrctl(padapter)->lock);
-	ps_deny = rtw_ps_deny_get(padapter);
+	ps_deny = adapter_to_pwrctl(padapter)->ps_deny;
 	mutex_unlock(&adapter_to_pwrctl(padapter)->lock);
 	if (ps_deny != 0)
 		goto exit;
@@ -1133,13 +1133,3 @@ void rtw_ps_deny_cancel(struct adapter *padapter, enum ps_deny_reason reason)
 	pwrpriv->ps_deny &= ~BIT(reason);
 	mutex_unlock(&pwrpriv->lock);
 }
-
-/*
- * ATTENTION:
- *Before calling this function pwrctrl lock should be occupied already,
- *otherwise it may return incorrect value.
- */
-u32 rtw_ps_deny_get(struct adapter *padapter)
-{
-	return adapter_to_pwrctl(padapter)->ps_deny;
-}
diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
index 6977892a5..9b6c42e4f 100644
--- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
@@ -249,6 +249,5 @@ int rtw_pm_set_lps(struct adapter *padapter, u8 mode);
 
 void rtw_ps_deny(struct adapter *padapter, enum ps_deny_reason reason);
 void rtw_ps_deny_cancel(struct adapter *padapter, enum ps_deny_reason reason);
-u32 rtw_ps_deny_get(struct adapter *padapter);
 
 #endif  /* __RTL871X_PWRCTRL_H_ */
-- 
2.55.0


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

* [PATCH 12/61] staging: rtl8723bs: replace custom CMAC with kernel Crypto API helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (10 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 11/61] staging: rtl8723bs: inline rtw_ps_deny_get() and remove dead code Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 13/61] staging: rtl8723bs: remove redundant rtw_get_oper_ch() wrapper Arsenii Pashchenko
                   ` (49 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Introduce rtw_bip_cmac() as a wrapper around the kernel Crypto API
"cmac(aes)" to handle 802.11w BIP MIC calculation. Convert both callers
to use this new helper function. This allows complete removal of the
custom, duplicated implementations of omac1_aes_128() and
omac1_aes_128_vector(), along with the now unused gf_mulx() helper,
significantly cleaning up the driver code.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_security.c | 114 +++---------------
 drivers/staging/rtl8723bs/core/rtw_xmit.c     |   3 +-
 .../staging/rtl8723bs/include/rtw_security.h  |   2 +-
 3 files changed, 18 insertions(+), 101 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 0cfd7734c..a4a4f0e6d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -9,6 +9,7 @@
 #include <drv_types.h>
 #include <crypto/aes.h>
 #include <crypto/utils.h>
+#include <crypto/hash.h>
 
 static const char * const _security_type_str[] = {
 	"N/A",
@@ -1315,7 +1316,8 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
 		/* conscruct AAD, copy address 1 to address 3 */
 		memcpy(BIP_AAD + 2, &pwlanhdr->addrs, sizeof(pwlanhdr->addrs));
 
-		if (omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey
+		if (rtw_bip_cmac(
+		padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey
 			, BIP_AAD, ori_len, mic))
 			goto BIP_exit;
 
@@ -1335,109 +1337,23 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
 	return res;
 }
 
-static void gf_mulx(u8 *pad)
-{
-	int i, carry;
-
-	carry = pad[0] & 0x80;
-	for (i = 0; i < AES_BLOCK_SIZE - 1; i++)
-		pad[i] = (pad[i] << 1) | (pad[i + 1] >> 7);
 
-	pad[AES_BLOCK_SIZE - 1] <<= 1;
-	if (carry)
-		pad[AES_BLOCK_SIZE - 1] ^= 0x87;
-}
-
-/**
- * omac1_aes_128_vector - One-Key CBC MAC (OMAC1) hash with AES-128
- * @key: 128-bit key for the hash operation
- * @num_elem: Number of elements in the data vector
- * @addr: Pointers to the data areas
- * @len: Lengths of the data blocks
- * @mac: Buffer for MAC (128 bits, i.e., 16 bytes)
- * Returns: 0 on success, -1 on failure
- *
- * This is a mode for using block cipher (AES in this case) for authentication.
- * OMAC1 was standardized with the name CMAC by NIST in a Special Publication
- * (SP) 800-38B.
- */
-static int omac1_aes_128_vector(u8 *key, size_t num_elem,
-				u8 *addr[], size_t *len, u8 *mac)
+int rtw_bip_cmac(u8 *key, u8 *data, size_t data_len, u8 *mac)
 {
-	struct aes_enckey aes;
-	u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE];
-	u8 *pos, *end;
-	size_t i, e, left, total_len;
-	int ret;
-
-	ret = aes_prepareenckey(&aes, key, 16);
-	if (ret)
-		return -1;
-	memset(cbc, 0, AES_BLOCK_SIZE);
-
-	total_len = 0;
-	for (e = 0; e < num_elem; e++)
-		total_len += len[e];
-	left = total_len;
-
-	e = 0;
-	pos = addr[0];
-	end = pos + len[0];
-
-	while (left >= AES_BLOCK_SIZE) {
-		for (i = 0; i < AES_BLOCK_SIZE; i++) {
-			cbc[i] ^= *pos++;
-			if (pos >= end) {
-				e++;
-				pos = addr[e];
-				end = pos + len[e];
-			}
-		}
-		if (left > AES_BLOCK_SIZE)
-			aes_encrypt(&aes, cbc, cbc);
-		left -= AES_BLOCK_SIZE;
-	}
+	struct crypto_shash *tfm;
+	int err;
 
-	memset(pad, 0, AES_BLOCK_SIZE);
-	aes_encrypt(&aes, pad, pad);
-	gf_mulx(pad);
-
-	if (left || total_len == 0) {
-		for (i = 0; i < left; i++) {
-			cbc[i] ^= *pos++;
-			if (pos >= end) {
-				e++;
-				pos = addr[e];
-				end = pos + len[e];
-			}
-		}
-		cbc[left] ^= 0x80;
-		gf_mulx(pad);
-	}
+	tfm = crypto_alloc_shash("cmac(aes)", 0, 0);
+	if (IS_ERR(tfm))
+		return PTR_ERR(tfm);
 
-	for (i = 0; i < AES_BLOCK_SIZE; i++)
-		pad[i] ^= cbc[i];
-	aes_encrypt(&aes, pad, mac);
-	memzero_explicit(&aes, sizeof(aes));
-	return 0;
-}
+	err = crypto_shash_setkey(tfm, key, 16);
+	if (err) {
+		crypto_free_shash(tfm);
+		return err;
+	}
 
-/**
- * omac1_aes_128 - One-Key CBC MAC (OMAC1) hash with AES-128 (aka AES-CMAC)
- * @key: 128-bit key for the hash operation
- * @data: Data buffer for which a MAC is determined
- * @data_len: Length of data buffer in bytes
- * @mac: Buffer for MAC (128 bits, i.e., 16 bytes)
- * Returns: 0 on success, -1 on failure
- *
- * This is a mode for using block cipher (AES in this case) for authentication.
- * OMAC1 was standardized with the name CMAC by NIST in a Special Publication
- * (SP) 800-38B.
- * modify for CONFIG_IEEE80211W
- */
-int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac)
-{
-	return omac1_aes_128_vector(key, 1, &data, &data_len, mac);
+	return crypto_shash_tfm_digest(tfm, data, data_len, mac);
 }
 
 /* Restore HW wep key setting according to key_mask */
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 444966c0d..fdda407c1 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -1283,7 +1283,8 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s
 		/* copy management fram body */
 		memcpy(BIP_AAD + BIP_AAD_SIZE, MGMT_body, frame_body_len);
 		/* calculate mic */
-		if (omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey
+		if (rtw_bip_cmac(
+		padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey
 			, BIP_AAD, BIP_AAD_SIZE + frame_body_len, mic))
 			goto xmitframe_coalesce_fail;
 
diff --git a/drivers/staging/rtl8723bs/include/rtw_security.h b/drivers/staging/rtl8723bs/include/rtw_security.h
index 32f6d3a5e..22eec2215 100644
--- a/drivers/staging/rtl8723bs/include/rtw_security.h
+++ b/drivers/staging/rtl8723bs/include/rtw_security.h
@@ -243,7 +243,7 @@ struct mic_data {
  * public domain by Tom St Denis.
  */
 
-int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac);
+int rtw_bip_cmac(u8 *key, u8 *data, size_t data_len, u8 *mac);
 void rtw_secmicsetkey(struct mic_data *pmicdata, u8 *key);
 void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b);
 void rtw_secmicappend(struct mic_data *pmicdata, u8 *src, u32 nBytes);
-- 
2.55.0


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

* [PATCH 13/61] staging: rtl8723bs: remove redundant rtw_get_oper_ch() wrapper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (11 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 12/61] staging: rtl8723bs: replace custom CMAC with kernel Crypto API helper Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 14/61] staging: rtl8723bs: remove ODM_CheckPowerStatus and dead branches Arsenii Pashchenko
                   ` (48 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the rtw_get_oper_ch() helper function since it is just a plain
one-line wrapper around adapter_to_dvobj(adapter)->oper_channel.

Replace all 6 occurrences across the driver with direct access to the
structure member through the adapter_to_dvobj() macro. This simplifies
the code, flattens the driver structure, and removes dead boilerplates.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_ap.c           | 4 ++--
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c     | 4 ++--
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c    | 5 +----
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h  | 1 -
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 6 +++---
 5 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 274d99e6a..c8f0beec0 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -267,8 +267,8 @@ void expire_timeout_chk(struct adapter *padapter)
 		struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
 
 		/* switch to correct channel of current network  before issue keep-alive frames */
-		if (rtw_get_oper_ch(padapter) != pmlmeext->cur_channel) {
-			backup_oper_channel = rtw_get_oper_ch(padapter);
+		if (adapter_to_dvobj(padapter)->oper_channel != pmlmeext->cur_channel) {
+			backup_oper_channel = adapter_to_dvobj(padapter)->oper_channel;
 			r8723bs_select_channel(padapter, pmlmeext->cur_channel);
 		}
 
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 7f101adcc..064c9923d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -3869,7 +3869,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str
 
 			bssid->configuration.ds_config = HT_info->primary_channel;
 		} else { /*  use current channel */
-			bssid->configuration.ds_config = rtw_get_oper_ch(padapter);
+			bssid->configuration.ds_config = adapter_to_dvobj(padapter)->oper_channel;
 		}
 	}
 
@@ -3910,7 +3910,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str
 	}
 
 	/*  mark bss info receiving from nearby channel as signal_quality 101 */
-	if (bssid->configuration.ds_config != rtw_get_oper_ch(padapter))
+	if (bssid->configuration.ds_config != adapter_to_dvobj(padapter)->oper_channel)
 		bssid->phy_info.signal_quality = 101;
 
 	return _SUCCESS;
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 1d37c2d5b..f610fa5b3 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -247,10 +247,7 @@ void set_msr(struct adapter *padapter, u8 type)
 	rtw_hal_set_hwreg(padapter, HW_VAR_MEDIA_STATUS, (u8 *)(&type));
 }
 
-inline u8 rtw_get_oper_ch(struct adapter *adapter)
-{
-	return adapter_to_dvobj(adapter)->oper_channel;
-}
+
 
 inline void rtw_set_oper_ch(struct adapter *adapter, u8 ch)
 {
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 09f4d66cc..e949f5efd 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -439,7 +439,6 @@ void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable);
 
 void set_msr(struct adapter *padapter, u8 type);
 
-u8 rtw_get_oper_ch(struct adapter *adapter);
 void rtw_set_oper_ch(struct adapter *adapter, u8 ch);
 void rtw_set_oper_bw(struct adapter *adapter, u8 bw);
 void rtw_set_oper_choffset(struct adapter *adapter, u8 offset);
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 397440af8..a71eb008f 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -1978,7 +1978,7 @@ static int cfg80211_rtw_get_channel(struct wiphy *wiphy, struct wireless_dev *wd
 	if (!adapter->rtw_wdev)
 		return -ENODEV;
 
-	channel = rtw_get_oper_ch(adapter);
+	channel = adapter_to_dvobj(adapter)->oper_channel;
 	if (!channel)
 		return -ENODATA;
 
@@ -2452,7 +2452,7 @@ void rtw_cfg80211_rx_action(struct adapter *adapter, u8 *frame, uint frame_len,
 	int channel;
 	u8 category, action;
 
-	channel = rtw_get_oper_ch(adapter);
+	channel = adapter_to_dvobj(adapter)->oper_channel;
 
 	rtw_action_frame_parse(frame, frame_len, &category, &action);
 
@@ -2475,7 +2475,7 @@ static int _cfg80211_rtw_mgmt_tx(struct adapter *padapter, u8 tx_ch, const u8 *b
 	rtw_set_scan_deny(padapter, 1000);
 
 	rtw_scan_abort(padapter);
-	if (tx_ch != rtw_get_oper_ch(padapter)) {
+	if (tx_ch != adapter_to_dvobj(padapter)->oper_channel) {
 		if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED))
 			pmlmeext->cur_channel = tx_ch;
 		set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
-- 
2.55.0


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

* [PATCH 14/61] staging: rtl8723bs: remove ODM_CheckPowerStatus and dead branches
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (12 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 13/61] staging: rtl8723bs: remove redundant rtw_get_oper_ch() wrapper Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 15/61] staging: rtl8723bs: remove unimplemented halbtcoutsrc_GetBtReg helper Arsenii Pashchenko
                   ` (47 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Delete the dummy ODM_CheckPowerStatus function from HalPhyRf_8723B.c,
which always unconditionally returned true.

Since all of its call sites across the driver checked for the
negative condition (!ODM_CheckPowerStatus), the corresponding
if blocks were unreachable and never executed.

Clean up the codebase by removing both the obsolete function itself
and these dead conditional branches to reduce code bloat.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c
index 70b68f473..b77598287 100644
--- a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c
+++ b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c
@@ -1077,10 +1077,6 @@ void ODM_SetIQCbyRFpath(struct dm_odm_t *pDM_Odm, u32 RFpath)
 	}
 }
 
-static bool ODM_CheckPowerStatus(struct adapter *Adapter)
-{
-	return true;
-}
 
 static void _PHY_SaveADDARegisters8723B(
 	struct adapter *padapter,
@@ -1093,8 +1089,6 @@ static void _PHY_SaveADDARegisters8723B(
 	struct hal_com_data *pHalData = GET_HAL_DATA(padapter);
 	struct dm_odm_t *pDM_Odm = &pHalData->odmpriv;
 
-	if (!ODM_CheckPowerStatus(padapter))
-		return;
 
 	for (i = 0 ; i < RegisterNum ; i++) {
 		ADDABackup[i] = PHY_QueryBBReg(pDM_Odm->Adapter, ADDAReg[i], bMaskDWord);
@@ -1556,8 +1550,6 @@ void PHY_IQCalibrate_8723B(
 /* 	u32 		Path_SEL_BB = 0; */
 	u32 		GNT_BT_default;
 
-	if (!ODM_CheckPowerStatus(padapter))
-		return;
 
 	if (!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION))
 		return;
-- 
2.55.0


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

* [PATCH 15/61] staging: rtl8723bs: remove unimplemented halbtcoutsrc_GetBtReg helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (13 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 14/61] staging: rtl8723bs: remove ODM_CheckPowerStatus and dead branches Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 16/61] staging: rtl8723bs: remove rtw_free_evt_priv wrapper and rename helper Arsenii Pashchenko
                   ` (46 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the halbtcoutsrc_GetBtReg() stub function from hal_btcoex.c.
The function was never fully implemented and simply returned a
temporary constant value of 0.

Clean up the codebase by removing the function definition, its
associated prototype in the header file, and updating or removing
its remaining call sites across the driver.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_btcoex.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
index 195ccc4b7..c66ca6f73 100644
--- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c
+++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
@@ -729,11 +729,6 @@ static void halbtcoutsrc_SetBtReg(void *pBtcContext, u8 RegType, u32 RegAddr, u3
 	rtw_hal_fill_h2c_cmd(padapter, 0x67, 4, &(CmdBuffer2[0]));
 }
 
-static u32 halbtcoutsrc_GetBtReg(void *pBtcContext, u8 RegType, u32 RegAddr)
-{
-	/* To be implemented. Always return 0 temporarily */
-	return 0;
-}
 
 static void halbtcoutsrc_FillH2cCmd(void *pBtcContext, u8 elementId, u32 cmdLen, u8 *pCmdBuffer)
 {
@@ -808,7 +803,7 @@ void hal_btcoex_Initialize(void *padapter)
 
 	pBtCoexist->fBtcGet = halbtcoutsrc_Get;
 	pBtCoexist->fBtcSet = halbtcoutsrc_Set;
-	pBtCoexist->fBtcGetBtReg = halbtcoutsrc_GetBtReg;
+	pBtCoexist->fBtcGetBtReg = 0; /*not be implemented*/
 	pBtCoexist->fBtcSetBtReg = halbtcoutsrc_SetBtReg;
 
 	pBtCoexist->boardInfo.singleAntPath = 0;
-- 
2.55.0


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

* [PATCH 16/61] staging: rtl8723bs: remove rtw_free_evt_priv wrapper and rename helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (14 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 15/61] staging: rtl8723bs: remove unimplemented halbtcoutsrc_GetBtReg helper Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 17/61] staging: rtl8723bs: remove rtw_free_cmd_priv " Arsenii Pashchenko
                   ` (45 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant rtw_free_evt_priv() wrapper function from
rtw_cmd.c, which did nothing but call _rtw_free_evt_priv().

Simplify the code by renaming the internal _rtw_free_evt_priv()
helper to rtw_free_evt_priv() and using it everywhere directly. This
eliminates the useless leading underscore naming and reduces call
overhead.

Clean up the old wrapper definition, update the function prototype in
the header file, and adjust all call sites across the driver.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c      | 6 +-----
 drivers/staging/rtl8723bs/include/cmd_osdep.h | 1 -
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index d2c6d48a8..b91182549 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -212,7 +212,7 @@ int rtw_init_evt_priv(struct evt_priv *pevtpriv)
 	return 0;
 }
 
-void _rtw_free_evt_priv(struct	evt_priv *pevtpriv)
+void rtw_free_evt_priv(struct	evt_priv *pevtpriv)
 {
 	_cancel_workitem_sync(&pevtpriv->c2h_wk);
 	while (pevtpriv->c2h_wk_alive)
@@ -286,10 +286,6 @@ struct	cmd_obj	*_rtw_dequeue_cmd(struct __queue *queue)
 	return obj;
 }
 
-void rtw_free_evt_priv(struct	evt_priv *pevtpriv)
-{
-	_rtw_free_evt_priv(pevtpriv);
-}
 
 void rtw_free_cmd_priv(struct	cmd_priv *pcmdpriv)
 {
diff --git a/drivers/staging/rtl8723bs/include/cmd_osdep.h b/drivers/staging/rtl8723bs/include/cmd_osdep.h
index 91d933d71..2259fe57a 100644
--- a/drivers/staging/rtl8723bs/include/cmd_osdep.h
+++ b/drivers/staging/rtl8723bs/include/cmd_osdep.h
@@ -9,7 +9,6 @@
 
 int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv);
 int rtw_init_evt_priv(struct evt_priv *pevtpriv);
-extern void _rtw_free_evt_priv(struct	evt_priv *pevtpriv);
 extern void _rtw_free_cmd_priv(struct	cmd_priv *pcmdpriv);
 extern struct	cmd_obj	*_rtw_dequeue_cmd(struct __queue *queue);
 
-- 
2.55.0


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

* [PATCH 17/61] staging: rtl8723bs: remove rtw_free_cmd_priv wrapper and rename helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (15 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 16/61] staging: rtl8723bs: remove rtw_free_evt_priv wrapper and rename helper Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 18/61] staging: rtl8723bs: replace rtw_dm_in_lps_hdl with direct hal call Arsenii Pashchenko
                   ` (44 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant rtw_free_cmd_priv() wrapper function from
rtw_cmd.c, which did nothing but call _rtw_free_cmd_priv().

Simplify the code by renaming the internal _rtw_free_cmd_priv()
helper to rtw_free_cmd_priv() and using it everywhere directly. This
eliminates the useless leading underscore naming and reduces call
overhead.

Clean up the old wrapper definition, update the function prototype in
the header file, and adjust all call sites across the driver.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c      | 6 +-----
 drivers/staging/rtl8723bs/include/cmd_osdep.h | 1 -
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index b91182549..02b7d24c3 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -227,7 +227,7 @@ void rtw_free_evt_priv(struct	evt_priv *pevtpriv)
 	kfree(pevtpriv->c2h_queue);
 }
 
-void _rtw_free_cmd_priv(struct	cmd_priv *pcmdpriv)
+void rtw_free_cmd_priv(struct	cmd_priv *pcmdpriv)
 {
 	if (pcmdpriv) {
 		kfree(pcmdpriv->cmd_allocated_buf);
@@ -287,10 +287,6 @@ struct	cmd_obj	*_rtw_dequeue_cmd(struct __queue *queue)
 }
 
 
-void rtw_free_cmd_priv(struct	cmd_priv *pcmdpriv)
-{
-	_rtw_free_cmd_priv(pcmdpriv);
-}
 
 int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj);
 int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
diff --git a/drivers/staging/rtl8723bs/include/cmd_osdep.h b/drivers/staging/rtl8723bs/include/cmd_osdep.h
index 2259fe57a..2afd60a7d 100644
--- a/drivers/staging/rtl8723bs/include/cmd_osdep.h
+++ b/drivers/staging/rtl8723bs/include/cmd_osdep.h
@@ -9,7 +9,6 @@
 
 int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv);
 int rtw_init_evt_priv(struct evt_priv *pevtpriv);
-extern void _rtw_free_cmd_priv(struct	cmd_priv *pcmdpriv);
 extern struct	cmd_obj	*_rtw_dequeue_cmd(struct __queue *queue);
 
 #endif
-- 
2.55.0


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

* [PATCH 18/61] staging: rtl8723bs: replace rtw_dm_in_lps_hdl with direct hal call
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (16 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 17/61] staging: rtl8723bs: remove rtw_free_cmd_priv " Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 19/61] staging: rtl8723bs: make lps_ctrl_wk_hdl() static Arsenii Pashchenko
                   ` (43 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant rtw_dm_in_lps_hdl() wrapper function from
rtw_cmd.c and replace its call sites with direct calls to
rtw_hal_set_hwreg().

The wrapper provided no additional abstraction or logic, serving only
to pass fixed parameters (HW_VAR_DM_IN_LPS, NULL) to the underlying
HAL function. Removing it eliminates unnecessary overhead and cleans
up the driver interface.

Clean up the function definition, remove its prototype from the header
file, and update all invocations across the driver.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 02b7d24c3..88ac64a6b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1354,10 +1354,6 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue)
 	return res;
 }
 
-static void rtw_dm_in_lps_hdl(struct adapter *padapter)
-{
-	rtw_hal_set_hwreg(padapter, HW_VAR_DM_IN_LPS, NULL);
-}
 
 u8 rtw_dm_in_lps_wk_cmd(struct adapter *padapter)
 {
@@ -1753,7 +1749,7 @@ u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf)
 		lps_ctrl_wk_hdl(padapter, (u8)pdrvextra_cmd->type);
 		break;
 	case DM_IN_LPS_WK_CID:
-		rtw_dm_in_lps_hdl(padapter);
+		rtw_hal_set_hwreg(padapter, HW_VAR_DM_IN_LPS, NULL);
 		break;
 	case LPS_CHANGE_DTIM_CID:
 		rtw_lps_change_dtim_hdl(padapter, (u8)pdrvextra_cmd->type);
-- 
2.55.0


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

* [PATCH 19/61] staging: rtl8723bs: make lps_ctrl_wk_hdl() static
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (17 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 18/61] staging: rtl8723bs: replace rtw_dm_in_lps_hdl with direct hal call Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 20/61] staging: rtl8723bs: sanitize and align efuse read function headers Arsenii Pashchenko
                   ` (42 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Make lps_ctrl_wk_hdl() static since it is only used within rtw_cmd.c.
This properly restricts its scope to this translation unit.

Additionally, remove the redundant forward declaration located directly
above its actual definition in rtw_cmd.c. This duplicate prototype
is completely unnecessary since the function body immediately follows
it. Cleaning this up reduces code clutter.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 88ac64a6b..bc2536c1b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1262,8 +1262,7 @@ static void dynamic_chk_wk_hdl(struct adapter *padapter)
 	rtw_ps_processor(padapter);
 }
 
-void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type);
-void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type)
+static void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type)
 {
 	struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-- 
2.55.0


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

* [PATCH 20/61] staging: rtl8723bs: sanitize and align efuse read function headers
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (18 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 19/61] staging: rtl8723bs: make lps_ctrl_wk_hdl() static Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 21/61] staging: rtl8723bs: replace rtw_reset_continual_io_error with atomic_set Arsenii Pashchenko
                   ` (41 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Fix the function headers for rtw_efuse_read_1_byte() and
rtw_efuse_one_byte_read() to conform with the Linux kernel coding
style. Place the return type on the same line as the function name,
collapse arguments into single-line definitions, and drop the obsolete
trailing comment.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_efuse.c | 30 +++-------------------
 1 file changed, 4 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c b/drivers/staging/rtl8723bs/core/rtw_efuse.c
index a40d6eab7..52ec19294 100644
--- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
+++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
@@ -25,26 +25,8 @@ rtw_efuse_calculate_word_counts(u8 word_en)
 	return word_cnts;
 }
 
-/*-----------------------------------------------------------------------------
- * Function:	rtw_efuse_read_1_byte
- *
- * Overview:	Copy from WMAC fot EFUSE read 1 byte.
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 09/23/2008	MHC		Copy from WMAC.
- *
- */
-u8
-rtw_efuse_read_1_byte(
-struct adapter *Adapter,
-u16		Address)
+
+u8 rtw_efuse_read_1_byte(struct adapter *Adapter, u16 Address)
 {
 	u8 Bytetemp = {0x00};
 	u8 temp = {0x00};
@@ -79,14 +61,10 @@ u16		Address)
 	} else {
 		return 0xFF;
 	}
-} /* rtw_efuse_read_1_byte */
+}
 
 /*  11/16/2008 MH Read one byte from real Efuse. */
-u8
-rtw_efuse_one_byte_read(
-struct adapter *padapter,
-u16	addr,
-u8	*data)
+u8 rtw_efuse_one_byte_read(struct adapter *padapter, u16 addr, u8 *data)
 {
 	u32 tmpidx = 0;
 	u8 bResult;
-- 
2.55.0


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

* [PATCH 21/61] staging: rtl8723bs: replace rtw_reset_continual_io_error with atomic_set
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (19 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 20/61] staging: rtl8723bs: sanitize and align efuse read function headers Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 22/61] staging: rtl8723bs: inline single-use init_mlme_default_rate_set Arsenii Pashchenko
                   ` (40 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant rtw_reset_continual_io_error() wrapper function
from the driver and replace its call sites with direct atomic_set()
invocations.

The wrapper does nothing but call atomic_set() with a fixed constant
value of 0. Eliminating it simplifies the driver's error-handling
interface and avoids unnecessary call overhead.

Clean up the function definition, remove its prototype from the header
file, and update all invocations to use atomic_set() directly.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_io.c           | 6 ------
 drivers/staging/rtl8723bs/include/rtw_io.h        | 2 +-
 drivers/staging/rtl8723bs/os_dep/sdio_intf.c      | 2 +-
 drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c | 4 ++--
 4 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_io.c b/drivers/staging/rtl8723bs/core/rtw_io.c
index c793ae7ea..2692c9088 100644
--- a/drivers/staging/rtl8723bs/core/rtw_io.c
+++ b/drivers/staging/rtl8723bs/core/rtw_io.c
@@ -144,9 +144,3 @@ int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj)
 
 	return false;
 }
-
-/* Set the continual_io_error of this @param dvobjprive to 0 */
-void rtw_reset_continual_io_error(struct dvobj_priv *dvobj)
-{
-	atomic_set(&dvobj->continual_io_error, 0);
-}
diff --git a/drivers/staging/rtl8723bs/include/rtw_io.h b/drivers/staging/rtl8723bs/include/rtw_io.h
index 3c99a2bc1..2c33d8053 100644
--- a/drivers/staging/rtl8723bs/include/rtw_io.h
+++ b/drivers/staging/rtl8723bs/include/rtw_io.h
@@ -33,7 +33,7 @@ struct	intf_hdl {
 #define MAX_CONTINUAL_IO_ERR SD_IO_TRY_CNT
 
 int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj);
-void rtw_reset_continual_io_error(struct dvobj_priv *dvobj);
+
 
 struct io_priv {
 
diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index d2419c776..0adfc2766 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -170,7 +170,7 @@ static struct dvobj_priv *sdio_dvobj_init(struct sdio_func *func)
 	if (ret)
 		goto free_dvobj;
 
-	rtw_reset_continual_io_error(dvobj);
+	atomic_set(&dvobj->continual_io_error, 0);
 
 	return dvobj;
 
diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
index e9a2f3f7e..f728594b0 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
@@ -217,7 +217,7 @@ u32 sd_read32(struct intf_hdl *pintfhdl, u32 addr, s32 *err)
 				sdio_release_host(func);
 
 			if (*err == 0) {
-				rtw_reset_continual_io_error(psdiodev);
+				atomic_set(&psdiodev->continual_io_error, 0);
 				break;
 			}
 
@@ -293,7 +293,7 @@ void sd_write32(struct intf_hdl *pintfhdl, u32 addr, u32 v, s32 *err)
 			if (claim_needed)
 				sdio_release_host(func);
 			if (*err == 0) {
-				rtw_reset_continual_io_error(psdiodev);
+				atomic_set(&psdiodev->continual_io_error, 0);
 				break;
 			}
 
-- 
2.55.0


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

* [PATCH 22/61] staging: rtl8723bs: inline single-use init_mlme_default_rate_set
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (20 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 21/61] staging: rtl8723bs: replace rtw_reset_continual_io_error with atomic_set Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 23/61] staging: rtl8723bs: remove issue_probereq wrapper and rename helper Arsenii Pashchenko
                   ` (39 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the init_mlme_default_rate_set() helper function since it has
only a single call site across the driver.

Inline its rate configuration arrays and memcpy operations directly
into the initialization routine where it was used. This simplifies
the MLME initialization path and reduces code clutter.

Clean up the function definition from its source file and remove its
prototype from the corresponding header file.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 34 +++++++++++--------
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  1 -
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 064c9923d..54690c2fc 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -184,19 +184,6 @@ void init_hw_mlme_ext(struct adapter *padapter)
 			   pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
 }
 
-void init_mlme_default_rate_set(struct adapter *padapter)
-{
-	struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-
-	unsigned char mixed_datarate[NumRates] = {_1M_RATE_, _2M_RATE_, _5M_RATE_, _11M_RATE_, _6M_RATE_, _9M_RATE_, _12M_RATE_, _18M_RATE_, _24M_RATE_, _36M_RATE_, _48M_RATE_, _54M_RATE_, 0xff};
-	unsigned char mixed_basicrate[NumRates] = {_1M_RATE_, _2M_RATE_, _5M_RATE_, _11M_RATE_, _6M_RATE_, _12M_RATE_, _24M_RATE_, 0xff,};
-	unsigned char supported_mcs_set[16] = {0xff, 0xff, 0x00, 0x00, 0x01, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
-
-	memcpy(pmlmeext->datarate, mixed_datarate, NumRates);
-	memcpy(pmlmeext->basicrate, mixed_basicrate, NumRates);
-
-	memcpy(pmlmeext->default_supported_mcs_set, supported_mcs_set, sizeof(pmlmeext->default_supported_mcs_set));
-}
 
 static void init_mlme_ext_priv_value(struct adapter *padapter)
 {
@@ -216,7 +203,26 @@ static void init_mlme_ext_priv_value(struct adapter *padapter)
 
 	pmlmeext->cur_wireless_mode = padapter->registrypriv.wireless_mode;
 
-	init_mlme_default_rate_set(padapter);
+
+	u8 mixed_datarate[NumRates] = {
+		_1M_RATE_, _2M_RATE_, _5M_RATE_, _11M_RATE_, _6M_RATE_,
+		_9M_RATE_, _12M_RATE_, _18M_RATE_, _24M_RATE_, _36M_RATE_,
+		_48M_RATE_, _54M_RATE_, 0xff
+	};
+	u8 mixed_basicrate[NumRates] = {
+		_1M_RATE_, _2M_RATE_, _5M_RATE_, _11M_RATE_, _6M_RATE_,
+		_12M_RATE_, _24M_RATE_, 0xff
+	};
+	u8 supported_mcs_set[16] = {
+		0xff, 0xff, 0x00, 0x0, 0x01, 0x0, 0x0, 0x0, 0x0,
+		0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
+	};
+
+	memcpy(pmlmeext->datarate, mixed_datarate, NumRates);
+	memcpy(pmlmeext->basicrate, mixed_basicrate, NumRates);
+
+	memcpy(pmlmeext->default_supported_mcs_set, supported_mcs_set,
+		sizeof(pmlmeext->default_supported_mcs_set));
 
 	pmlmeext->tx_rate = IEEE80211_CCK_RATE_1MB;
 	pmlmeext->sitesurvey_res.state = SCAN_DISABLE;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index e949f5efd..a850675d5 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -418,7 +418,6 @@ struct mlme_ext_priv {
 	u8 active_keep_alive_check;
 };
 
-void init_mlme_default_rate_set(struct adapter *padapter);
 void init_mlme_ext_priv(struct adapter *padapter);
 void init_hw_mlme_ext(struct adapter *padapter);
 void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext);
-- 
2.55.0


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

* [PATCH 23/61] staging: rtl8723bs: remove issue_probereq wrapper and rename helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (21 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 22/61] staging: rtl8723bs: inline single-use init_mlme_default_rate_set Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 24/61] staging: rtl8723bs: remove register_task_alive inline helper Arsenii Pashchenko
                   ` (38 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant issue_probereq() wrapper function from
rtw_mlme_ext.c, which did nothing but pass fixed default arguments
to _issue_probereq().

Simplify the code by renaming the internal _issue_probereq() helper
to issue_probereq() and exposing its full signature. Update its only
call sites across the driver to pass the required explicit arguments
(0, 1, false) directly.

This eliminates the useless leading underscore naming convention,
reduces unnecessary abstraction layers, and cleans up the MLME
extension interface.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 24 ++++++++++---------
 .../staging/rtl8723bs/include/rtw_mlme_ext.h  |  3 ++-
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 54690c2fc..0c5770f09 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -2357,7 +2357,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p
 	dump_mgntframe(padapter, pmgntframe);
 }
 
-static int _issue_probereq(struct adapter *padapter,
+int issue_probereq(struct adapter *padapter,
 			   struct ndis_802_11_ssid *pssid,
 			   u8 *da, u8 ch, bool append_wps, bool wait_ack)
 {
@@ -2450,10 +2450,6 @@ static int _issue_probereq(struct adapter *padapter,
 	return ret;
 }
 
-inline void issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da)
-{
-	_issue_probereq(padapter, pssid, da, 0, 1, false);
-}
 
 int issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da, u8 ch, bool append_wps,
 	int try_cnt, int wait_ms)
@@ -2462,7 +2458,7 @@ int issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid,
 	int i = 0;
 
 	do {
-		ret = _issue_probereq(padapter, pssid, da, ch, append_wps,
+		ret = issue_probereq(padapter, pssid, da, ch, append_wps,
 				      wait_ms > 0);
 
 		i++;
@@ -3703,20 +3699,26 @@ void site_survey(struct adapter *padapter)
 
 					/* IOT issue, When wifi_spec is not set, send one probe req without WPS IE. */
 					if (padapter->registrypriv.wifi_spec)
-						issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL);
+						issue_probereq(padapter,
+							&pmlmeext->sitesurvey_res.ssid[i],
+							NULL, 0, 1, false);
 					else
-						issue_probereq_ex(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL, 0, 0, 0, 0);
+						issue_probereq_ex(padapter,
+							&pmlmeext->sitesurvey_res.ssid[i],
+							NULL, 0, 0, 0, 0);
 
-					issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL);
+					issue_probereq(padapter,
+						&pmlmeext->sitesurvey_res.ssid[i],
+						NULL, 0, 1, false);
 				}
 
 				if (pmlmeext->sitesurvey_res.scan_mode == SCAN_ACTIVE) {
 					/* IOT issue, When wifi_spec is not set, send one probe req without WPS IE. */
 					if (padapter->registrypriv.wifi_spec)
-						issue_probereq(padapter, NULL, NULL);
+						issue_probereq(padapter, NULL, NULL, 0, 1, false);
 					else
 						issue_probereq_ex(padapter, NULL, NULL, 0, 0, 0, 0);
-					issue_probereq(padapter, NULL, NULL);
+					issue_probereq(padapter, NULL, NULL, 0, 1, false);
 				}
 			}
 		}
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index a850675d5..ae4c4586f 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -539,7 +539,8 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p
 void issue_assocreq(struct adapter *padapter);
 void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_info *pstat, int pkt_type);
 void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short status);
-void issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da);
+int issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *pssid,
+	u8 *da, u8 ch, bool append_wps, bool wait_ack);
 s32 issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da, u8 ch, bool append_wps, int try_cnt, int wait_ms);
 int issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned int power_mode, int try_cnt, int wait_ms);
 s32 issue_nulldata_in_interrupt(struct adapter *padapter, u8 *da);
-- 
2.55.0


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

* [PATCH 24/61] staging: rtl8723bs: remove register_task_alive inline helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (22 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 23/61] staging: rtl8723bs: remove issue_probereq wrapper and rename helper Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 25/61] staging: rtl8723bs: remove unregister_task_alive " Arsenii Pashchenko
                   ` (37 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant static inline helper register_task_alive() from
the power control management code.

The function provides no additional logic, validation, or locking,
acting merely as a wrapper around a standard bitwise OR operation
on the pwrctrl->alives bitmap. Replacing it with a direct expression
simplifies the driver's power interface.

Clean up the inline definition and update all its call sites across
the codebase to manipulate pwrctrl->alives directly.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index 1d6fe3734..c52988cfc 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -667,11 +667,6 @@ static void pwr_rpwm_timeout_handler(struct timer_list *t)
 	_set_workitem(&pwrpriv->rpwmtimeoutwi);
 }
 
-static inline void register_task_alive(struct pwrctrl_priv *pwrctrl, u32 tag)
-{
-	pwrctrl->alives |= tag;
-}
-
 static inline void unregister_task_alive(struct pwrctrl_priv *pwrctrl, u32 tag)
 {
 	pwrctrl->alives &= ~tag;
@@ -704,7 +699,7 @@ s32 rtw_register_task_alive(struct adapter *padapter, u32 task)
 
 	mutex_lock(&pwrctrl->lock);
 
-	register_task_alive(pwrctrl, task);
+	pwrctrl->alives |= task;
 
 	if (pwrctrl->fw_current_in_ps_mode) {
 		if (pwrctrl->cpwm < pslv) {
@@ -789,7 +784,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
 
 	mutex_lock(&pwrctrl->lock);
 
-	register_task_alive(pwrctrl, XMIT_ALIVE);
+	pwrctrl->alives |= XMIT_ALIVE;
 
 	if (pwrctrl->fw_current_in_ps_mode) {
 		if (pwrctrl->cpwm < pslv) {
@@ -834,7 +829,7 @@ s32 rtw_register_cmd_alive(struct adapter *padapter)
 
 	mutex_lock(&pwrctrl->lock);
 
-	register_task_alive(pwrctrl, CMD_ALIVE);
+	pwrctrl->alives |= CMD_ALIVE;
 
 	if (pwrctrl->fw_current_in_ps_mode) {
 		if (pwrctrl->cpwm < pslv) {
-- 
2.55.0


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

* [PATCH 25/61] staging: rtl8723bs: remove unregister_task_alive inline helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (23 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 24/61] staging: rtl8723bs: remove register_task_alive inline helper Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 26/61] staging: rtl8723bs: clean up Michael MIC pseudo header logic Arsenii Pashchenko
                   ` (36 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant static inline helper unregister_task_alive()
from the power control management code.

The function provides no additional logic, validation, or locking,
acting merely as a wrapper around a standard bitwise AND-NOT operation
on the pwrctrl->alives bitmap. Replacing it with a direct expression
simplifies the driver's power interface.

Clean up the inline definition and update all its call sites across
the codebase to manipulate pwrctrl->alives directly.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index c52988cfc..a15f3ee9b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -667,11 +667,6 @@ static void pwr_rpwm_timeout_handler(struct timer_list *t)
 	_set_workitem(&pwrpriv->rpwmtimeoutwi);
 }
 
-static inline void unregister_task_alive(struct pwrctrl_priv *pwrctrl, u32 tag)
-{
-	pwrctrl->alives &= ~tag;
-}
-
 /*
  * Description:
  *Check if the fw_pwrstate is okay for I/O.
@@ -747,7 +742,7 @@ void rtw_unregister_task_alive(struct adapter *padapter, u32 task)
 
 	mutex_lock(&pwrctrl->lock);
 
-	unregister_task_alive(pwrctrl, task);
+	pwrctrl->alives &= task;
 
 	if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && pwrctrl->fw_current_in_ps_mode) {
 		if (pwrctrl->cpwm > pslv) {
@@ -874,7 +869,7 @@ void rtw_unregister_tx_alive(struct adapter *padapter)
 
 	mutex_lock(&pwrctrl->lock);
 
-	unregister_task_alive(pwrctrl, XMIT_ALIVE);
+	pwrctrl->alives &= XMIT_ALIVE;
 
 	if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && pwrctrl->fw_current_in_ps_mode) {
 		if (pwrctrl->cpwm > pslv)
@@ -910,7 +905,7 @@ void rtw_unregister_cmd_alive(struct adapter *padapter)
 
 	mutex_lock(&pwrctrl->lock);
 
-	unregister_task_alive(pwrctrl, CMD_ALIVE);
+	pwrctrl->alives &= CMD_ALIVE;
 
 	if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && pwrctrl->fw_current_in_ps_mode) {
 		if (pwrctrl->cpwm > pslv) {
-- 
2.55.0


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

* [PATCH 26/61] staging: rtl8723bs: clean up Michael MIC pseudo header logic
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (24 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 25/61] staging: rtl8723bs: remove unregister_task_alive " Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 27/61] staging: rtl8723bs: replace rtw_set_oper_bw with direct assignment Arsenii Pashchenko
                   ` (35 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Clean up the single-use Michael MIC calculation logic. Simplify the
priority array initialization to a standard zero-initializer and pass
the array directly instead of using the redundant address-of-first-element
(&priority[0]) syntax.

This reduces visual clutter and aligns the block with modern Linux
kernel coding practices without introducing an unneeded helper.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_recv.c     | 27 +++++++++++++++++-
 drivers/staging/rtl8723bs/core/rtw_security.c | 28 -------------------
 .../staging/rtl8723bs/include/rtw_security.h  |  8 ------
 3 files changed, 26 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 78bd04982..cad44923b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -378,7 +378,32 @@ static signed int recvframe_chkmic(struct adapter *adapter,  union recv_frame *p
 			pframe = precvframe->u.hdr.rx_data;
 			payload = pframe + prxattrib->hdrlen + prxattrib->iv_len;
 
-			rtw_seccalctkipmic(mickey, pframe, payload, datalen, &miccode[0], (unsigned char)prxattrib->priority); /* care the length of the data */
+			/* care the length of the data */
+			struct mic_data	micdata;
+			u8 priority[4] = {0};
+
+			rtw_secmicsetkey(&micdata, mickey);
+			priority[0] = (unsigned char)prxattrib->priority;
+
+			/* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */
+			if (pframe[1] & 1) {   /* ToDS == 1 */
+				rtw_secmicappend(&micdata, &pframe[16], 6);  /* DA */
+				if (pframe[1] & 2)  /* From Ds == 1 */
+					rtw_secmicappend(&micdata, &pframe[24], 6);
+				else
+					rtw_secmicappend(&micdata, &pframe[10], 6);
+			} else {	/* ToDS == 0 */
+				rtw_secmicappend(&micdata, &pframe[4], 6);   /* DA */
+				if (pframe[1] & 2)  /* From Ds == 1 */
+					rtw_secmicappend(&micdata, &pframe[16], 6);
+				else
+					rtw_secmicappend(&micdata, &pframe[10], 6);
+			}
+			rtw_secmicappend(&micdata, priority, 4);
+
+			rtw_secmicappend(&micdata, payload, datalen);
+
+			rtw_secgetmic(&micdata, &miccode[0]);
 
 			pframemic = payload + datalen;
 
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index a4a4f0e6d..6f3069498 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -196,34 +196,6 @@ void rtw_secgetmic(struct mic_data *pmicdata, u8 *dst)
 	secmicclear(pmicdata);
 }
 
-void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_code, u8 pri)
-{
-	struct mic_data	micdata;
-	u8 priority[4] = {0x0, 0x0, 0x0, 0x0};
-
-	rtw_secmicsetkey(&micdata, key);
-	priority[0] = pri;
-
-	/* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */
-	if (header[1] & 1) {   /* ToDS == 1 */
-		rtw_secmicappend(&micdata, &header[16], 6);  /* DA */
-		if (header[1] & 2)  /* From Ds == 1 */
-			rtw_secmicappend(&micdata, &header[24], 6);
-		else
-			rtw_secmicappend(&micdata, &header[10], 6);
-	} else {	/* ToDS == 0 */
-		rtw_secmicappend(&micdata, &header[4], 6);   /* DA */
-		if (header[1] & 2)  /* From Ds == 1 */
-			rtw_secmicappend(&micdata, &header[16], 6);
-		else
-			rtw_secmicappend(&micdata, &header[10], 6);
-	}
-	rtw_secmicappend(&micdata, &priority[0], 4);
-
-	rtw_secmicappend(&micdata, data, data_len);
-
-	rtw_secgetmic(&micdata, mic_code);
-}
 
 /* macros for extraction/creation of unsigned char/unsigned short values  */
 #define RotR1(v16)   ((((v16) >> 1) & 0x7FFF) ^ (((v16) & 1) << 15))
diff --git a/drivers/staging/rtl8723bs/include/rtw_security.h b/drivers/staging/rtl8723bs/include/rtw_security.h
index 22eec2215..5bad48ed6 100644
--- a/drivers/staging/rtl8723bs/include/rtw_security.h
+++ b/drivers/staging/rtl8723bs/include/rtw_security.h
@@ -249,14 +249,6 @@ void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b);
 void rtw_secmicappend(struct mic_data *pmicdata, u8 *src, u32 nBytes);
 void rtw_secgetmic(struct mic_data *pmicdata, u8 *dst);
 
-void rtw_seccalctkipmic(
-	u8 *key,
-	u8 *header,
-	u8 *data,
-	u32 data_len,
-	u8 *Miccode,
-	u8   priority);
-
 u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe);
 u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe);
 void rtw_wep_encrypt(struct adapter *padapter, u8  *pxmitframe);
-- 
2.55.0


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

* [PATCH 27/61] staging: rtl8723bs: replace rtw_set_oper_bw with direct assignment
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (25 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 26/61] staging: rtl8723bs: clean up Michael MIC pseudo header logic Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 28/61] staging: rtl8723bs: inline single-use _clear_cam_entry helper Arsenii Pashchenko
                   ` (34 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant rtw_set_oper_bw() wrapper function from
rtw_wlan_util.c and replace its call sites with direct structure
member assignments.

The helper provides no extra logic, locking, or validation, acting
solely as a setter for adapter_to_dvobj(adapter)->oper_bwmode.
Removing it reduces unnecessary abstraction layers and simplifies the
driver interface.

Clean up the function definition, remove its prototype from the header
file, and update all invocations across the driver.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c   | 14 ++------------
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h |  2 --
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index f610fa5b3..053861f29 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -260,16 +260,6 @@ inline void rtw_set_oper_ch(struct adapter *adapter, u8 ch)
 	dvobj->oper_channel = ch;
 }
 
-inline void rtw_set_oper_bw(struct adapter *adapter, u8 bw)
-{
-	adapter_to_dvobj(adapter)->oper_bwmode = bw;
-}
-
-inline void rtw_set_oper_choffset(struct adapter *adapter, u8 offset)
-{
-	adapter_to_dvobj(adapter)->oper_ch_offset = offset;
-}
-
 u8 rtw_get_center_ch(u8 channel, u8 chnl_bw, u8 chnl_offset)
 {
 	u8 center_ch = channel;
@@ -317,8 +307,8 @@ void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigne
 
 	/* saved channel/bw info */
 	rtw_set_oper_ch(padapter, channel);
-	rtw_set_oper_bw(padapter, bwmode);
-	rtw_set_oper_choffset(padapter, channel_offset);
+	adapter_to_dvobj(padapter)->oper_bwmode = bwmode;
+	adapter_to_dvobj(padapter)->oper_ch_offset =  channel_offset;
 
 	rtw_hal_set_chnl_bw(padapter, center_ch, bwmode, channel_offset, chnl_offset80); /*  set center channel */
 
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index ae4c4586f..4b05779f2 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -439,8 +439,6 @@ void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable);
 void set_msr(struct adapter *padapter, u8 type);
 
 void rtw_set_oper_ch(struct adapter *adapter, u8 ch);
-void rtw_set_oper_bw(struct adapter *adapter, u8 bw);
-void rtw_set_oper_choffset(struct adapter *adapter, u8 offset);
 u8 rtw_get_center_ch(u8 channel, u8 chnl_bw, u8 chnl_offset);
 unsigned long rtw_get_on_cur_ch_time(struct adapter *adapter);
 
-- 
2.55.0


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

* [PATCH 28/61] staging: rtl8723bs: inline single-use _clear_cam_entry helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (26 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 27/61] staging: rtl8723bs: replace rtw_set_oper_bw with direct assignment Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 29/61] staging: rtl8723bs: collapse set_sta_rate and Update_RA_Entry wrappers Arsenii Pashchenko
                   ` (33 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the _clear_cam_entry() helper function since it has only a
single call site across the driver.

Inline its logic directly into the sole invocation site and modernize
the array declarations. Replace the verbose 'unsigned char' types with
the standard kernel 'u8' type, and swap the explicit hexadecimal zero
sequences for clean, fixed-size bounds with zero-initializers ({0}).

This eliminates an unnecessary abstraction layer, reduces visual noise,
and cleans up the driver's CAM management path.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c   | 13 ++++---------
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h |  1 -
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 053861f29..c85055687 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -423,14 +423,6 @@ void _write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key)
 	}
 }
 
-void _clear_cam_entry(struct adapter *padapter, u8 entry)
-{
-	unsigned char null_sta[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-	unsigned char null_key[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-
-	_write_cam(padapter, entry, 0, null_sta, null_key);
-}
-
 inline void write_cam(struct adapter *adapter, u8 id, u16 ctrl, u8 *mac, u8 *key)
 {
 	_write_cam(adapter, id, ctrl, mac, key);
@@ -439,7 +431,10 @@ inline void write_cam(struct adapter *adapter, u8 id, u16 ctrl, u8 *mac, u8 *key
 
 inline void clear_cam_entry(struct adapter *adapter, u8 id)
 {
-	_clear_cam_entry(adapter, id);
+	u8 null_sta[6] = {0};
+	u8 null_key[16] = {0};
+
+	_write_cam(adapter, id, 0, null_sta, null_key);
 	clear_cam_cache(adapter, id);
 }
 
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 4b05779f2..2b8df2bdb 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -449,7 +449,6 @@ unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval);
 
 /* modify HW only */
 void _write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key);
-void _clear_cam_entry(struct adapter *padapter, u8 entry);
 
 /* modify both HW and cache */
 void write_cam(struct adapter *padapter, u8 id, u16 ctrl, u8 *mac, u8 *key);
-- 
2.55.0


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

* [PATCH 29/61] staging: rtl8723bs: collapse set_sta_rate and Update_RA_Entry wrappers
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (27 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 28/61] staging: rtl8723bs: inline single-use _clear_cam_entry helper Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 30/61] staging: rtl8723bs: replace correct_TSF with direct HAL call Arsenii Pashchenko
                   ` (32 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the multi-layered redundant wrappers set_sta_rate() and
Update_RA_Entry() from rtw_wlan_util.c.

These helpers provided no extra logic or validation, serving merely
as unnecessary abstraction layers that ultimately passed execution down
to rtw_hal_update_ra_mask(psta, 0). Eliminating this nested wrapper
chain simplifies the driver's rate adaptation interface and reduces
call overhead.

Clean up both function definitions, remove their prototypes from the
header file, and update all external call sites to invoke the
underlying rtw_hal_update_ra_mask() function directly.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_ap.c          | 2 +-
 drivers/staging/rtl8723bs/core/rtw_cmd.c         | 2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c    | 4 ++--
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c   | 9 ---------
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 2 --
 5 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index c8f0beec0..9ecf75ef4 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -1926,7 +1926,7 @@ void rtw_ap_restore_network(struct adapter *padapter)
 
 		if (psta->state & _FW_LINKED) {
 			rtw_sta_media_status_rpt(padapter, psta, 1);
-			Update_RA_Entry(padapter, psta);
+			rtw_hal_update_ra_mask(psta, 0);
 			/* pairwise key */
 			/* per sta pairwise key and settings */
 			if ((psecuritypriv->dot11PrivacyAlgrthm == _TKIP_) ||
diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index bc2536c1b..c8bdd0f3c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1413,7 +1413,7 @@ static void rtw_lps_change_dtim_hdl(struct adapter *padapter, u8 dtim)
 static void rtw_dm_ra_mask_hdl(struct adapter *padapter, struct sta_info *psta)
 {
 	if (psta)
-		set_sta_rate(padapter, psta);
+		rtw_hal_update_ra_mask(psta, 0);
 }
 
 u8 rtw_dm_ra_mask_wk_cmd(struct adapter *padapter, u8 *psta)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 0c5770f09..d472570db 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -4674,7 +4674,7 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res)
 		psta->wireless_mode = pmlmeext->cur_wireless_mode;
 
 		/* set per sta rate after updating HT cap. */
-		set_sta_rate(padapter, psta);
+		rtw_hal_update_ra_mask(psta, 0);
 
 		rtw_sta_media_status_rpt(padapter, psta, 1);
 
@@ -4747,7 +4747,7 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter, struct sta_info *p
 	psta->raid = networktype_to_raid_ex(padapter, psta);
 
 	/* rate radaptive */
-	Update_RA_Entry(padapter, psta);
+	rtw_hal_update_ra_mask(psta, 0);
 }
 
 void mlmeext_sta_del_event_callback(struct adapter *padapter)
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index c85055687..dc2e341aa 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1342,16 +1342,7 @@ unsigned char get_highest_rate_idx(u32 mask)
 	return rate_idx;
 }
 
-void Update_RA_Entry(struct adapter *padapter, struct sta_info *psta)
-{
-	rtw_hal_update_ra_mask(psta, 0);
-}
 
-void set_sta_rate(struct adapter *padapter, struct sta_info *psta)
-{
-	/* rate adaptive */
-	Update_RA_Entry(padapter, psta);
-}
 
 static u32 get_realtek_assoc_AP_vender(struct ndis_80211_var_ie *pIE)
 {
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 2b8df2bdb..6b1ac26b3 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -498,8 +498,6 @@ int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie, uint var_ie_l
 
 /* for sta/adhoc mode */
 void update_sta_info(struct adapter *padapter, struct sta_info *psta);
-void Update_RA_Entry(struct adapter *padapter, struct sta_info *psta);
-void set_sta_rate(struct adapter *padapter, struct sta_info *psta);
 
 unsigned int receive_disconnect(struct adapter *padapter, unsigned char *MacAddr, unsigned short reason);
 
-- 
2.55.0


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

* [PATCH 30/61] staging: rtl8723bs: replace correct_TSF with direct HAL call
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (28 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 29/61] staging: rtl8723bs: collapse set_sta_rate and Update_RA_Entry wrappers Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:47 ` [PATCH 31/61] staging: rtl8723bs: replace rtw_sctx_done with direct status call Arsenii Pashchenko
                   ` (31 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant correct_TSF() wrapper function from rtw_wlan_util.c
and replace its call sites with direct calls to rtw_hal_set_hwreg().

The helper provides no extra logic or validation, serving only to pass
the fixed HW_VAR_CORRECT_TSF flag and a NULL pointer to the underlying
HAL layer. Removing it simplifies the driver's synchronization
interface and reduces call overhead.

Clean up the function definition, remove its prototype from the header
file, and update all invocations across the driver.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c    | 4 ++--
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c   | 5 -----
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index d472570db..9dfa31171 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -4690,7 +4690,7 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res)
 
 	if ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) {
 		/*  correcting TSF */
-		correct_TSF(padapter, pmlmeext);
+		rtw_hal_set_hwreg(padapter, HW_VAR_CORRECT_TSF, NULL);
 
 		/* set_link_timer(pmlmeext, DISCONNECT_TO); */
 	}
@@ -4714,7 +4714,7 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter, struct sta_info *p
 			/* update_TSF(pmlmeext, pframe, len); */
 
 			/*  correcting TSF */
-			correct_TSF(padapter, pmlmeext);
+			rtw_hal_set_hwreg(padapter, HW_VAR_CORRECT_TSF, NULL);
 
 			/* start beacon */
 			if (send_beacon(padapter) == _FAIL) {
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index dc2e341aa..03e047397 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1600,11 +1600,6 @@ void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len)
 	pmlmeext->TSFValue |= le32_to_cpu(*pbuf);
 }
 
-void correct_TSF(struct adapter *padapter, struct mlme_ext_priv *pmlmeext)
-{
-	rtw_hal_set_hwreg(padapter, HW_VAR_CORRECT_TSF, NULL);
-}
-
 void adaptive_early_32k(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len)
 {
 	int i;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 6b1ac26b3..b12128963 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -602,7 +602,6 @@ void sa_query_timer_hdl(struct timer_list *t);
 extern void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr);
 
 extern void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len);
-extern void correct_TSF(struct adapter *padapter, struct mlme_ext_priv *pmlmeext);
 extern void adaptive_early_32k(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len);
 extern bool traffic_status_watchdog(struct adapter *padapter, bool from_timer);
 
-- 
2.55.0


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

* [PATCH 31/61] staging: rtl8723bs: replace rtw_sctx_done with direct status call
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (29 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 30/61] staging: rtl8723bs: replace correct_TSF with direct HAL call Arsenii Pashchenko
@ 2026-07-15 12:47 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 32/61] staging: rtl8723bs: remove rtw_free_mlme_priv wrapper and rename helper Arsenii Pashchenko
                   ` (30 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant rtw_sctx_done() wrapper function from rtw_xmit.c
and replace its call sites with direct calls to rtw_sctx_done_err().

The helper provides no extra logic, serving only to pass the fixed
RTW_SCTX_DONE_SUCCESS status code to the underlying error-handling
function. Removing it simplifies the transmit context interface and
reduces call overhead.

Clean up the function definition, remove its prototype from the header
file, and update all invocations across the driver.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c     | 2 +-
 drivers/staging/rtl8723bs/core/rtw_xmit.c    | 4 ----
 drivers/staging/rtl8723bs/include/rtw_xmit.h | 1 -
 3 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index c8bdd0f3c..01f8b378e 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -463,7 +463,7 @@ int rtw_cmd_thread(void *context)
 					   FUNC_ADPT_ARG(pcmd->padapter));
 
 				if (pcmd->res == H2C_SUCCESS)
-					rtw_sctx_done(&pcmd->sctx);
+					rtw_sctx_done_err(&pcmd->sctx, RTW_SCTX_DONE_SUCCESS);
 				else
 					rtw_sctx_done_err(&pcmd->sctx, RTW_SCTX_DONE_CMD_ERROR);
 			}
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index fdda407c1..9a525be74 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -2565,10 +2565,6 @@ void rtw_sctx_done_err(struct submit_ctx **sctx, int status)
 	}
 }
 
-void rtw_sctx_done(struct submit_ctx **sctx)
-{
-	rtw_sctx_done_err(sctx, RTW_SCTX_DONE_SUCCESS);
-}
 
 int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms)
 {
diff --git a/drivers/staging/rtl8723bs/include/rtw_xmit.h b/drivers/staging/rtl8723bs/include/rtw_xmit.h
index f67cb22e3..f85a03efe 100644
--- a/drivers/staging/rtl8723bs/include/rtw_xmit.h
+++ b/drivers/staging/rtl8723bs/include/rtw_xmit.h
@@ -212,7 +212,6 @@ enum {
 void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms);
 int rtw_sctx_wait(struct submit_ctx *sctx);
 void rtw_sctx_done_err(struct submit_ctx **sctx, int status);
-void rtw_sctx_done(struct submit_ctx **sctx);
 
 struct xmit_buf {
 	struct list_head	list;
-- 
2.55.0


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

* [PATCH 32/61] staging: rtl8723bs: remove rtw_free_mlme_priv wrapper and rename helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (30 preceding siblings ...)
  2026-07-15 12:47 ` [PATCH 31/61] staging: rtl8723bs: replace rtw_sctx_done with direct status call Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 33/61] staging: rtl8723bs: remove duplicate prototype of rtw_free_network_nolock Arsenii Pashchenko
                   ` (29 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant rtw_free_mlme_priv() wrapper function, which did
nothing but call _rtw_free_mlme_priv().

Simplify the code by renaming the internal _rtw_free_mlme_priv()
helper to rtw_free_mlme_priv() and using it everywhere directly. This
eliminates the useless leading underscore naming and reduces call
overhead.

Clean up the old wrapper definition, update the function prototype in
the header file, and adjust all call sites across the driver.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c    | 7 +------
 drivers/staging/rtl8723bs/include/rtw_mlme.h | 1 -
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index b038233af..e86a4e83b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -129,7 +129,7 @@ void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv)
 	rtw_free_mlme_ie_data(&pmlmepriv->p2p_assoc_req_ie, &pmlmepriv->p2p_assoc_req_ie_len);
 }
 
-void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
+void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
 {
 	if (pmlmepriv) {
 		rtw_free_mlme_priv_ie_data(pmlmepriv);
@@ -302,11 +302,6 @@ u8 *rtw_get_beacon_interval_from_ie(u8 *ie)
 	return ie + 8;
 }
 
-void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
-{
-	_rtw_free_mlme_priv(pmlmepriv);
-}
-
 void rtw_free_network_nolock(struct adapter *padapter, struct wlan_network *pnetwork);
 void rtw_free_network_nolock(struct adapter *padapter, struct wlan_network *pnetwork)
 {
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h
index 233bf98e2..8c924e35a 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h
@@ -349,7 +349,6 @@ void rtw_set_scan_deny(struct adapter *adapter, u32 ms);
 
 void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv);
 
-extern void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv);
 
 /* extern struct wlan_network* _rtw_dequeue_network(struct __queue *queue); */
 
-- 
2.55.0


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

* [PATCH 33/61] staging: rtl8723bs: remove duplicate prototype of rtw_free_network_nolock
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (31 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 32/61] staging: rtl8723bs: remove rtw_free_mlme_priv wrapper and rename helper Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 34/61] staging: rtl8723bs: replace rtw_get_beacon_interval_from_ie with define Arsenii Pashchenko
                   ` (28 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant forward declaration of rtw_free_network_nolock()
located directly above its actual definition in the source file.

This duplicate prototype is unnecessary since the function body
immediately follows it, and the proper declaration already exists in
the corresponding header file. Clean this up to reduce code clutter.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index e86a4e83b..73b20a78d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -302,7 +302,6 @@ u8 *rtw_get_beacon_interval_from_ie(u8 *ie)
 	return ie + 8;
 }
 
-void rtw_free_network_nolock(struct adapter *padapter, struct wlan_network *pnetwork);
 void rtw_free_network_nolock(struct adapter *padapter, struct wlan_network *pnetwork)
 {
 	_rtw_free_network_nolock(&padapter->mlmepriv, pnetwork);
-- 
2.55.0


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

* [PATCH 34/61] staging: rtl8723bs: replace rtw_get_beacon_interval_from_ie with define
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (32 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 33/61] staging: rtl8723bs: remove duplicate prototype of rtw_free_network_nolock Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 35/61] staging: rtl8723bs: inline _rtw_free_network_nolock into wrapper Arsenii Pashchenko
                   ` (27 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant rtw_get_beacon_interval_from_ie() helper function
and introduce a macro definition for the beacon interval offset.

The original function performed a trivial pointer addition (ie + 8).
Replacing it with a descriptive macro eliminates a useless function call
layer while keeping the code self-documenting and free of magic numbers.

Define RTW_BEACON_INTERVAL_IE_OFFSET in the header, clean up the function
definition, and update all call sites to use direct pointer arithmetic.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_ap.c        | 2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c      | 4 ----
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c  | 8 ++++----
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c   | 2 +-
 drivers/staging/rtl8723bs/include/rtw_mlme.h   | 5 ++++-
 6 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 9ecf75ef4..ba45dd49c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -791,7 +791,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf,  int len)
 
 	/* beacon interval */
 	/* ie + 8;	8: TimeStamp, 2: Beacon Interval 2:Capability */
-	p = rtw_get_beacon_interval_from_ie(ie);
+	p = ie+RTW_BEACON_INTERVAL_IE_OFFSET;
 	pbss_network->configuration.beacon_period = get_unaligned_le16(p);
 
 	/* capability */
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 73b20a78d..0ec599383 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -297,10 +297,6 @@ u16 rtw_get_capability(struct wlan_bssid_ex *bss)
 	return le16_to_cpu(val);
 }
 
-u8 *rtw_get_beacon_interval_from_ie(u8 *ie)
-{
-	return ie + 8;
-}
 
 void rtw_free_network_nolock(struct adapter *padapter, struct wlan_network *pnetwork)
 {
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 9dfa31171..25dfb20f3 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -2113,7 +2113,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms)
 
 	/*  beacon interval: 2 bytes */
 
-	memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->ies)), 2);
+	memcpy(pframe, (unsigned char *)(cur_network->ies+RTW_BEACON_INTERVAL_IE_OFFSET), 2);
 
 	pframe += 2;
 	pattrib->pktlen += 2;
@@ -2309,14 +2309,14 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p
 
 		/*  beacon interval: 2 bytes */
 
-		memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->ies)), 2);
+		memcpy(pframe, (u8 *)(cur_network->ies+RTW_BEACON_INTERVAL_IE_OFFSET), 2);
 
 		pframe += 2;
 		pattrib->pktlen += 2;
 
 		/*  capability info: 2 bytes */
 
-		memcpy(pframe, (unsigned char *)(rtw_get_capability_from_ie(cur_network->ies)), 2);
+		memcpy(pframe, (u8 *)(rtw_get_capability_from_ie(cur_network->ies)), 2);
 
 		pframe += 2;
 		pattrib->pktlen += 2;
@@ -3881,7 +3881,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str
 		}
 	}
 
-	memcpy(&le32_tmp, rtw_get_beacon_interval_from_ie(bssid->ies), 2);
+	memcpy(&le32_tmp, bssid->ies+RTW_BEACON_INTERVAL_IE_OFFSET, 2);
 	bssid->configuration.beacon_period = le32_to_cpu(le32_tmp);
 
 	val16 = rtw_get_capability((struct wlan_bssid_ex *)bssid);
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 03e047397..1597fc33a 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -324,7 +324,7 @@ u16 get_beacon_interval(struct wlan_bssid_ex *bss)
 {
 	__le16 val;
 
-	memcpy((unsigned char *)&val, rtw_get_beacon_interval_from_ie(bss->ies), 2);
+	memcpy((unsigned char *)&val, bss->ies+RTW_BEACON_INTERVAL_IE_OFFSET, 2);
 
 	return le16_to_cpu(val);
 }
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
index c35c7f1c3..826a20529 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
@@ -128,7 +128,7 @@ static void ConstructBeacon(struct adapter *padapter, u8 *pframe, u32 *pLength)
 	pktlen += 8;
 
 	/*  beacon interval: 2 bytes */
-	memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->ies)), 2);
+	memcpy(pframe, (unsigned char *)(cur_network->ies+RTW_BEACON_INTERVAL_IE_OFFSET), 2);
 
 	pframe += 2;
 	pktlen += 2;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h
index 8c924e35a..23c46df90 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h
@@ -43,6 +43,10 @@
 #define _FW_UNDER_SURVEY	WIFI_SITE_MONITOR
 
 
+#define RTW_BEACON_INTERVAL_IE_OFFSET 8
+
+
+
 enum {
  dot11AuthAlgrthm_Open = 0,
  dot11AuthAlgrthm_Shared,
@@ -366,7 +370,6 @@ bool rtw_if_up(struct adapter *padapter);
 bool rtw_linked_check(struct adapter *padapter);
 
 u8 *rtw_get_capability_from_ie(u8 *ie);
-u8 *rtw_get_beacon_interval_from_ie(u8 *ie);
 
 
 void rtw_joinbss_reset(struct adapter *padapter);
-- 
2.55.0


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

* [PATCH 35/61] staging: rtl8723bs: inline _rtw_free_network_nolock into wrapper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (33 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 34/61] staging: rtl8723bs: replace rtw_get_beacon_interval_from_ie with define Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 36/61] staging: rtl8723bs: remove rtw_wmm_event_callback and update handler Arsenii Pashchenko
                   ` (26 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Collapse the internal _rtw_free_network_nolock() helper function into
its only external caller, rtw_free_network_nolock().

The separation between these two functions served no architectural purpose
and only created unnecessary call overhead by extracting and passing the
mlmepriv pointer. Inlining the logic simplifies the BSS network freeing
path.

Clean up the internal function definition, remove its prototype from the
header file, and keep only the unified rtw_free_network_nolock() function.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c    | 26 +++++++++-----------
 drivers/staging/rtl8723bs/include/rtw_mlme.h |  2 +-
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 0ec599383..1450589aa 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -198,20 +198,6 @@ void _rtw_free_network(struct	mlme_priv *pmlmepriv, struct wlan_network *pnetwor
 	spin_unlock_bh(&free_queue->lock);
 }
 
-void _rtw_free_network_nolock(struct	mlme_priv *pmlmepriv, struct wlan_network *pnetwork)
-{
-	struct __queue *free_queue = &pmlmepriv->free_bss_pool;
-
-	if (!pnetwork)
-		return;
-
-	if (pnetwork->fixed)
-		return;
-
-	list_del_init(&pnetwork->list);
-
-	list_add_tail(&pnetwork->list, get_list_head(free_queue));
-}
 
 /*
  * return the wlan_network with the matching addr
@@ -300,7 +286,17 @@ u16 rtw_get_capability(struct wlan_bssid_ex *bss)
 
 void rtw_free_network_nolock(struct adapter *padapter, struct wlan_network *pnetwork)
 {
-	_rtw_free_network_nolock(&padapter->mlmepriv, pnetwork);
+	struct __queue *free_queue = &padapter->mlmepriv.free_bss_pool;
+
+	if (!pnetwork)
+		return;
+
+	if (pnetwork->fixed)
+		return;
+
+	list_del_init(&pnetwork->list);
+
+	list_add_tail(&pnetwork->list, get_list_head(free_queue));
 	rtw_cfg80211_unlink_bss(padapter, pnetwork);
 }
 
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h
index 23c46df90..f15dfcac0 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h
@@ -360,7 +360,6 @@ extern struct wlan_network *rtw_alloc_network(struct mlme_priv *pmlmepriv);
 
 
 extern void _rtw_free_network(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork, u8 isfreeall);
-extern void _rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork);
 
 
 extern struct wlan_network *_rtw_find_network(struct __queue *scanned_queue, u8 *addr);
@@ -395,4 +394,5 @@ int rtw_select_roaming_candidate(struct mlme_priv *pmlmepriv);
 void rtw_sta_media_status_rpt(struct adapter *adapter, struct sta_info *psta, u32 mstatus);
 void rtw_reset_securitypriv(struct adapter *adapter);
 
+void rtw_free_network_nolock(struct adapter *padapter, struct wlan_network *pnetwork);
 #endif /* __RTL871X_MLME_H_ */
-- 
2.55.0


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

* [PATCH 36/61] staging: rtl8723bs: remove rtw_wmm_event_callback and update handler
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (34 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 35/61] staging: rtl8723bs: inline _rtw_free_network_nolock into wrapper Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 37/61] staging: rtl8723bs: replace halbtc8723b1ant_SwMechanism with direct call Arsenii Pashchenko
                   ` (25 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Completely eliminate the rtw_wmm_event_callback() wrapper function.
Adapt the signature of WMMOnAssocRsp() to match the event dispatcher
prototype by adding an unused buffer pointer argument.

Update the other invocation site of WMMOnAssocRsp() to pass a NULL
argument, and register the handler directly in the wlanevents table.
This removes a useless indirection layer from the event handling path.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c        | 4 ----
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c    | 4 ++--
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c   | 2 +-
 drivers/staging/rtl8723bs/include/rtw_mlme.h     | 1 -
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 2 +-
 5 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 1450589aa..b57b665c2 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1483,10 +1483,6 @@ void rtw_cpwm_event_callback(struct adapter *padapter, u8 *pbuf)
 	cpwm_int_hdl(padapter, preportpwrstate);
 }
 
-void rtw_wmm_event_callback(struct adapter *padapter, u8 *pbuf)
-{
-	WMMOnAssocRsp(padapter);
-}
 
 /*
  * _rtw_join_timeout_handler - Timeout/failure handler for CMD JoinBss
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 25dfb20f3..62abfd896 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -4658,7 +4658,7 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res)
 	update_capinfo(padapter, pmlmeinfo->capability);
 
 	/* WMM, Update EDCA param */
-	WMMOnAssocRsp(padapter);
+	WMMOnAssocRsp(padapter, NULL);
 
 	/* HT */
 	HTOnAssocRsp(padapter);
@@ -5614,7 +5614,7 @@ static struct fwevent wlanevents[] = {
 	{0, NULL},
 	{0, &rtw_cpwm_event_callback},
 	{0, NULL},
-	{0, &rtw_wmm_event_callback},
+	{0, &WMMOnAssocRsp},
 
 };
 
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 1597fc33a..df5508ce5 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -683,7 +683,7 @@ static void sort_wmm_ac_params(u32 *inx, u32 *edca)
 	}
 }
 
-void WMMOnAssocRsp(struct adapter *padapter)
+void WMMOnAssocRsp(struct adapter *padapter, u8 *pbuf)
 {
 	u8 ACI, ACM, AIFS, ECWMin, ECWMax, aSifsTime;
 	u8 acm_mask;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h
index f15dfcac0..973688bef 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h
@@ -264,7 +264,6 @@ extern void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf);
 extern void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf);
 extern void rtw_atimdone_event_callback(struct adapter *adapter, u8 *pbuf);
 extern void rtw_cpwm_event_callback(struct adapter *adapter, u8 *pbuf);
-extern void rtw_wmm_event_callback(struct adapter *padapter, u8 *pbuf);
 
 extern void rtw_join_timeout_handler(struct timer_list *t);
 extern void _rtw_scan_timeout_handler(struct timer_list *t);
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index b12128963..3d1126740 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -478,7 +478,7 @@ int is_IBSS_empty(struct adapter *padapter);
 unsigned char check_assoc_AP(u8 *pframe, uint len);
 
 int WMM_param_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE);
-void WMMOnAssocRsp(struct adapter *padapter);
+void WMMOnAssocRsp(struct adapter *padapter, u8 *pbuf);
 
 void HT_caps_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE);
 void HT_info_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE);
-- 
2.55.0


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

* [PATCH 37/61] staging: rtl8723bs: replace halbtc8723b1ant_SwMechanism with direct call
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (35 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 36/61] staging: rtl8723bs: remove rtw_wmm_event_callback and update handler Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 38/61] staging: rtl8723bs: remove redundant ternary operators from bool returns Arsenii Pashchenko
                   ` (24 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the redundant halbtc8723b1ant_SwMechanism() wrapper function
from the Bluetooth coexistence code.

The helper provides no extra logic, serving only to pass the arguments
along with a fixed NORMAL_EXEC state flag to the underlying function
halbtc8723b1ant_LowPenaltyRa(). Removing it simplifies the driver's
coexistence mechanism path and eliminates unnecessary indirection.

Clean up the function definition, remove its prototype from the header
file, and update all call sites to invoke halbtc8723b1ant_LowPenaltyRa
directly.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 .../staging/rtl8723bs/hal/HalBtc8723b1Ant.c   | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
index 0613beaa3..522e4dd4c 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
@@ -755,12 +755,6 @@ static void halbtc8723b1ant_LpsRpwm(
 	pCoexDm->preRpwm = pCoexDm->curRpwm;
 }
 
-static void halbtc8723b1ant_SwMechanism(
-	struct btc_coexist *pBtCoexist, bool bLowPenaltyRA
-)
-{
-	halbtc8723b1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA);
-}
 
 static void halbtc8723b1ant_SetAntPath(
 	struct btc_coexist *pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff
@@ -1271,35 +1265,32 @@ static bool halbtc8723b1ant_IsCommonAction(struct btc_coexist *pBtCoexist)
 		!bWifiConnected &&
 		pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE
 	) {
-		/* halbtc8723b1ant_SwMechanism(pBtCoexist, false); */
 
 		bCommon = true;
 	} else if (
 		bWifiConnected &&
 		(pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE)
 	) {
-		/* halbtc8723b1ant_SwMechanism(pBtCoexist, false); */
 
 		bCommon = true;
 	} else if (
 		!bWifiConnected &&
 		(pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE)
 	) {
-		/* halbtc8723b1ant_SwMechanism(pBtCoexist, false); */
 
 		bCommon = true;
 	} else if (
 		bWifiConnected &&
 		(pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE)
 	) {
-		/* halbtc8723b1ant_SwMechanism(pBtCoexist, false); */
+
 
 		bCommon = true;
 	} else if (
 		!bWifiConnected &&
 		(pCoexDm->btStatus != BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE)
 	) {
-		/* halbtc8723b1ant_SwMechanism(pBtCoexist, false); */
+
 
 		bCommon = true;
 	} else {
@@ -1975,14 +1966,14 @@ static void halbtc8723b1ant_RunCoexistMechanism(struct btc_coexist *pBtCoexist)
 		else
 			halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, false, true, 0x8);
 
-		halbtc8723b1ant_SwMechanism(pBtCoexist, true);
+		halbtc8723b1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, true);
 		halbtc8723b1ant_RunSwCoexistMechanism(pBtCoexist);  /* just print debug message */
 	} else {
 		halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0);
 
 		halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, false, false, 0x5);
 
-		halbtc8723b1ant_SwMechanism(pBtCoexist, false);
+		halbtc8723b1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, false);
 		halbtc8723b1ant_RunSwCoexistMechanism(pBtCoexist); /* just print debug message */
 	}
 
@@ -2019,7 +2010,7 @@ static void halbtc8723b1ant_InitCoexDm(struct btc_coexist *pBtCoexist)
 	/*  force to reset coex mechanism */
 
 	/*  sw all off */
-	halbtc8723b1ant_SwMechanism(pBtCoexist, false);
+	halbtc8723b1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, false);
 
 	/* halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, false, 8); */
 	halbtc8723b1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0);
-- 
2.55.0


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

* [PATCH 38/61] staging: rtl8723bs: remove redundant ternary operators from bool returns
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (36 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 37/61] staging: rtl8723bs: replace halbtc8723b1ant_SwMechanism with direct call Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 39/61] staging: rtl8723bs: remove redundant DM wrapper Arsenii Pashchenko
                   ` (23 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Purge all implicit and redundant ternary operator expressions of the form
'(condition) ? true : false' or comparisons with zero from logical return
statements across the driver.

Expressions like '(atomic_read(...) != 0) ? true : false' add useless
visual clutter and unnecessary branching, since the underlying comparison
or atomic read already naturally evaluates to a boolean truth value in C.

Replace these verbose patterns with direct return statements to streamline
the code, maximize readability, and match standard kernel coding style.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c         |  6 +++---
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c    |  2 +-
 drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h   |  2 +-
 drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h      | 11 ++++++++---
 drivers/staging/rtl8723bs/hal/hal_com.c           |  2 +-
 drivers/staging/rtl8723bs/hal/odm_HWConfig.c      |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c |  4 ++--
 drivers/staging/rtl8723bs/hal/sdio_halinit.c      |  4 ++--
 drivers/staging/rtl8723bs/include/ieee80211.h     |  6 +++---
 drivers/staging/rtl8723bs/include/rtw_pwrctrl.h   |  2 +-
 drivers/staging/rtl8723bs/os_dep/osdep_service.c  |  4 ++--
 11 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index b57b665c2..7e5f73707 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1629,7 +1629,7 @@ inline bool rtw_is_scan_deny(struct adapter *adapter)
 {
 	struct mlme_priv *mlmepriv = &adapter->mlmepriv;
 
-	return (atomic_read(&mlmepriv->set_scan_deny) != 0) ? true : false;
+	return atomic_read(&mlmepriv->set_scan_deny);
 }
 
 inline void rtw_clear_scan_deny(struct adapter *adapter)
@@ -2197,8 +2197,8 @@ void rtw_ht_use_default_setting(struct adapter *padapter)
 	else
 		phtpriv->bss_coexist = 0;
 
-	phtpriv->sgi_40m = TEST_FLAG(pregistrypriv->short_gi, BIT(1)) ? true : false;
-	phtpriv->sgi_20m = TEST_FLAG(pregistrypriv->short_gi, BIT(0)) ? true : false;
+	phtpriv->sgi_40m = TEST_FLAG(pregistrypriv->short_gi, BIT(1));
+	phtpriv->sgi_20m = TEST_FLAG(pregistrypriv->short_gi, BIT(0));
 
 	/*  LDPC support */
 	rtw_hal_get_def_var(padapter, HAL_DEF_RX_LDPC, (u8 *)&bHwLDPCSupport);
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index df5508ce5..d833c5e3a 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -476,7 +476,7 @@ static bool _rtw_camid_is_gk(struct adapter *adapter, u8 cam_id)
 	if (!(cam_ctl->bitmap & BIT(cam_id)))
 		goto exit;
 
-	ret = (dvobj->cam_cache[cam_id].ctrl & BIT(6)) ? true : false;
+	ret = dvobj->cam_cache[cam_id].ctrl & BIT(6);
 
 exit:
 	return ret;
diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h
index 7a12d92da..f39c93ac7 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h
@@ -15,7 +15,7 @@
 #define	BT_INFO_8723B_1ANT_B_CONNECTION		BIT(0)
 
 #define	BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_)	\
-		(((_BT_INFO_EXT_ & BIT(0))) ? true : false)
+		(((_BT_INFO_EXT_ & BIT(0))))
 
 #define	BTC_RSSI_COEX_THRESH_TOL_8723B_1ANT 2
 
diff --git a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
index 36b0f429d..0002b822a 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
+++ b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
@@ -93,9 +93,14 @@ enum {
 	BTC_RSSI_STATE_STAY_LOW			= 0x5,
 	BTC_RSSI_MAX
 };
-#define BTC_RSSI_HIGH(_rssi_)	((_rssi_ == BTC_RSSI_STATE_HIGH || _rssi_ == BTC_RSSI_STATE_STAY_HIGH) ? true : false)
-#define BTC_RSSI_MEDIUM(_rssi_)	((_rssi_ == BTC_RSSI_STATE_MEDIUM || _rssi_ == BTC_RSSI_STATE_STAY_MEDIUM) ? true : false)
-#define BTC_RSSI_LOW(_rssi_)	((_rssi_ == BTC_RSSI_STATE_LOW || _rssi_ == BTC_RSSI_STATE_STAY_LOW) ? true : false)
+#define BTC_RSSI_HIGH(_rssi_) \
+	((_rssi_) == BTC_RSSI_STATE_HIGH || (_rssi_) == BTC_RSSI_STATE_STAY_HIGH)
+
+#define BTC_RSSI_MEDIUM(_rssi_) \
+	((_rssi_) == BTC_RSSI_STATE_MEDIUM || (_rssi_) == BTC_RSSI_STATE_STAY_MEDIUM)
+
+#define BTC_RSSI_LOW(_rssi_) \
+	((_rssi_) == BTC_RSSI_STATE_LOW || (_rssi_) == BTC_RSSI_STATE_STAY_LOW)
 
 enum {
 	BTC_WIFI_BW_LEGACY			= 0x0,
diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c
index 634af4657..77b189efa 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com.c
@@ -396,7 +396,7 @@ bool Hal_MappingOutPipe(struct adapter *padapter, u8 NumOutPipe)
 {
 	struct registry_priv *pregistrypriv = &padapter->registrypriv;
 
-	bool bWIFICfg = (pregistrypriv->wifi_spec) ? true : false;
+	bool bWIFICfg = pregistrypriv->wifi_spec;
 
 	bool result = true;
 
diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c
index c88d669cb..5b374eea0 100644
--- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c
+++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c
@@ -268,7 +268,7 @@ static void odm_Process_RSSIForDM(
 	if (pPktinfo->is_beacon)
 		pDM_Odm->PhyDbgInfo.NumQryBeaconPkt++;
 
-	isCCKrate = ((pPktinfo->data_rate <= DESC_RATE11M)) ? true : false;
+	isCCKrate = pPktinfo->data_rate <= DESC_RATE11M;
 	pDM_Odm->RxRate = pPktinfo->data_rate;
 
 	/* Statistic for antenna/path diversity------------------ */
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index 53f6cd708..7ddc75e65 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -2751,7 +2751,7 @@ void GetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val)
 		{
 			/*  BCN_VALID, BIT16 of REG_TDECTRL = BIT0 of REG_TDECTRL+2 */
 			val8 = rtw_read8(padapter, REG_TDECTRL+2);
-			*val = (BIT(0) & val8) ? true : false;
+			*val = BIT(0) & val8;
 		}
 		break;
 
@@ -2805,7 +2805,7 @@ void GetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val)
 		break;
 	case HW_VAR_CHK_HI_QUEUE_EMPTY:
 		val16 = rtw_read16(padapter, REG_TXPKT_EMPTY);
-		*val = (val16 & BIT(10)) ? true : false;
+		*val = val16 & BIT(10);
 		break;
 	default:
 		GetHwReg(padapter, variable, val);
diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
index ed9b8fb07..767db342c 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
@@ -1032,8 +1032,8 @@ static void _ReadPROMContent(struct adapter *padapter)
 
 	eeValue = rtw_read8(padapter, REG_9346CR);
 	/*  To check system boot selection. */
-	pEEPROM->EepromOrEfuse = (eeValue & BOOT_FROM_EEPROM) ? true : false;
-	pEEPROM->bautoload_fail_flag = (eeValue & EEPROM_EN) ? false : true;
+	pEEPROM->EepromOrEfuse = eeValue & BOOT_FROM_EEPROM;
+	pEEPROM->bautoload_fail_flag = eeValue & EEPROM_EN;
 
 	_ReadEfuseInfo8723BS(padapter);
 }
diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h
index 39ee139f1..3363c6496 100644
--- a/drivers/staging/rtl8723bs/include/ieee80211.h
+++ b/drivers/staging/rtl8723bs/include/ieee80211.h
@@ -155,10 +155,10 @@ enum network_type {
 
 #define is_legacy_only(net_type)  ((net_type) == ((net_type) & (WIRELESS_11BG)))
 
-#define is_supported_24g(net_type) ((net_type) & SUPPORTED_24G_NETTYPE_MSK ? true : false)
+#define is_supported_24g(net_type) ((net_type) & SUPPORTED_24G_NETTYPE_MSK)
 
-#define is_supported_tx_cck(net_type) (((net_type) & (WIRELESS_11B)) ? true : false)
-#define is_supported_ht(net_type) (((net_type) & (WIRELESS_11_24N)) ? true : false)
+#define is_supported_tx_cck(net_type) (((net_type) & (WIRELESS_11B)))
+#define is_supported_ht(net_type) (((net_type) & (WIRELESS_11_24N)))
 
 struct ieee_param {
 	u32 cmd;
diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
index 9b6c42e4f..bcf141274 100644
--- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
@@ -80,7 +80,7 @@ enum rt_rf_power_state {
 #define	RT_RF_LPS_DISALBE_2R			BIT(30)	/*  When LPS is on, disable 2R if no packet is received or transmitted. */
 #define	RT_RF_LPS_LEVEL_ASPM			BIT(31)	/*  LPS with ASPM */
 
-#define	RT_IN_PS_LEVEL(ppsc, _PS_FLAG)		((ppsc->cur_ps_level & _PS_FLAG) ? true : false)
+#define	RT_IN_PS_LEVEL(ppsc, _PS_FLAG)		((ppsc->cur_ps_level & _PS_FLAG))
 #define	RT_CLEAR_PS_LEVEL(ppsc, _PS_FLAG)	(ppsc->cur_ps_level &= (~(_PS_FLAG)))
 #define	RT_SET_PS_LEVEL(ppsc, _PS_FLAG)		(ppsc->cur_ps_level |= _PS_FLAG)
 
diff --git a/drivers/staging/rtl8723bs/os_dep/osdep_service.c b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
index 4cfdf7c62..214c1fd9b 100644
--- a/drivers/staging/rtl8723bs/os_dep/osdep_service.c
+++ b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
@@ -130,7 +130,7 @@ void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len)
  */
 inline bool rtw_cbuf_full(struct rtw_cbuf *cbuf)
 {
-	return (cbuf->write == cbuf->read - 1) ? true : false;
+	return cbuf->write == cbuf->read - 1;
 }
 
 /**
@@ -141,7 +141,7 @@ inline bool rtw_cbuf_full(struct rtw_cbuf *cbuf)
  */
 inline bool rtw_cbuf_empty(struct rtw_cbuf *cbuf)
 {
-	return (cbuf->write == cbuf->read) ? true : false;
+	return cbuf->write == cbuf->read;
 }
 
 /**
-- 
2.55.0


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

* [PATCH 39/61] staging: rtl8723bs: remove redundant DM wrapper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (37 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 38/61] staging: rtl8723bs: remove redundant ternary operators from bool returns Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 40/61] staging: rtl8723bs: remove EXhalbtc8723b2ant_InitHwConfig Arsenii Pashchenko
                   ` (22 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the useless external wrapper function
EXhalbtc8723b2ant_InitCoexDm and call the internal
halbtc8723b2ant_InitCoexDm directly. This cleans up the driver
code and cuts down on redundant layer calls.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 5 +----
 drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h | 1 -
 drivers/staging/rtl8723bs/hal/hal_btcoex.c      | 2 +-
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
index 6da6940c9..f1d8e01bb 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
@@ -2378,10 +2378,7 @@ void EXhalbtc8723b2ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bWifiOn
 	halbtc8723b2ant_InitHwConfig(pBtCoexist, true);
 }
 
-void EXhalbtc8723b2ant_InitCoexDm(struct btc_coexist *pBtCoexist)
-{
-	halbtc8723b2ant_InitCoexDm(pBtCoexist);
-}
+
 
 void EXhalbtc8723b2ant_IpsNotify(struct btc_coexist *pBtCoexist, u8 type)
 {
diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h
index ebc47f65e..b0e24c69d 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h
@@ -131,7 +131,6 @@ struct coex_sta_8723b_2ant {
 /*  */
 void EXhalbtc8723b2ant_PowerOnSetting(struct btc_coexist *pBtCoexist);
 void EXhalbtc8723b2ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bWifiOnly);
-void EXhalbtc8723b2ant_InitCoexDm(struct btc_coexist *pBtCoexist);
 void EXhalbtc8723b2ant_IpsNotify(struct btc_coexist *pBtCoexist, u8 type);
 void EXhalbtc8723b2ant_LpsNotify(struct btc_coexist *pBtCoexist, u8 type);
 void EXhalbtc8723b2ant_ScanNotify(struct btc_coexist *pBtCoexist, u8 type);
diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
index c66ca6f73..a975e3393 100644
--- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c
+++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
@@ -846,7 +846,7 @@ void EXhalbtcoutsrc_InitCoexDm(struct btc_coexist *pBtCoexist)
 	pBtCoexist->statistics.cntInitCoexDm++;
 
 	if (pBtCoexist->boardInfo.btdmAntNum == 2)
-		EXhalbtc8723b2ant_InitCoexDm(pBtCoexist);
+		halbtc8723b2ant_InitCoexDm(pBtCoexist);
 	else if (pBtCoexist->boardInfo.btdmAntNum == 1)
 		EXhalbtc8723b1ant_InitCoexDm(pBtCoexist);
 
-- 
2.55.0


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

* [PATCH 40/61] staging: rtl8723bs: remove EXhalbtc8723b2ant_InitHwConfig
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (38 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 39/61] staging: rtl8723bs: remove redundant DM wrapper Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 41/61] staging: rtl8723bs: remove EXhalbtc8723b1ant_InitHwConfig Arsenii Pashchenko
                   ` (21 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the useless external wrapper function
EXhalbtc8723b2ant_InitHwConfig. Call the internal function
halbtc8723b2ant_InitHwConfig directly with a hardcoded true
argument to match the original behavior and clean up the code.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 11 ++++-------
 drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h |  3 ++-
 drivers/staging/rtl8723bs/hal/hal_btcoex.c      |  2 +-
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
index f1d8e01bb..efb0ffd54 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
@@ -2289,7 +2289,7 @@ static void halbtc8723b2ant_WifiOffHwCfg(struct btc_coexist *pBtCoexist)
 		pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); /* BT select s0/s1 is controlled by WiFi */
 }
 
-static void halbtc8723b2ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bBackUp)
+void halbtc8723b2ant_InitHwConfig(struct btc_coexist *pBtCoexist)
 {
 	u8 u1Tmp = 0;
 
@@ -2373,10 +2373,7 @@ void EXhalbtc8723b2ant_PowerOnSetting(struct btc_coexist *pBtCoexist)
 	}
 }
 
-void EXhalbtc8723b2ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bWifiOnly)
-{
-	halbtc8723b2ant_InitHwConfig(pBtCoexist, true);
-}
+
 
 
 
@@ -2389,7 +2386,7 @@ void EXhalbtc8723b2ant_IpsNotify(struct btc_coexist *pBtCoexist, u8 type)
 		halbtc8723b2ant_CoexAllOff(pBtCoexist);
 	} else if (type == BTC_IPS_LEAVE) {
 		pCoexSta->bUnderIps = false;
-		halbtc8723b2ant_InitHwConfig(pBtCoexist, false);
+		halbtc8723b2ant_InitHwConfig(pBtCoexist);
 		halbtc8723b2ant_InitCoexDm(pBtCoexist);
 		halbtc8723b2ant_QueryBtInfo(pBtCoexist);
 	}
@@ -2596,7 +2593,7 @@ void EXhalbtc8723b2ant_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState)
 {
 	if (pnpState == BTC_WIFI_PNP_SLEEP) {
 	} else if (pnpState == BTC_WIFI_PNP_WAKE_UP) {
-		halbtc8723b2ant_InitHwConfig(pBtCoexist, false);
+		halbtc8723b2ant_InitHwConfig(pBtCoexist);
 		halbtc8723b2ant_InitCoexDm(pBtCoexist);
 		halbtc8723b2ant_QueryBtInfo(pBtCoexist);
 	}
diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h
index b0e24c69d..4043e4e4d 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h
@@ -130,7 +130,6 @@ struct coex_sta_8723b_2ant {
 /*  The following is interface which will notify coex module. */
 /*  */
 void EXhalbtc8723b2ant_PowerOnSetting(struct btc_coexist *pBtCoexist);
-void EXhalbtc8723b2ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bWifiOnly);
 void EXhalbtc8723b2ant_IpsNotify(struct btc_coexist *pBtCoexist, u8 type);
 void EXhalbtc8723b2ant_LpsNotify(struct btc_coexist *pBtCoexist, u8 type);
 void EXhalbtc8723b2ant_ScanNotify(struct btc_coexist *pBtCoexist, u8 type);
@@ -143,3 +142,5 @@ void EXhalbtc8723b2ant_BtInfoNotify(
 void EXhalbtc8723b2ant_HaltNotify(struct btc_coexist *pBtCoexist);
 void EXhalbtc8723b2ant_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState);
 void EXhalbtc8723b2ant_Periodical(struct btc_coexist *pBtCoexist);
+
+void halbtc8723b2ant_InitHwConfig(struct btc_coexist *pBtCoexist);
diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
index a975e3393..c2d355ef1 100644
--- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c
+++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
@@ -833,7 +833,7 @@ void EXhalbtcoutsrc_InitHwConfig(struct btc_coexist *pBtCoexist, u8 bWifiOnly)
 	pBtCoexist->statistics.cntInitHwConfig++;
 
 	if (pBtCoexist->boardInfo.btdmAntNum == 2)
-		EXhalbtc8723b2ant_InitHwConfig(pBtCoexist, bWifiOnly);
+		halbtc8723b2ant_InitHwConfig(pBtCoexist);
 	else if (pBtCoexist->boardInfo.btdmAntNum == 1)
 		EXhalbtc8723b1ant_InitHwConfig(pBtCoexist, bWifiOnly);
 }
-- 
2.55.0


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

* [PATCH 41/61] staging: rtl8723bs: remove EXhalbtc8723b1ant_InitHwConfig
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (39 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 40/61] staging: rtl8723bs: remove EXhalbtc8723b2ant_InitHwConfig Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 42/61] staging: rtl8723bs: remove ConfigureTxpowerTrack wrapper Arsenii Pashchenko
                   ` (20 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the useless external wrapper function
EXhalbtc8723b1ant_InitHwConfig. Call the internal function
halbtc8723b1ant_InitHwConfig directly, passing true as the second
argument to preserve the original behavior and clean up the code.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 6 +-----
 drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h | 3 ++-
 drivers/staging/rtl8723bs/hal/hal_btcoex.c      | 2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
index 522e4dd4c..0fde1654a 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
@@ -2018,7 +2018,7 @@ static void halbtc8723b1ant_InitCoexDm(struct btc_coexist *pBtCoexist)
 	pCoexSta->popEventCnt = 0;
 }
 
-static void halbtc8723b1ant_InitHwConfig(
+void halbtc8723b1ant_InitHwConfig(
 	struct btc_coexist *pBtCoexist,
 	bool bBackUp,
 	bool bWifiOnly
@@ -2107,10 +2107,6 @@ void EXhalbtc8723b1ant_PowerOnSetting(struct btc_coexist *pBtCoexist)
 	}
 }
 
-void EXhalbtc8723b1ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bWifiOnly)
-{
-	halbtc8723b1ant_InitHwConfig(pBtCoexist, true, bWifiOnly);
-}
 
 void EXhalbtc8723b1ant_InitCoexDm(struct btc_coexist *pBtCoexist)
 {
diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h
index f39c93ac7..8180b6071 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.h
@@ -168,7 +168,6 @@ struct coex_sta_8723b_1ant {
 /*  The following is interface which will notify coex module. */
 /*  */
 void EXhalbtc8723b1ant_PowerOnSetting(struct btc_coexist *pBtCoexist);
-void EXhalbtc8723b1ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bWifiOnly);
 void EXhalbtc8723b1ant_InitCoexDm(struct btc_coexist *pBtCoexist);
 void EXhalbtc8723b1ant_IpsNotify(struct btc_coexist *pBtCoexist, u8 type);
 void EXhalbtc8723b1ant_LpsNotify(struct btc_coexist *pBtCoexist, u8 type);
@@ -182,3 +181,5 @@ void EXhalbtc8723b1ant_BtInfoNotify(
 void EXhalbtc8723b1ant_HaltNotify(struct btc_coexist *pBtCoexist);
 void EXhalbtc8723b1ant_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState);
 void EXhalbtc8723b1ant_Periodical(struct btc_coexist *pBtCoexist);
+
+void halbtc8723b1ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bBackUp,	bool bWifiOnly);
diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
index c2d355ef1..5a3aa9b16 100644
--- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c
+++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
@@ -835,7 +835,7 @@ void EXhalbtcoutsrc_InitHwConfig(struct btc_coexist *pBtCoexist, u8 bWifiOnly)
 	if (pBtCoexist->boardInfo.btdmAntNum == 2)
 		halbtc8723b2ant_InitHwConfig(pBtCoexist);
 	else if (pBtCoexist->boardInfo.btdmAntNum == 1)
-		EXhalbtc8723b1ant_InitHwConfig(pBtCoexist, bWifiOnly);
+		halbtc8723b1ant_InitHwConfig(pBtCoexist, true, bWifiOnly);
 }
 
 void EXhalbtcoutsrc_InitCoexDm(struct btc_coexist *pBtCoexist)
-- 
2.55.0


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

* [PATCH 42/61] staging: rtl8723bs: remove ConfigureTxpowerTrack wrapper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (40 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 41/61] staging: rtl8723bs: remove EXhalbtc8723b1ant_InitHwConfig Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 43/61] staging: rtl8723bs: remove hal_init_macaddr wrapper Arsenii Pashchenko
                   ` (19 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the useless external wrapper function ConfigureTxpowerTrack.
Call ConfigureTxpowerTrack_8723B directly instead. This eliminates
the unused pDM_Odm argument and cleans up the driver code

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/HalPhyRf.c | 7 ++-----
 drivers/staging/rtl8723bs/hal/HalPhyRf.h | 1 -
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf.c b/drivers/staging/rtl8723bs/hal/HalPhyRf.c
index 9e4d42e3a..14b4ac979 100644
--- a/drivers/staging/rtl8723bs/hal/HalPhyRf.c
+++ b/drivers/staging/rtl8723bs/hal/HalPhyRf.c
@@ -8,10 +8,7 @@
 /* include "Mp_Precomp.h" */
 #include "odm_precomp.h"
 
-void ConfigureTxpowerTrack(struct dm_odm_t *pDM_Odm, struct txpwrtrack_cfg *pConfig)
-{
-	ConfigureTxpowerTrack_8723B(pConfig);
-}
+
 
 /*  */
 /*  <20121113, Kordan> This function should be called when TxAGC changed. */
@@ -78,7 +75,7 @@ void ODM_TXPowerTrackingCallback_ThermalMeter(struct adapter *Adapter)
 
 	/* 4 2. Initialization (7 steps in total) */
 
-	ConfigureTxpowerTrack(pDM_Odm, &c);
+	ConfigureTxpowerTrack_8723B(&c);
 
 	(*c.GetDeltaSwingTable)(
 		pDM_Odm,
diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf.h b/drivers/staging/rtl8723bs/hal/HalPhyRf.h
index bd9430db9..3d098ce34 100644
--- a/drivers/staging/rtl8723bs/hal/HalPhyRf.h
+++ b/drivers/staging/rtl8723bs/hal/HalPhyRf.h
@@ -30,7 +30,6 @@ struct txpwrtrack_cfg {
 	FuncSwing GetDeltaSwingTable;
 };
 
-void ConfigureTxpowerTrack(struct dm_odm_t *pDM_Odm, struct txpwrtrack_cfg *pConfig);
 
 void ODM_ClearTxPowerTrackingState(struct dm_odm_t *pDM_Odm);
 
-- 
2.55.0


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

* [PATCH 43/61] staging: rtl8723bs: remove hal_init_macaddr wrapper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (41 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 42/61] staging: rtl8723bs: remove ConfigureTxpowerTrack wrapper Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 44/61] staging: rtl8723bs: remove rtw_init_hal_com_default_value Arsenii Pashchenko
                   ` (18 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the thin wrapper function hal_init_macaddr. Call the underlying
rtw_hal_set_hwreg function directly with the HW_VAR_MAC_ADDR register
argument to eliminate an unnecessary call layer.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_com.c      | 4 ----
 drivers/staging/rtl8723bs/hal/sdio_halinit.c | 2 +-
 drivers/staging/rtl8723bs/include/hal_com.h  | 2 +-
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c
index 77b189efa..ca0f7d7ec 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com.c
@@ -420,10 +420,6 @@ bool Hal_MappingOutPipe(struct adapter *padapter, u8 NumOutPipe)
 
 }
 
-void hal_init_macaddr(struct adapter *adapter)
-{
-	rtw_hal_set_hwreg(adapter, HW_VAR_MAC_ADDR, adapter->eeprompriv.mac_addr);
-}
 
 void rtw_init_hal_com_default_value(struct adapter *Adapter)
 {
diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
index 767db342c..731ca9276 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
@@ -688,7 +688,7 @@ u32 rtl8723bs_hal_init(struct adapter *padapter)
 
 	/*  Get Rx PHY status in order to report RSSI and others. */
 	_InitDriverInfoSize(padapter, DRVINFO_SZ);
-	hal_init_macaddr(padapter);
+	rtw_hal_set_hwreg(padapter, HW_VAR_MAC_ADDR, padapter->eeprompriv.mac_addr);
 	_InitNetworkType(padapter);
 	_InitWMACSetting(padapter);
 	_InitAdaptiveCtrl(padapter);
diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h
index 7bbf62cfd..a52d8318d 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -121,7 +121,7 @@ struct adapter *padapter,
 u8 NumOutPipe
 	);
 
-void hal_init_macaddr(struct adapter *adapter);
+
 
 void rtw_init_hal_com_default_value(struct adapter *Adapter);
 
-- 
2.55.0


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

* [PATCH 44/61] staging: rtl8723bs: remove rtw_init_hal_com_default_value
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (42 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 43/61] staging: rtl8723bs: remove hal_init_macaddr wrapper Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 45/61] staging: rtl8723bs: remove c2h_evt_clear wrapper Arsenii Pashchenko
                   ` (17 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the single-line function rtw_init_hal_com_default_value.
Move the AntDetection initialization directly to the main HAL
setup phase to avoid an unnecessary function call layer.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_com.c     | 8 --------
 drivers/staging/rtl8723bs/include/hal_com.h | 1 -
 drivers/staging/rtl8723bs/os_dep/os_intfs.c | 7 +++++--
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c
index ca0f7d7ec..638d598e4 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com.c
@@ -420,14 +420,6 @@ bool Hal_MappingOutPipe(struct adapter *padapter, u8 NumOutPipe)
 
 }
 
-
-void rtw_init_hal_com_default_value(struct adapter *Adapter)
-{
-	struct hal_com_data *pHalData = GET_HAL_DATA(Adapter);
-
-	pHalData->AntDetection = 1;
-}
-
 /*
  * C2H event format:
  * Field	 TRIGGER		CONTENT	   CMD_SEQ	CMD_LEN		 CMD_ID
diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h
index a52d8318d..e6d32cf53 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -123,7 +123,6 @@ u8 NumOutPipe
 
 
 
-void rtw_init_hal_com_default_value(struct adapter *Adapter);
 
 void c2h_evt_clear(struct adapter *adapter);
 s32 c2h_evt_read_88xx(struct adapter *adapter, u8 *buf);
diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index f31196f54..295da8c23 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -640,7 +640,10 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
 
 	rtw_init_default_value(padapter);
 
-	rtw_init_hal_com_default_value(padapter);
+	struct hal_com_data *pHalData = GET_HAL_DATA(padapter);
+
+	pHalData->AntDetection = 1;
+
 
 	if (rtw_init_cmd_priv(&padapter->cmdpriv))
 		return _FAIL;
@@ -665,7 +668,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
 	spin_lock_init(&padapter->security_key_mutex);
 
 	/*  We don't need to memset padapter->XXX to zero, because adapter is allocated by vzalloc(). */
-	/* memset((unsigned char *)&padapter->securitypriv, 0, sizeof (struct security_priv)); */
+	/* memset((u8 *)&padapter->securitypriv, 0, sizeof (struct security_priv)); */
 
 	if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL)
 		goto free_recv_priv;
-- 
2.55.0


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

* [PATCH 45/61] staging: rtl8723bs: remove c2h_evt_clear wrapper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (43 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 44/61] staging: rtl8723bs: remove rtw_init_hal_com_default_value Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 46/61] staging: rtl8723bs: remove rtw_get_mgntframe_raid helper Arsenii Pashchenko
                   ` (16 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the single-line helper function c2h_evt_clear. Call rtw_write8
directly with REG_C2HEVT_CLEAR and C2H_EVT_HOST_CLOSE arguments
instead to eliminate an unnecessary function call layer.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c    |  2 +-
 drivers/staging/rtl8723bs/hal/hal_com.c     | 12 +-----------
 drivers/staging/rtl8723bs/include/hal_com.h |  1 -
 3 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 01f8b378e..c2944a1c7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1694,7 +1694,7 @@ static void c2h_wk_callback(struct work_struct *work)
 		c2h_evt = (u8 *)rtw_cbuf_pop(evtpriv->c2h_queue);
 		if (c2h_evt) {
 			/* This C2H event is read, clear it */
-			c2h_evt_clear(adapter);
+			rtw_write8(adapter, REG_C2HEVT_CLEAR, C2H_EVT_HOST_CLOSE);
 		} else {
 			c2h_evt = kmalloc(16, GFP_ATOMIC);
 			if (c2h_evt) {
diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c
index 638d598e4..b357c5145 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com.c
@@ -420,16 +420,6 @@ bool Hal_MappingOutPipe(struct adapter *padapter, u8 NumOutPipe)
 
 }
 
-/*
- * C2H event format:
- * Field	 TRIGGER		CONTENT	   CMD_SEQ	CMD_LEN		 CMD_ID
- * BITS	 [127:120]	[119:16]      [15:8]		  [7:4]		   [3:0]
- */
-
-void c2h_evt_clear(struct adapter *adapter)
-{
-	rtw_write8(adapter, REG_C2HEVT_CLEAR, C2H_EVT_HOST_CLOSE);
-}
 
 /*
  * C2H event format:
@@ -472,7 +462,7 @@ s32 c2h_evt_read_88xx(struct adapter *adapter, u8 *buf)
 	 * Clear event to notify FW we have read the command.
 	 * If this field isn't clear, the FW won't update the next command message.
 	 */
-	c2h_evt_clear(adapter);
+	rtw_write8(adapter, REG_C2HEVT_CLEAR, C2H_EVT_HOST_CLOSE);
 exit:
 	return ret;
 }
diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h
index e6d32cf53..0a43655f7 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -124,7 +124,6 @@ u8 NumOutPipe
 
 
 
-void c2h_evt_clear(struct adapter *adapter);
 s32 c2h_evt_read_88xx(struct adapter *adapter, u8 *buf);
 
 u8 rtw_get_mgntframe_raid(struct adapter *adapter, unsigned char network_type);
-- 
2.55.0


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

* [PATCH 46/61] staging: rtl8723bs: remove rtw_get_mgntframe_raid helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (44 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 45/61] staging: rtl8723bs: remove c2h_evt_clear wrapper Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 47/61] staging: rtl8723bs: clean up phy power conversion function Arsenii Pashchenko
                   ` (15 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the tiny helper function rtw_get_mgntframe_raid. Inline the
ternary operator check directly into the callers to simplify the
driver architecture and avoid unnecessary call overhead.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 +-
 drivers/staging/rtl8723bs/hal/hal_com.c       | 4 ----
 drivers/staging/rtl8723bs/include/hal_com.h   | 1 -
 3 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 62abfd896..0cc6887bb 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1897,7 +1897,7 @@ void update_mgntframe_attrib(struct adapter *padapter, struct pkt_attrib *pattri
 		wireless_mode = WIRELESS_11B;
 	else
 		wireless_mode = WIRELESS_11G;
-	pattrib->raid =  rtw_get_mgntframe_raid(padapter, wireless_mode);
+	pattrib->raid = (wireless_mode & WIRELESS_11B) ? RATEID_IDX_B : RATEID_IDX_G;
 	pattrib->rate = pmlmeext->tx_rate;
 
 	pattrib->encrypt = _NO_PRIVACY_;
diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c
index b357c5145..0a0b41ebe 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com.c
@@ -467,10 +467,6 @@ s32 c2h_evt_read_88xx(struct adapter *adapter, u8 *buf)
 	return ret;
 }
 
-u8 rtw_get_mgntframe_raid(struct adapter *adapter, unsigned char network_type)
-{
-	return (network_type & WIRELESS_11B) ? RATEID_IDX_B : RATEID_IDX_G;
-}
 
 void rtw_hal_update_sta_rate_mask(struct adapter *padapter, struct sta_info *psta)
 {
diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h
index 0a43655f7..962ba3aaa 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -126,7 +126,6 @@ u8 NumOutPipe
 
 s32 c2h_evt_read_88xx(struct adapter *adapter, u8 *buf);
 
-u8 rtw_get_mgntframe_raid(struct adapter *adapter, unsigned char network_type);
 void rtw_hal_update_sta_rate_mask(struct adapter *padapter, struct sta_info *psta);
 
 void SetHwReg(struct adapter *padapter, u8 variable, u8 *val);
-- 
2.55.0


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

* [PATCH 47/61] staging: rtl8723bs: clean up phy power conversion function
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (45 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 46/61] staging: rtl8723bs: remove rtw_get_mgntframe_raid helper Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 48/61] staging: rtl8723bs: remove PHY_TxPowerByRateConfiguration wrapper Arsenii Pashchenko
                   ` (14 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Fix indentation, function signature placement, and variable declarations
in phy_ConvertTxPowerByRateInDbmToRelativeValues. Replace sizeof() loops
with ARRAY_SIZE() for better safety and consistency with kernel style.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 .../staging/rtl8723bs/hal/hal_com_phycfg.c    | 20 ++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
index b16456d5b..21b9d1c82 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
@@ -367,20 +367,22 @@ void PHY_StoreTxPowerByRate(
 	}
 }
 
-static void
-phy_ConvertTxPowerByRateInDbmToRelativeValues(
-struct adapter *padapter
-	)
+static void phy_ConvertTxPowerByRateInDbmToRelativeValues(struct adapter *padapter)
 {
-	u8	base = 0, i = 0, value = 0, path = 0;
+	u8 base = 0;
+	u8 i = 0;
+	u8 value = 0;
+	u8 path = 0;
 	u8	cckRates[4] = {
 		MGN_1M, MGN_2M, MGN_5_5M, MGN_11M
 	};
 	u8	ofdmRates[8] = {
-		MGN_6M, MGN_9M, MGN_12M, MGN_18M, MGN_24M, MGN_36M, MGN_48M, MGN_54M
+		MGN_6M, MGN_9M, MGN_12M, MGN_18M,
+		MGN_24M, MGN_36M, MGN_48M, MGN_54M
 	};
 	u8 mcs0_7Rates[8] = {
-		MGN_MCS0, MGN_MCS1, MGN_MCS2, MGN_MCS3, MGN_MCS4, MGN_MCS5, MGN_MCS6, MGN_MCS7
+		MGN_MCS0, MGN_MCS1, MGN_MCS2, MGN_MCS3,
+		MGN_MCS4, MGN_MCS5, MGN_MCS6, MGN_MCS7
 	};
 	for (path = RF_PATH_A; path < RF_PATH_MAX; ++path) {
 		/*  CCK */
@@ -392,14 +394,14 @@ struct adapter *padapter
 
 		/*  OFDM */
 		base = PHY_GetTxPowerByRate(padapter, path, MGN_54M);
-		for (i = 0; i < sizeof(ofdmRates); ++i) {
+		for (i = 0; i < ARRAY_SIZE(ofdmRates); ++i) {
 			value = PHY_GetTxPowerByRate(padapter, path, ofdmRates[i]);
 			PHY_SetTxPowerByRate(padapter, path, ofdmRates[i], value - base);
 		}
 
 		/*  HT MCS0~7 */
 		base = PHY_GetTxPowerByRate(padapter, path, MGN_MCS7);
-		for (i = 0; i < sizeof(mcs0_7Rates); ++i) {
+		for (i = 0; i < ARRAY_SIZE(mcs0_7Rates); ++i) {
 			value = PHY_GetTxPowerByRate(padapter, path, mcs0_7Rates[i]);
 			PHY_SetTxPowerByRate(padapter, path, mcs0_7Rates[i], value - base);
 		}
-- 
2.55.0


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

* [PATCH 48/61] staging: rtl8723bs: remove PHY_TxPowerByRateConfiguration wrapper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (46 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 47/61] staging: rtl8723bs: clean up phy power conversion function Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 49/61] staging: rtl8723bs: remove phy_GetChannelIndexOfTxPowerLimit helper Arsenii Pashchenko
                   ` (13 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the single-use function PHY_TxPowerByRateConfiguration. Inline
its code directly at the call site, along with the relevant block
comment, to eliminate an unnecessary redirection layer and clean up
the overall driver flow.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_com_phycfg.c     | 13 ++-----------
 drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c    |  7 ++++---
 drivers/staging/rtl8723bs/include/hal_com_phycfg.h |  1 -
 drivers/staging/rtl8723bs/include/rtl8723b_hal.h   |  4 ++++
 4 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
index 21b9d1c82..32b69ba3b 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
@@ -60,7 +60,7 @@ phy_SetTxPowerByRateBase(struct adapter *Adapter, u8 RfPath,
 	}
 }
 
-static void phy_StoreTxPowerByRateBase(struct adapter *padapter)
+void phy_StoreTxPowerByRateBase(struct adapter *padapter)
 {
 	u8 path, base;
 
@@ -367,7 +367,7 @@ void PHY_StoreTxPowerByRate(
 	}
 }
 
-static void phy_ConvertTxPowerByRateInDbmToRelativeValues(struct adapter *padapter)
+void phy_ConvertTxPowerByRateInDbmToRelativeValues(struct adapter *padapter)
 {
 	u8 base = 0;
 	u8 i = 0;
@@ -408,15 +408,6 @@ static void phy_ConvertTxPowerByRateInDbmToRelativeValues(struct adapter *padapt
 	}
 }
 
-/*
- * This function must be called if the value in the PHY_REG_PG.txt(or header)
- * is exact dBm values
- */
-void PHY_TxPowerByRateConfiguration(struct adapter *padapter)
-{
-	phy_StoreTxPowerByRateBase(padapter);
-	phy_ConvertTxPowerByRateInDbmToRelativeValues(padapter);
-}
 
 void PHY_SetTxPowerIndexByRateSection(
 	struct adapter *padapter, u8 RFPath, u8 Channel, u8 RateSection
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
index d6369eb7b..75d01e730 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
@@ -346,9 +346,10 @@ static int phy_BB8723b_Config_ParaFile(struct adapter *Adapter)
 	   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 (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_EXACT_VALUE) {
+			phy_StoreTxPowerByRateBase(Adapter);
+			phy_ConvertTxPowerByRateInDbmToRelativeValues(Adapter);
+		}
 		if (Adapter->registrypriv.reg_enable_tx_power_limit == 1 ||
 		    (Adapter->registrypriv.reg_enable_tx_power_limit == 2 &&
 		   pHalData->EEPROMRegulatory == 1))
diff --git a/drivers/staging/rtl8723bs/include/hal_com_phycfg.h b/drivers/staging/rtl8723bs/include/hal_com_phycfg.h
index cb7c7ed74..2dde01c2a 100644
--- a/drivers/staging/rtl8723bs/include/hal_com_phycfg.h
+++ b/drivers/staging/rtl8723bs/include/hal_com_phycfg.h
@@ -85,7 +85,6 @@ void PHY_InitTxPowerByRate(struct adapter *padapter);
 void PHY_StoreTxPowerByRate(struct adapter *padapter, u32 RfPath,
 			    u32	RegAddr, u32 BitMask, u32 Data);
 
-void PHY_TxPowerByRateConfiguration(struct adapter *padapter);
 
 u8 PHY_GetTxPowerIndexBase(struct adapter *padapter, u8 RFPath, u8 Rate,
 			   enum channel_width BandWidth, u8 Channel);
diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
index b6006110a..fe6401c4f 100644
--- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
+++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
@@ -239,4 +239,8 @@ s32 c2h_handler_8723b(struct adapter *padapter, u8 *pC2hEvent);
 void Hal_ReadRFGainOffset(struct adapter *padapter, u8 *hwinfo,
 			  bool AutoLoadFail);
 
+
+void phy_StoreTxPowerByRateBase(struct adapter *padapter);
+void phy_ConvertTxPowerByRateInDbmToRelativeValues(struct adapter *padapter);
+
 #endif
-- 
2.55.0


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

* [PATCH 49/61] staging: rtl8723bs: remove phy_GetChannelIndexOfTxPowerLimit helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (47 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 48/61] staging: rtl8723bs: remove PHY_TxPowerByRateConfiguration wrapper Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 50/61] staging: rtl8723bs: inline SetHwReg8723BS into rtw_hal_set_hwreg Arsenii Pashchenko
                   ` (12 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Remove the tiny single-line helper function
phy_GetChannelIndexOfTxPowerLimit. Inline the arithmetic index
calculation directly into the callers to simplify the code and
reduce runtime call overhead.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
index 32b69ba3b..7ad04aa85 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
@@ -643,10 +643,7 @@ static s8 phy_GetWorldWideLimit(s8 *LimitTable)
 	return min;
 }
 
-static s8 phy_GetChannelIndexOfTxPowerLimit(u8 Channel)
-{
-	return Channel - 1;
-}
+
 
 static s16 get_bandwidth_idx(const enum channel_width bandwidth)
 {
@@ -721,7 +718,7 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel,
 	if (idx_rate_sctn == 0 || idx_rate_sctn == 1)
 		idx_bandwidth = 0;
 
-	channel = phy_GetChannelIndexOfTxPowerLimit(channel);
+	channel--;
 
 	if (idx_regulation == -1 || idx_bandwidth == -1 ||
 	    idx_rate_sctn == -1 || idx_channel == -1)
@@ -838,7 +835,7 @@ void PHY_SetTxPowerLimit(
 	else if (strcmp(Bandwidth, "40M") == 0)
 		bandwidth = 1;
 
-	channelIndex = phy_GetChannelIndexOfTxPowerLimit(channel);
+	channelIndex = channel-1;
 
 	if (channelIndex == -1)
 		return;
-- 
2.55.0


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

* [PATCH 50/61] staging: rtl8723bs: inline SetHwReg8723BS into rtw_hal_set_hwreg
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (48 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 49/61] staging: rtl8723bs: remove phy_GetChannelIndexOfTxPowerLimit helper Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 51/61] staging: rtl8723bs: inline GetHwReg8723BS into rtw_hal_get_hwreg Arsenii Pashchenko
                   ` (11 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Inline the hardware register configuration logic from SetHwReg8723BS
directly into rtw_hal_set_hwreg. This eliminates the intermediate
CamelCase call layer for SDIO-specific registers and cleans up the
driver entry point.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c |  2 +-
 .../staging/rtl8723bs/core/rtw_wlan_util.c    |  4 +-
 drivers/staging/rtl8723bs/hal/hal_intf.c      | 35 ++++++++++++++-
 drivers/staging/rtl8723bs/hal/sdio_halinit.c  | 43 -------------------
 drivers/staging/rtl8723bs/include/hal_intf.h  |  1 -
 5 files changed, 37 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 0cc6887bb..1fab3e829 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -5449,7 +5449,7 @@ u8 setkey_hdl(struct adapter *padapter, u8 *pbuf)
 		rtw_hal_set_hwreg(padapter, HW_VAR_SEC_DK_CFG, (u8 *)true);
 
 	/* allow multicast packets to driver */
-	SetHwReg8723BS(padapter, HW_VAR_ON_RCR_AM, null_addr);
+	rtw_hal_set_hwreg(padapter, HW_VAR_ON_RCR_AM, null_addr);
 
 	return H2C_SUCCESS;
 }
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index d833c5e3a..3ac04c8b0 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1515,9 +1515,9 @@ void update_wireless_mode(struct adapter *padapter)
 	SIFS_Timer = 0x0a0a0808; /* 0x0808 -> for CCK, 0x0a0a -> for OFDM */
 													/* change this value if having IOT issues. */
 
-	SetHwReg8723BS(padapter, HW_VAR_RESP_SIFS,  (u8 *)&SIFS_Timer);
+	rtw_hal_set_hwreg(padapter, HW_VAR_RESP_SIFS,  (u8 *)&SIFS_Timer);
 
-	SetHwReg8723BS(padapter, HW_VAR_WIRELESS_MODE,  (u8 *)&(pmlmeext->cur_wireless_mode));
+	rtw_hal_set_hwreg(padapter, HW_VAR_WIRELESS_MODE,  (u8 *)&(pmlmeext->cur_wireless_mode));
 
 	if (pmlmeext->cur_wireless_mode & WIRELESS_11B)
 		update_mgnt_tx_rate(padapter, IEEE80211_CCK_RATE_1MB);
diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 9a3ebad35..bbf987ace 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -71,7 +71,40 @@ uint rtw_hal_deinit(struct adapter *padapter)
 
 void rtw_hal_set_hwreg(struct adapter *padapter, u8 variable, u8 *val)
 {
-	SetHwReg8723BS(padapter, variable, val);
+	u8 val8;
+
+	switch (variable) {
+	case HW_VAR_SET_RPWM:
+		/*  rpwm value only use BIT0(clock bit) , BIT6(Ack bit), and BIT7(Toggle bit) */
+		/*  BIT0 value - 1: 32k, 0:40MHz. */
+		/*  BIT6 value - 1: report cpwm value after success set, 0:do not report. */
+		/*  BIT7 value - Toggle bit change. */
+		{
+			val8 = *val;
+			val8 &= 0xC1;
+			rtw_write8(padapter, SDIO_LOCAL_BASE | SDIO_REG_HRPWM1, val8);
+		}
+		break;
+	case HW_VAR_SET_REQ_FW_PS:
+		{
+			u8 req_fw_ps = 0;
+
+			req_fw_ps = rtw_read8(padapter, 0x8f);
+			req_fw_ps |= 0x10;
+			rtw_write8(padapter, 0x8f, req_fw_ps);
+		}
+		break;
+	case HW_VAR_RXDMA_AGG_PG_TH:
+		val8 = *val;
+		break;
+
+	case HW_VAR_DM_IN_LPS:
+		rtl8723b_hal_dm_in_lps(padapter);
+		break;
+	default:
+		SetHwReg8723B(padapter, variable, val);
+		break;
+	}
 }
 
 void rtw_hal_get_hwreg(struct adapter *padapter, u8 variable, u8 *val)
diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
index 731ca9276..775fd5138 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
@@ -1077,49 +1077,6 @@ void rtw_read_adapter_info(struct adapter *padapter)
 
 	_ReadAdapterInfo8723BS(padapter);
 }
-
-/*
- * If variable not handled here,
- * some variables will be processed in SetHwReg8723B()
- */
-void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val)
-{
-	u8 val8;
-
-	switch (variable) {
-	case HW_VAR_SET_RPWM:
-		/*  rpwm value only use BIT0(clock bit) , BIT6(Ack bit), and BIT7(Toggle bit) */
-		/*  BIT0 value - 1: 32k, 0:40MHz. */
-		/*  BIT6 value - 1: report cpwm value after success set, 0:do not report. */
-		/*  BIT7 value - Toggle bit change. */
-		{
-			val8 = *val;
-			val8 &= 0xC1;
-			rtw_write8(padapter, SDIO_LOCAL_BASE | SDIO_REG_HRPWM1, val8);
-		}
-		break;
-	case HW_VAR_SET_REQ_FW_PS:
-		{
-			u8 req_fw_ps = 0;
-
-			req_fw_ps = rtw_read8(padapter, 0x8f);
-			req_fw_ps |= 0x10;
-			rtw_write8(padapter, 0x8f, req_fw_ps);
-		}
-		break;
-	case HW_VAR_RXDMA_AGG_PG_TH:
-		val8 = *val;
-		break;
-
-	case HW_VAR_DM_IN_LPS:
-		rtl8723b_hal_dm_in_lps(padapter);
-		break;
-	default:
-		SetHwReg8723B(padapter, variable, val);
-		break;
-	}
-}
-
 /*
  * If variable not handled here,
  * some variables will be processed in GetHwReg8723B()
diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h
index ee8ad2632..51fdbf9fe 100644
--- a/drivers/staging/rtl8723bs/include/hal_intf.h
+++ b/drivers/staging/rtl8723bs/include/hal_intf.h
@@ -241,7 +241,6 @@ s32 rtw_hal_macid_wakeup(struct adapter *padapter, u32 macid);
 
 s32 rtw_hal_fill_h2c_cmd(struct adapter *, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer);
 
-void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val);
 void GetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val);
 void SetHwRegWithBuf8723B(struct adapter *padapter, u8 variable, u8 *pbuf, int len);
 u8 GetHalDefVar8723BSDIO(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue);
-- 
2.55.0


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

* [PATCH 51/61] staging: rtl8723bs: inline GetHwReg8723BS into rtw_hal_get_hwreg
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (49 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 50/61] staging: rtl8723bs: inline SetHwReg8723BS into rtw_hal_set_hwreg Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 52/61] staging: rtl8723bs: inline SetHwRegWithBuf8723B into helper Arsenii Pashchenko
                   ` (10 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Inline the hardware register reading logic from GetHwReg8723BS directly
into rtw_hal_get_hwreg. This removes the redundant CamelCase wrapper
layer for reading SDIO-specific registers and simplifies the flow.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_intf.c     | 16 ++++++++++++++-
 drivers/staging/rtl8723bs/hal/sdio_halinit.c | 21 --------------------
 drivers/staging/rtl8723bs/include/hal_intf.h |  1 -
 3 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index bbf987ace..92e4605fa 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -109,7 +109,21 @@ void rtw_hal_set_hwreg(struct adapter *padapter, u8 variable, u8 *val)
 
 void rtw_hal_get_hwreg(struct adapter *padapter, u8 variable, u8 *val)
 {
-	GetHwReg8723BS(padapter, variable, val);
+	switch (variable) {
+	case HW_VAR_CPWM:
+		*val = rtw_read8(padapter, SDIO_LOCAL_BASE | SDIO_REG_HCPWM1_8723B);
+		break;
+
+	case HW_VAR_FW_PS_STATE:
+		{
+			/* 3. read dword 0x88               driver read fw ps state */
+			*((u16 *)val) = rtw_read16(padapter, 0x88);
+		}
+		break;
+	default:
+		GetHwReg8723B(padapter, variable, val);
+		break;
+		}
 }
 
 void rtw_hal_set_hwreg_with_buf(struct adapter *padapter, u8 variable, u8 *pbuf, int len)
diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
index 775fd5138..22d6180f1 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
@@ -1077,28 +1077,7 @@ void rtw_read_adapter_info(struct adapter *padapter)
 
 	_ReadAdapterInfo8723BS(padapter);
 }
-/*
- * If variable not handled here,
- * some variables will be processed in GetHwReg8723B()
- */
-void GetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val)
-{
-	switch (variable) {
-	case HW_VAR_CPWM:
-		*val = rtw_read8(padapter, SDIO_LOCAL_BASE | SDIO_REG_HCPWM1_8723B);
-		break;
 
-	case HW_VAR_FW_PS_STATE:
-		{
-			/* 3. read dword 0x88               driver read fw ps state */
-			*((u16 *)val) = rtw_read16(padapter, 0x88);
-		}
-		break;
-	default:
-		GetHwReg8723B(padapter, variable, val);
-		break;
-	}
-}
 
 void SetHwRegWithBuf8723B(struct adapter *padapter, u8 variable, u8 *pbuf, int len)
 {
diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h
index 51fdbf9fe..b6ceea02a 100644
--- a/drivers/staging/rtl8723bs/include/hal_intf.h
+++ b/drivers/staging/rtl8723bs/include/hal_intf.h
@@ -241,7 +241,6 @@ s32 rtw_hal_macid_wakeup(struct adapter *padapter, u32 macid);
 
 s32 rtw_hal_fill_h2c_cmd(struct adapter *, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer);
 
-void GetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val);
 void SetHwRegWithBuf8723B(struct adapter *padapter, u8 variable, u8 *pbuf, int len);
 u8 GetHalDefVar8723BSDIO(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue);
 void UpdateHalRAMask8723B(struct adapter *padapter, u32 mac_id, u8 rssi_level);
-- 
2.55.0


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

* [PATCH 52/61] staging: rtl8723bs: inline SetHwRegWithBuf8723B into helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (50 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 51/61] staging: rtl8723bs: inline GetHwReg8723BS into rtw_hal_get_hwreg Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 53/61] staging: rtl8723bs: inline GetHalDefVar8723BSDIO " Arsenii Pashchenko
                   ` (9 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Inline the hardware register configuration logic from
SetHwRegWithBuf8723B directly into rtw_hal_set_hwreg_with_buf.
This removes a redundant CamelCase layer for C2H packet handling.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_intf.c     |  8 +++++++-
 drivers/staging/rtl8723bs/hal/sdio_halinit.c | 11 -----------
 drivers/staging/rtl8723bs/include/hal_intf.h |  1 -
 3 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 92e4605fa..e58fc1405 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -128,7 +128,13 @@ void rtw_hal_get_hwreg(struct adapter *padapter, u8 variable, u8 *val)
 
 void rtw_hal_set_hwreg_with_buf(struct adapter *padapter, u8 variable, u8 *pbuf, int len)
 {
-	SetHwRegWithBuf8723B(padapter, variable, pbuf, len);
+	switch (variable) {
+	case HW_VAR_C2H_HANDLE:
+		C2HPacketHandler_8723B(padapter, pbuf, len);
+		break;
+	default:
+		break;
+		}
 }
 
 u8 rtw_hal_get_def_var(struct adapter *padapter, enum hal_def_variable eVariable, void *pValue)
diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
index 22d6180f1..0155c523e 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
@@ -1079,17 +1079,6 @@ void rtw_read_adapter_info(struct adapter *padapter)
 }
 
 
-void SetHwRegWithBuf8723B(struct adapter *padapter, u8 variable, u8 *pbuf, int len)
-{
-	switch (variable) {
-	case HW_VAR_C2H_HANDLE:
-		C2HPacketHandler_8723B(padapter, pbuf, len);
-		break;
-	default:
-		break;
-	}
-}
-
 /*  */
 /*	Description: */
 /*		Query setting of specified variable. */
diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h
index b6ceea02a..1d5c0b7bb 100644
--- a/drivers/staging/rtl8723bs/include/hal_intf.h
+++ b/drivers/staging/rtl8723bs/include/hal_intf.h
@@ -241,7 +241,6 @@ s32 rtw_hal_macid_wakeup(struct adapter *padapter, u32 macid);
 
 s32 rtw_hal_fill_h2c_cmd(struct adapter *, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer);
 
-void SetHwRegWithBuf8723B(struct adapter *padapter, u8 variable, u8 *pbuf, int len);
 u8 GetHalDefVar8723BSDIO(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue);
 void UpdateHalRAMask8723B(struct adapter *padapter, u32 mac_id, u8 rssi_level);
 void rtl8723b_SetBeaconRelatedRegisters(struct adapter *padapter);
-- 
2.55.0


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

* [PATCH 53/61] staging: rtl8723bs: inline GetHalDefVar8723BSDIO into helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (51 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 52/61] staging: rtl8723bs: inline SetHwRegWithBuf8723B into helper Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 54/61] staging: rtl8723bs: inline SetHalODMVar into rtw_hal_set_odm_var Arsenii Pashchenko
                   ` (8 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Inline the hardware configuration logic from GetHalDefVar8723BSDIO
directly into rtw_hal_get_def_var. This eliminates a redundant
CamelCase layer and cleans up default variable handling for SDIO.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_intf.c     | 19 ++++++++++++-
 drivers/staging/rtl8723bs/hal/sdio_halinit.c | 29 --------------------
 drivers/staging/rtl8723bs/include/hal_intf.h |  1 -
 3 files changed, 18 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index e58fc1405..2c50fa5c0 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -139,7 +139,24 @@ void rtw_hal_set_hwreg_with_buf(struct adapter *padapter, u8 variable, u8 *pbuf,
 
 u8 rtw_hal_get_def_var(struct adapter *padapter, enum hal_def_variable eVariable, void *pValue)
 {
-	return GetHalDefVar8723BSDIO(padapter, eVariable, pValue);
+	u8 bResult = _SUCCESS;
+
+	switch (eVariable) {
+	case HAL_DEF_IS_SUPPORT_ANT_DIV:
+		break;
+	case HAL_DEF_CURRENT_ANTENNA:
+		break;
+	case HW_VAR_MAX_RX_AMPDU_FACTOR:
+		/*  Stanley@BB.SD3 suggests 16K can get stable performance */
+		/*  coding by Lucas@20130730 */
+		*(u32 *)pValue = IEEE80211_HT_MAX_AMPDU_16K;
+		break;
+	default:
+		bResult = GetHalDefVar8723B(padapter, eVariable, pValue);
+		break;
+	}
+
+	return bResult;
 }
 
 void rtw_hal_set_odm_var(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, bool bSet)
diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
index 0155c523e..395a2b3ee 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
@@ -1077,32 +1077,3 @@ void rtw_read_adapter_info(struct adapter *padapter)
 
 	_ReadAdapterInfo8723BS(padapter);
 }
-
-
-/*  */
-/*	Description: */
-/*		Query setting of specified variable. */
-/*  */
-u8 GetHalDefVar8723BSDIO(
-	struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue
-)
-{
-	u8 bResult = _SUCCESS;
-
-	switch (eVariable) {
-	case HAL_DEF_IS_SUPPORT_ANT_DIV:
-		break;
-	case HAL_DEF_CURRENT_ANTENNA:
-		break;
-	case HW_VAR_MAX_RX_AMPDU_FACTOR:
-		/*  Stanley@BB.SD3 suggests 16K can get stable performance */
-		/*  coding by Lucas@20130730 */
-		*(u32 *)pValue = IEEE80211_HT_MAX_AMPDU_16K;
-		break;
-	default:
-		bResult = GetHalDefVar8723B(Adapter, eVariable, pValue);
-		break;
-	}
-
-	return bResult;
-}
diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h
index 1d5c0b7bb..206388fc5 100644
--- a/drivers/staging/rtl8723bs/include/hal_intf.h
+++ b/drivers/staging/rtl8723bs/include/hal_intf.h
@@ -241,7 +241,6 @@ s32 rtw_hal_macid_wakeup(struct adapter *padapter, u32 macid);
 
 s32 rtw_hal_fill_h2c_cmd(struct adapter *, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer);
 
-u8 GetHalDefVar8723BSDIO(struct adapter *Adapter, enum hal_def_variable eVariable, void *pValue);
 void UpdateHalRAMask8723B(struct adapter *padapter, u32 mac_id, u8 rssi_level);
 void rtl8723b_SetBeaconRelatedRegisters(struct adapter *padapter);
 void Hal_EfusePowerSwitch(struct adapter *padapter, u8 PwrState);
-- 
2.55.0


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

* [PATCH 54/61] staging: rtl8723bs: inline SetHalODMVar into rtw_hal_set_odm_var
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (52 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 53/61] staging: rtl8723bs: inline GetHalDefVar8723BSDIO " Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 55/61] staging: rtl8723bs: inline CheckIPSStatus logic with defines Arsenii Pashchenko
                   ` (7 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Inline the hardware configuration logic from SetHalODMVar directly
into rtw_hal_set_odm_var. This eliminates a redundant CamelCase layer
and simplifies the interface for updating ODM variables.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_com.c     | 36 ---------------------
 drivers/staging/rtl8723bs/hal/hal_intf.c    | 33 ++++++++++++++++++-
 drivers/staging/rtl8723bs/include/hal_com.h |  5 ---
 3 files changed, 32 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c
index 0a0b41ebe..3d6b59c24 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com.c
@@ -643,42 +643,6 @@ u8 GetHalDefVar(
 	return bResult;
 }
 
-void SetHalODMVar(
-	struct adapter *Adapter,
-	enum hal_odm_variable eVariable,
-	void *pValue1,
-	bool bSet
-)
-{
-	struct hal_com_data	*pHalData = GET_HAL_DATA(Adapter);
-	struct dm_odm_t *podmpriv = &pHalData->odmpriv;
-	/* _irqL irqL; */
-	switch (eVariable) {
-	case HAL_ODM_STA_INFO:
-		{
-			struct sta_info *psta = pValue1;
-
-			if (bSet) {
-				ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, psta);
-			} else {
-				/* spin_lock_bh(&pHalData->odm_stainfo_lock); */
-				ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, NULL);
-
-				/* spin_unlock_bh(&pHalData->odm_stainfo_lock); */
-		    }
-		}
-		break;
-	case HAL_ODM_P2P_STATE:
-			ODM_CmnInfoUpdate(podmpriv, ODM_CMNINFO_WIFI_DIRECT, bSet);
-		break;
-	case HAL_ODM_WIFI_DISPLAY_STATE:
-			ODM_CmnInfoUpdate(podmpriv, ODM_CMNINFO_WIFI_DISPLAY, bSet);
-		break;
-
-	default:
-		break;
-	}
-}
 
 bool GetU1ByteIntegerFromStringInDecimal(char *Str, u8 *pInt)
 {
diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 2c50fa5c0..d2e310115 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -161,7 +161,38 @@ u8 rtw_hal_get_def_var(struct adapter *padapter, enum hal_def_variable eVariable
 
 void rtw_hal_set_odm_var(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, bool bSet)
 {
-	SetHalODMVar(padapter, eVariable, pValue1, bSet);
+	struct hal_com_data	*pHalData = GET_HAL_DATA(padapter);
+	struct dm_odm_t *podmpriv = &pHalData->odmpriv;
+	/* _irqL irqL; */
+	switch (eVariable) {
+	case HAL_ODM_STA_INFO:
+		{
+			struct sta_info *psta = pValue1;
+
+			if (bSet) {
+				ODM_CmnInfoPtrArrayHook(
+					podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, psta
+				);
+			} else {
+				/* spin_lock_bh(&pHalData->odm_stainfo_lock); */
+				ODM_CmnInfoPtrArrayHook(
+					podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, NULL
+				);
+
+				/* spin_unlock_bh(&pHalData->odm_stainfo_lock); */
+			}
+		}
+		break;
+	case HAL_ODM_P2P_STATE:
+			ODM_CmnInfoUpdate(podmpriv, ODM_CMNINFO_WIFI_DIRECT, bSet);
+		break;
+	case HAL_ODM_WIFI_DISPLAY_STATE:
+			ODM_CmnInfoUpdate(podmpriv, ODM_CMNINFO_WIFI_DISPLAY, bSet);
+		break;
+
+	default:
+		break;
+	};
 }
 
 u8 rtw_hal_check_ips_status(struct adapter *padapter)
diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h
index 962ba3aaa..79bb60c5c 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -141,9 +141,4 @@ bool GetU1ByteIntegerFromStringInDecimal(char *str, u8 *in);
 
 void rtw_bb_rf_gain_offset(struct adapter *padapter);
 
-void SetHalODMVar(
-	struct adapter *Adapter,
-	enum hal_odm_variable		eVariable,
-	void *pValue1,
-	bool					bSet);
 #endif /* __HAL_COMMON_H__ */
-- 
2.55.0


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

* [PATCH 55/61] staging: rtl8723bs: inline CheckIPSStatus logic with defines
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (53 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 54/61] staging: rtl8723bs: inline SetHalODMVar into rtw_hal_set_odm_var Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 56/61] staging: rtl8723bs: inline rtl8723bs_hal_xmitframe_enqueue helper Arsenii Pashchenko
                   ` (6 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Inline CheckIPSStatus logic directly into rtw_hal_check_ips_status.
Replace the 0x100 register and 0xEA magic number with self-documenting
defines: REG_FW_PWR_STATUS and FW_PWR_STATUS_IPS_DONE.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_intf.c     |  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c     | 16 ----------------
 drivers/staging/rtl8723bs/include/sdio_ops.h |  4 +++-
 3 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index d2e310115..a73abd36f 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -197,7 +197,7 @@ void rtw_hal_set_odm_var(struct adapter *padapter, enum hal_odm_variable eVariab
 
 u8 rtw_hal_check_ips_status(struct adapter *padapter)
 {
-	return CheckIPSStatus(padapter);
+	return rtw_read8(padapter, REG_FW_PWR_STATUS) == FW_PWR_STATUS_IPS_DONE;
 }
 
 int rtw_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe)
diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index c4058cfe7..dced13d2f 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -620,22 +620,6 @@ void rtw_sdio_disable_interrupt(struct adapter *adapter)
 	sdio_local_write(adapter, SDIO_REG_HIMR, 4, (u8 *)&himr);
 }
 
-/*  */
-/*	Description: */
-/*		Using 0x100 to check the power status of FW. */
-/*  */
-/*	Assumption: */
-/*		Using SDIO Local register ONLY for configuration. */
-/*  */
-/*	Created by Isaac, 2013.09.10. */
-/*  */
-u8 CheckIPSStatus(struct adapter *adapter)
-{
-	if (rtw_read8(adapter, 0x100) == 0xEA)
-		return true;
-	else
-		return false;
-}
 
 static struct recv_buf *sd_recv_rxfifo(struct adapter *adapter, u32 size)
 {
diff --git a/drivers/staging/rtl8723bs/include/sdio_ops.h b/drivers/staging/rtl8723bs/include/sdio_ops.h
index 252b0e164..b5d426c99 100644
--- a/drivers/staging/rtl8723bs/include/sdio_ops.h
+++ b/drivers/staging/rtl8723bs/include/sdio_ops.h
@@ -23,7 +23,9 @@ u32 _sdio_read32(struct adapter *padapter, u32 addr);
 s32 _sdio_write32(struct adapter *padapter, u32 addr, u32 val);
 
 extern void sd_int_hdl(struct adapter *padapter);
-extern u8 CheckIPSStatus(struct adapter *padapter);
+
+#define REG_FW_PWR_STATUS 0x100
+#define FW_PWR_STATUS_IPS_DONE 0xEA
 
 extern void InitInterrupt8723BSdio(struct adapter *padapter);
 void rtw_sdio_enable_interrupt(struct adapter *padapter);
-- 
2.55.0


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

* [PATCH 56/61] staging: rtl8723bs: inline rtl8723bs_hal_xmitframe_enqueue helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (54 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 55/61] staging: rtl8723bs: inline CheckIPSStatus logic with defines Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 57/61] staging: rtl8723bs: inline rtl8723bs_hal_xmit into rtw_hal_xmit Arsenii Pashchenko
                   ` (5 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Inline the xmit frame enqueue logic from the internal CamelCase
function directly into rtw_hal_xmitframe_enqueue. This simplifies
the transmit path, removes an unnecessary layer, and cleans up
the driver code.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_intf.c      | 14 ++++++++++++-
 .../staging/rtl8723bs/hal/rtl8723bs_xmit.c    | 20 -------------------
 .../staging/rtl8723bs/include/rtl8723b_xmit.h |  1 -
 3 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index a73abd36f..b11f4ab4a 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -202,7 +202,19 @@ u8 rtw_hal_check_ips_status(struct adapter *padapter)
 
 int rtw_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe)
 {
-	return rtl8723bs_hal_xmitframe_enqueue(padapter, pxmitframe);
+	struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+	s32 err;
+
+	err = rtw_xmitframe_enqueue(padapter, pxmitframe);
+	if (err) {
+		rtw_free_xmitframe(pxmitpriv, pxmitframe);
+
+		pxmitpriv->tx_drop++;
+	} else {
+		complete(&pxmitpriv->SdioXmitStart);
+	}
+
+	return err;
 }
 
 s32	rtw_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe)
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
index e40f69c13..a4dfee1d4 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
@@ -496,26 +496,6 @@ s32 rtl8723bs_hal_xmit(
 	return false;
 }
 
-s32	rtl8723bs_hal_xmitframe_enqueue(
-	struct adapter *padapter, struct xmit_frame *pxmitframe
-)
-{
-	struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
-	s32 err;
-
-	err = rtw_xmitframe_enqueue(padapter, pxmitframe);
-	if (err) {
-		rtw_free_xmitframe(pxmitpriv, pxmitframe);
-
-		pxmitpriv->tx_drop++;
-	} else {
-		complete(&pxmitpriv->SdioXmitStart);
-	}
-
-	return err;
-
-}
-
 /*
  * Return
  *_SUCCESS	start thread ok
diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h b/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h
index ddf868c78..8d6d6d2b7 100644
--- a/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h
+++ b/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h
@@ -411,7 +411,6 @@ s32 rtl8723bs_init_xmit_priv(struct adapter *padapter);
 void rtl8723bs_free_xmit_priv(struct adapter *padapter);
 s32 rtl8723bs_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe);
 s32 rtl8723bs_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe);
-s32	rtl8723bs_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe);
 s32 rtl8723bs_xmit_buf_handler(struct adapter *padapter);
 int rtl8723bs_xmit_thread(void *context);
 
-- 
2.55.0


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

* [PATCH 57/61] staging: rtl8723bs: inline rtl8723bs_hal_xmit into rtw_hal_xmit
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (55 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 56/61] staging: rtl8723bs: inline rtl8723bs_hal_xmitframe_enqueue helper Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 58/61] staging: rtl8723bs: extend rtw_hal_mgnt_xmit functionality Arsenii Pashchenko
                   ` (4 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Inline the transmit frame handling logic from rtl8723bs_hal_xmit
directly into rtw_hal_xmit. This simplifies the driver's transmit path,
cuts down on an unnecessary redirection layer, and improves code
maintainability.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_intf.c      | 28 ++++++++++++-
 .../staging/rtl8723bs/hal/rtl8723bs_xmit.c    | 42 -------------------
 .../staging/rtl8723bs/include/rtl8723b_xmit.h |  1 -
 3 files changed, 27 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index b11f4ab4a..9bb1fba5c 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -219,10 +219,36 @@ int rtw_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmit
 
 s32	rtw_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe)
 {
-	if (rtl8723bs_hal_xmit(padapter, pxmitframe))
+	struct xmit_priv *pxmitpriv;
+	s32 err;
+
+	pxmitframe->attrib.qsel = pxmitframe->attrib.priority;
+	pxmitpriv = &padapter->xmitpriv;
+
+	if (
+		(pxmitframe->frame_tag == DATA_FRAMETAG) &&
+		(pxmitframe->attrib.ether_type != 0x0806) &&
+		(pxmitframe->attrib.ether_type != 0x888e) &&
+		(pxmitframe->attrib.dhcp_pkt != 1)
+	) {
+		if (padapter->mlmepriv.link_detect_info.busy_traffic)
+			rtw_issue_addbareq_cmd(padapter, pxmitframe);
+	}
+
+	spin_lock_bh(&pxmitpriv->lock);
+	err = rtw_xmitframe_enqueue(padapter, pxmitframe);
+	spin_unlock_bh(&pxmitpriv->lock);
+	if (err) {
+		rtw_free_xmitframe(pxmitpriv, pxmitframe);
+
+		pxmitpriv->tx_drop++;
 		return _FAIL;
+	}
+
+	complete(&pxmitpriv->SdioXmitStart);
 
 	return _SUCCESS;
+
 }
 
 /*
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
index a4dfee1d4..2298c41df 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
@@ -453,48 +453,6 @@ s32 rtl8723bs_mgnt_xmit(
 	return ret;
 }
 
-/*
- * Description:
- *Handle xmitframe(packet) come from rtw_xmit()
- *
- * Return:
- * true      dump packet directly ok
- * false     enqueue, temporary can't transmit packets to hardware
- */
-s32 rtl8723bs_hal_xmit(
-	struct adapter *padapter, struct xmit_frame *pxmitframe
-)
-{
-	struct xmit_priv *pxmitpriv;
-	s32 err;
-
-	pxmitframe->attrib.qsel = pxmitframe->attrib.priority;
-	pxmitpriv = &padapter->xmitpriv;
-
-	if (
-		(pxmitframe->frame_tag == DATA_FRAMETAG) &&
-		(pxmitframe->attrib.ether_type != 0x0806) &&
-		(pxmitframe->attrib.ether_type != 0x888e) &&
-		(pxmitframe->attrib.dhcp_pkt != 1)
-	) {
-		if (padapter->mlmepriv.link_detect_info.busy_traffic)
-			rtw_issue_addbareq_cmd(padapter, pxmitframe);
-	}
-
-	spin_lock_bh(&pxmitpriv->lock);
-	err = rtw_xmitframe_enqueue(padapter, pxmitframe);
-	spin_unlock_bh(&pxmitpriv->lock);
-	if (err) {
-		rtw_free_xmitframe(pxmitpriv, pxmitframe);
-
-		pxmitpriv->tx_drop++;
-		return true;
-	}
-
-	complete(&pxmitpriv->SdioXmitStart);
-
-	return false;
-}
 
 /*
  * Return
diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h b/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h
index 8d6d6d2b7..157b2a808 100644
--- a/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h
+++ b/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h
@@ -409,7 +409,6 @@ u32 rtl8723bs_hal_init(struct adapter *padapter);
 u32 rtl8723bs_hal_deinit(struct adapter *padapter);
 s32 rtl8723bs_init_xmit_priv(struct adapter *padapter);
 void rtl8723bs_free_xmit_priv(struct adapter *padapter);
-s32 rtl8723bs_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe);
 s32 rtl8723bs_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe);
 s32 rtl8723bs_xmit_buf_handler(struct adapter *padapter);
 int rtl8723bs_xmit_thread(void *context);
-- 
2.55.0


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

* [PATCH 58/61] staging: rtl8723bs: extend rtw_hal_mgnt_xmit functionality
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (56 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 57/61] staging: rtl8723bs: inline rtl8723bs_hal_xmit into rtw_hal_xmit Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 59/61] staging: rtl8723bs: inline rtl8723bs_init_xmit_priv helper Arsenii Pashchenko
                   ` (3 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Extend rtw_hal_mgnt_xmit to extract RA/TA MAC addresses from the
802.11 header before transmission.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c    | 10 ----------
 drivers/staging/rtl8723bs/hal/hal_intf.c         | 11 ++++++-----
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h |  1 -
 drivers/staging/rtl8723bs/include/rtw_xmit.h     |  1 +
 4 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 1fab3e829..fcf33c956 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1916,16 +1916,6 @@ void update_mgntframe_attrib(struct adapter *padapter, struct pkt_attrib *pattri
 	pattrib->mbssid = 0;
 }
 
-void update_mgntframe_attrib_addr(struct adapter *padapter, struct xmit_frame *pmgntframe)
-{
-	u8 *pframe;
-	struct pkt_attrib	*pattrib = &pmgntframe->attrib;
-
-	pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-
-	memcpy(pattrib->ra, GetAddr1Ptr(pframe), ETH_ALEN);
-	memcpy(pattrib->ta, GetAddr2Ptr(pframe), ETH_ALEN);
-}
 
 void dump_mgntframe(struct adapter *padapter, struct xmit_frame *pmgntframe)
 {
diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 9bb1fba5c..7cf5128e7 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -256,15 +256,16 @@ s32	rtw_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe)
  */
 s32	rtw_hal_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe)
 {
-	update_mgntframe_attrib_addr(padapter, pmgntframe);
-	/* pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; */
-	/* pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; */
-	/* memcpy(pmgntframe->attrib.ra, pwlanhdr->addr1, ETH_ALEN); */
+	struct pkt_attrib *pattrib = &pmgntframe->attrib;
+
+	u8 *pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
+
+	memcpy(pattrib->ra, GetAddr1Ptr(pframe), ETH_ALEN);
+	memcpy(pattrib->ta, GetAddr2Ptr(pframe), ETH_ALEN);
 
 	if (padapter->securitypriv.binstallBIPkey) {
 		if (is_multicast_ether_addr(pmgntframe->attrib.ra)) {
 			pmgntframe->attrib.encrypt = _BIP_;
-			/* pmgntframe->attrib.bswenc = true; */
 		} else {
 			pmgntframe->attrib.encrypt = _AES_;
 			pmgntframe->attrib.bswenc = true;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 3d1126740..7a1c90c71 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -524,7 +524,6 @@ extern u8 set_tx_beacon_cmd(struct adapter *padapter);
 unsigned int setup_beacon_frame(struct adapter *padapter, unsigned char *beacon_frame);
 void update_mgnt_tx_rate(struct adapter *padapter, u8 rate);
 void update_mgntframe_attrib(struct adapter *padapter, struct pkt_attrib *pattrib);
-void update_mgntframe_attrib_addr(struct adapter *padapter, struct xmit_frame *pmgntframe);
 void dump_mgntframe(struct adapter *padapter, struct xmit_frame *pmgntframe);
 s32 dump_mgntframe_and_wait(struct adapter *padapter, struct xmit_frame *pmgntframe, int timeout_ms);
 s32 dump_mgntframe_and_wait_ack(struct adapter *padapter, struct xmit_frame *pmgntframe);
diff --git a/drivers/staging/rtl8723bs/include/rtw_xmit.h b/drivers/staging/rtl8723bs/include/rtw_xmit.h
index f85a03efe..41a04e3b0 100644
--- a/drivers/staging/rtl8723bs/include/rtw_xmit.h
+++ b/drivers/staging/rtl8723bs/include/rtw_xmit.h
@@ -213,6 +213,7 @@ void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms);
 int rtw_sctx_wait(struct submit_ctx *sctx);
 void rtw_sctx_done_err(struct submit_ctx **sctx, int status);
 
+
 struct xmit_buf {
 	struct list_head	list;
 
-- 
2.55.0


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

* [PATCH 59/61] staging: rtl8723bs: inline rtl8723bs_init_xmit_priv helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (57 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 58/61] staging: rtl8723bs: extend rtw_hal_mgnt_xmit functionality Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 60/61] staging: rtl8723bs: inline recv private data freeing helper Arsenii Pashchenko
                   ` (2 subsequent siblings)
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Inline the xmit private initialization logic from the internal function
directly into rtw_hal_init_xmit_priv. This eliminates an unnecessary
redirection layer for initializing SDIO-specific completions and locks.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_intf.c      | 118 +++++++++++++++++-
 .../staging/rtl8723bs/hal/rtl8723bs_recv.c    |  88 +------------
 .../staging/rtl8723bs/hal/rtl8723bs_xmit.c    |  53 --------
 .../staging/rtl8723bs/include/rtl8723b_hal.h  |   2 +
 .../staging/rtl8723bs/include/rtl8723b_recv.h |   2 +-
 .../staging/rtl8723bs/include/rtl8723b_xmit.h |   3 +-
 6 files changed, 121 insertions(+), 145 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 7cf5128e7..3244f121d 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -278,17 +278,129 @@ s32	rtw_hal_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe)
 
 s32	rtw_hal_init_xmit_priv(struct adapter *padapter)
 {
-	return rtl8723bs_init_xmit_priv(padapter);
+	struct xmit_priv *xmitpriv = &padapter->xmitpriv;
+	struct hal_com_data *phal;
+
+	phal = GET_HAL_DATA(padapter);
+
+	spin_lock_init(&phal->SdioTxFIFOFreePageLock);
+	init_completion(&xmitpriv->SdioXmitStart);
+	init_completion(&xmitpriv->SdioXmitTerminate);
+
+	return _SUCCESS;
 }
 
 void rtw_hal_free_xmit_priv(struct adapter *padapter)
 {
-	rtl8723bs_free_xmit_priv(padapter);
+	struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+	struct xmit_buf *pxmitbuf;
+	struct __queue *pqueue = &pxmitpriv->pending_xmitbuf_queue;
+	struct list_head *plist, *phead;
+	struct list_head tmplist;
+
+	phead = get_list_head(pqueue);
+	INIT_LIST_HEAD(&tmplist);
+
+	spin_lock_bh(&pqueue->lock);
+	if (!list_empty(&pqueue->queue)) {
+		/*  Insert tmplist to end of queue, and delete phead */
+		/*  then tmplist become head of queue. */
+		list_add_tail(&tmplist, phead);
+		list_del_init(phead);
+	}
+	spin_unlock_bh(&pqueue->lock);
+
+	phead = &tmplist;
+	while (!list_empty(phead)) {
+		plist = get_next(phead);
+		list_del_init(plist);
+
+		pxmitbuf = container_of(plist, struct xmit_buf, list);
+		rtw_free_xmitframe(pxmitpriv, (struct xmit_frame *)pxmitbuf->priv_data);
+		pxmitbuf->priv_data = NULL;
+		rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
+	}
 }
 
 s32	rtw_hal_init_recv_priv(struct adapter *padapter)
 {
-	return rtl8723bs_init_recv_priv(padapter);
+	s32 res;
+	u32 i, n;
+	struct recv_priv *precvpriv;
+	struct recv_buf *precvbuf;
+
+	res = _SUCCESS;
+	precvpriv = &padapter->recvpriv;
+
+	/* 3 1. init recv buffer */
+	INIT_LIST_HEAD(&precvpriv->free_recv_buf_queue.queue);
+	spin_lock_init(&precvpriv->free_recv_buf_queue.lock);
+	INIT_LIST_HEAD(&precvpriv->recv_buf_pending_queue.queue);
+	spin_lock_init(&precvpriv->recv_buf_pending_queue.lock);
+
+	n = NR_RECVBUFF * sizeof(struct recv_buf) + 4;
+	precvpriv->pallocated_recv_buf = kzalloc(n, GFP_KERNEL);
+	if (!precvpriv->pallocated_recv_buf) {
+		res = _FAIL;
+		goto exit;
+	}
+
+	precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(precvpriv->pallocated_recv_buf), 4);
+
+	/*  init each recv buffer */
+	precvbuf = (struct recv_buf *)precvpriv->precv_buf;
+	for (i = 0; i < NR_RECVBUFF; i++) {
+		initrecvbuf(precvbuf, padapter);
+
+		if (!precvbuf->pskb) {
+			SIZE_PTR tmpaddr = 0;
+			SIZE_PTR alignment = 0;
+
+			precvbuf->pskb = __dev_alloc_skb(
+								MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ,
+								GFP_ATOMIC);
+			if (precvbuf->pskb) {
+				precvbuf->pskb->dev = padapter->pnetdev;
+
+				tmpaddr = (SIZE_PTR)precvbuf->pskb->data;
+				alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
+				skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment));
+			}
+		}
+
+		list_add_tail(&precvbuf->list, &precvpriv->free_recv_buf_queue.queue);
+
+		precvbuf++;
+	}
+	precvpriv->free_recv_buf_queue_cnt = i;
+
+	if (res == _FAIL)
+		goto initbuferror;
+
+	/* 3 2. init tasklet */
+	tasklet_setup(&precvpriv->recv_tasklet, rtl8723bs_recv_tasklet);
+
+	goto exit;
+
+initbuferror:
+	precvbuf = (struct recv_buf *)precvpriv->precv_buf;
+	if (precvbuf) {
+		n = precvpriv->free_recv_buf_queue_cnt;
+		precvpriv->free_recv_buf_queue_cnt = 0;
+		for (i = 0; i < n ; i++) {
+			list_del_init(&precvbuf->list);
+			if (precvbuf->pskb)
+				dev_kfree_skb_any(precvbuf->pskb);
+			precvbuf++;
+		}
+		precvpriv->precv_buf = NULL;
+	}
+
+	kfree(precvpriv->pallocated_recv_buf);
+	precvpriv->pallocated_recv_buf = NULL;
+
+exit:
+	return res;
 }
 
 void rtw_hal_free_recv_priv(struct adapter *padapter)
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
index 97dce28fd..384c5e643 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
@@ -8,7 +8,7 @@
 #include <drv_types.h>
 #include <rtl8723b_hal.h>
 
-static void initrecvbuf(struct recv_buf *precvbuf, struct adapter *padapter)
+void initrecvbuf(struct recv_buf *precvbuf, struct adapter *padapter)
 {
 	INIT_LIST_HEAD(&precvbuf->list);
 	spin_lock_init(&precvbuf->recvbuf_lock);
@@ -213,7 +213,7 @@ static inline bool pkt_exceeds_tail(struct recv_priv *precvpriv,
 	return false;
 }
 
-static void rtl8723bs_recv_tasklet(struct tasklet_struct *t)
+void rtl8723bs_recv_tasklet(struct tasklet_struct *t)
 {
 	struct adapter *padapter = from_tasklet(padapter, t,
 						recvpriv.recv_tasklet);
@@ -357,90 +357,6 @@ static void rtl8723bs_recv_tasklet(struct tasklet_struct *t)
 	} while (1);
 }
 
-/*
- * Initialize recv private variable for hardware dependent
- * 1. recv buf
- * 2. recv tasklet
- *
- */
-s32 rtl8723bs_init_recv_priv(struct adapter *padapter)
-{
-	s32 res;
-	u32 i, n;
-	struct recv_priv *precvpriv;
-	struct recv_buf *precvbuf;
-
-	res = _SUCCESS;
-	precvpriv = &padapter->recvpriv;
-
-	/* 3 1. init recv buffer */
-	INIT_LIST_HEAD(&precvpriv->free_recv_buf_queue.queue);
-	spin_lock_init(&precvpriv->free_recv_buf_queue.lock);
-	INIT_LIST_HEAD(&precvpriv->recv_buf_pending_queue.queue);
-	spin_lock_init(&precvpriv->recv_buf_pending_queue.lock);
-
-	n = NR_RECVBUFF * sizeof(struct recv_buf) + 4;
-	precvpriv->pallocated_recv_buf = kzalloc(n, GFP_KERNEL);
-	if (!precvpriv->pallocated_recv_buf) {
-		res = _FAIL;
-		goto exit;
-	}
-
-	precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(precvpriv->pallocated_recv_buf), 4);
-
-	/*  init each recv buffer */
-	precvbuf = (struct recv_buf *)precvpriv->precv_buf;
-	for (i = 0; i < NR_RECVBUFF; i++) {
-		initrecvbuf(precvbuf, padapter);
-
-		if (!precvbuf->pskb) {
-			SIZE_PTR tmpaddr = 0;
-			SIZE_PTR alignment = 0;
-
-			precvbuf->pskb = __dev_alloc_skb(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, GFP_ATOMIC);
-			if (precvbuf->pskb) {
-				precvbuf->pskb->dev = padapter->pnetdev;
-
-				tmpaddr = (SIZE_PTR)precvbuf->pskb->data;
-				alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
-				skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment));
-			}
-		}
-
-		list_add_tail(&precvbuf->list, &precvpriv->free_recv_buf_queue.queue);
-
-		precvbuf++;
-	}
-	precvpriv->free_recv_buf_queue_cnt = i;
-
-	if (res == _FAIL)
-		goto initbuferror;
-
-	/* 3 2. init tasklet */
-	tasklet_setup(&precvpriv->recv_tasklet, rtl8723bs_recv_tasklet);
-
-	goto exit;
-
-initbuferror:
-	precvbuf = (struct recv_buf *)precvpriv->precv_buf;
-	if (precvbuf) {
-		n = precvpriv->free_recv_buf_queue_cnt;
-		precvpriv->free_recv_buf_queue_cnt = 0;
-		for (i = 0; i < n ; i++) {
-			list_del_init(&precvbuf->list);
-			if (precvbuf->pskb)
-				dev_kfree_skb_any(precvbuf->pskb);
-			precvbuf++;
-		}
-		precvpriv->precv_buf = NULL;
-	}
-
-	kfree(precvpriv->pallocated_recv_buf);
-	precvpriv->pallocated_recv_buf = NULL;
-
-exit:
-	return res;
-}
 
 /*
  * Free recv private variable of hardware dependent
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
index 2298c41df..1037b9d11 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
@@ -452,56 +452,3 @@ s32 rtl8723bs_mgnt_xmit(
 
 	return ret;
 }
-
-
-/*
- * Return
- *_SUCCESS	start thread ok
- *_FAIL		start thread fail
- *
- */
-s32 rtl8723bs_init_xmit_priv(struct adapter *padapter)
-{
-	struct xmit_priv *xmitpriv = &padapter->xmitpriv;
-	struct hal_com_data *phal;
-
-	phal = GET_HAL_DATA(padapter);
-
-	spin_lock_init(&phal->SdioTxFIFOFreePageLock);
-	init_completion(&xmitpriv->SdioXmitStart);
-	init_completion(&xmitpriv->SdioXmitTerminate);
-
-	return _SUCCESS;
-}
-
-void rtl8723bs_free_xmit_priv(struct adapter *padapter)
-{
-	struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
-	struct xmit_buf *pxmitbuf;
-	struct __queue *pqueue = &pxmitpriv->pending_xmitbuf_queue;
-	struct list_head *plist, *phead;
-	struct list_head tmplist;
-
-	phead = get_list_head(pqueue);
-	INIT_LIST_HEAD(&tmplist);
-
-	spin_lock_bh(&pqueue->lock);
-	if (!list_empty(&pqueue->queue)) {
-		/*  Insert tmplist to end of queue, and delete phead */
-		/*  then tmplist become head of queue. */
-		list_add_tail(&tmplist, phead);
-		list_del_init(phead);
-	}
-	spin_unlock_bh(&pqueue->lock);
-
-	phead = &tmplist;
-	while (!list_empty(phead)) {
-		plist = get_next(phead);
-		list_del_init(plist);
-
-		pxmitbuf = container_of(plist, struct xmit_buf, list);
-		rtw_free_xmitframe(pxmitpriv, (struct xmit_frame *)pxmitbuf->priv_data);
-		pxmitbuf->priv_data = NULL;
-		rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
-	}
-}
diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
index fe6401c4f..e00d9e6b2 100644
--- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
+++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
@@ -242,5 +242,7 @@ void Hal_ReadRFGainOffset(struct adapter *padapter, u8 *hwinfo,
 
 void phy_StoreTxPowerByRateBase(struct adapter *padapter);
 void phy_ConvertTxPowerByRateInDbmToRelativeValues(struct adapter *padapter);
+void initrecvbuf(struct recv_buf *precvbuf, struct adapter *padapter);
+void rtl8723bs_recv_tasklet(struct tasklet_struct *t);
 
 #endif
diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_recv.h b/drivers/staging/rtl8723bs/include/rtl8723b_recv.h
index e9ebecb22..c4c91f5f4 100644
--- a/drivers/staging/rtl8723bs/include/rtl8723b_recv.h
+++ b/drivers/staging/rtl8723bs/include/rtl8723b_recv.h
@@ -81,7 +81,7 @@ struct rxreport_8723b {
 	u32 tsfl;
 };
 
-s32 rtl8723bs_init_recv_priv(struct adapter *padapter);
+
 void rtl8723bs_free_recv_priv(struct adapter *padapter);
 
 void rtl8723b_query_rx_phy_status(union recv_frame *prframe, struct phy_stat *pphy_stat);
diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h b/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h
index 157b2a808..d467cc301 100644
--- a/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h
+++ b/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h
@@ -407,8 +407,7 @@ void rtl8723b_fill_fake_txdesc(struct adapter *padapter, u8 *pDesc, u32 BufferLe
 
 u32 rtl8723bs_hal_init(struct adapter *padapter);
 u32 rtl8723bs_hal_deinit(struct adapter *padapter);
-s32 rtl8723bs_init_xmit_priv(struct adapter *padapter);
-void rtl8723bs_free_xmit_priv(struct adapter *padapter);
+
 s32 rtl8723bs_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe);
 s32 rtl8723bs_xmit_buf_handler(struct adapter *padapter);
 int rtl8723bs_xmit_thread(void *context);
-- 
2.55.0


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

* [PATCH 60/61] staging: rtl8723bs: inline recv private data freeing helper
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (58 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 59/61] staging: rtl8723bs: inline rtl8723bs_init_xmit_priv helper Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 12:48 ` [PATCH 61/61] staging: rtl8723bs: fix tx power limit lookup by using correct channel index Arsenii Pashchenko
  2026-07-15 13:03 ` [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Greg Kroah-Hartman
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

Inline the receive private data freeing logic directly into
rtw_hal_free_recv_priv. This eliminates a redundant redirection layer
for killing the recv tasklet, dropping pending skbs, and freeing
allocated memory buffers during teardown.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 .../staging/rtl8723bs/hal/HalBtc8723b2Ant.c   |  2 +-
 .../staging/rtl8723bs/hal/HalBtc8723b2Ant.h   |  1 +
 drivers/staging/rtl8723bs/hal/hal_intf.c      | 50 ++++++++++++++++++-
 drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c  | 30 -----------
 .../staging/rtl8723bs/hal/rtl8723bs_recv.c    | 35 -------------
 .../staging/rtl8723bs/include/rtl8723b_cmd.h  |  1 -
 .../staging/rtl8723bs/include/rtl8723b_recv.h |  1 -
 7 files changed, 50 insertions(+), 70 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
index efb0ffd54..bb3ebfe74 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
@@ -1031,7 +1031,7 @@ static void halbtc8723b2ant_CoexAllOff(struct btc_coexist *pBtCoexist)
 	halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
 }
 
-static void halbtc8723b2ant_InitCoexDm(struct btc_coexist *pBtCoexist)
+void halbtc8723b2ant_InitCoexDm(struct btc_coexist *pBtCoexist)
 {
 	/*  force to reset coex mechanism */
 
diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h
index 4043e4e4d..bdb7720a1 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.h
@@ -144,3 +144,4 @@ void EXhalbtc8723b2ant_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState);
 void EXhalbtc8723b2ant_Periodical(struct btc_coexist *pBtCoexist);
 
 void halbtc8723b2ant_InitHwConfig(struct btc_coexist *pBtCoexist);
+void halbtc8723b2ant_InitCoexDm(struct btc_coexist *pBtCoexist);
diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 3244f121d..9c471d176 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -405,7 +405,30 @@ s32	rtw_hal_init_recv_priv(struct adapter *padapter)
 
 void rtw_hal_free_recv_priv(struct adapter *padapter)
 {
-	rtl8723bs_free_recv_priv(padapter);
+	u32 i;
+	struct recv_priv *precvpriv;
+	struct recv_buf *precvbuf;
+
+	precvpriv = &padapter->recvpriv;
+
+	/* 3 1. kill tasklet */
+	tasklet_kill(&precvpriv->recv_tasklet);
+
+	/* 3 2. free all recv buffers */
+	precvbuf = (struct recv_buf *)precvpriv->precv_buf;
+	if (precvbuf) {
+		precvpriv->free_recv_buf_queue_cnt = 0;
+		for (i = 0; i < NR_RECVBUFF; i++) {
+			list_del_init(&precvbuf->list);
+			if (precvbuf->pskb)
+				dev_kfree_skb_any(precvbuf->pskb);
+			precvbuf++;
+		}
+		precvpriv->precv_buf = NULL;
+	}
+
+	kfree(precvpriv->pallocated_recv_buf);
+	precvpriv->pallocated_recv_buf = NULL;
 }
 
 void rtw_hal_update_ra_mask(struct sta_info *psta, u8 rssi_level)
@@ -427,9 +450,32 @@ void rtw_hal_update_ra_mask(struct sta_info *psta, u8 rssi_level)
 	}
 }
 
+/* arg[0] = macid */
+/* arg[1] = raid */
+/* arg[2] = shortGIrate */
+/* arg[3] = init_rate */
 void rtw_hal_add_ra_tid(struct adapter *padapter, u32 bitmap, u8 *arg, u8 rssi_level)
 {
-	rtl8723b_Add_RateATid(padapter, bitmap, arg, rssi_level);
+	struct hal_com_data	*pHalData = GET_HAL_DATA(padapter);
+	struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+	struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+	struct sta_info *psta;
+	u8 mac_id = arg[0];
+	u8 raid = arg[1];
+	u8 shortGI = arg[2];
+	u8 bw;
+	u32 mask = bitmap&0x0FFFFFFF;
+
+	psta = pmlmeinfo->FW_sta_info[mac_id].psta;
+	if (!psta)
+		return;
+
+	bw = psta->bw_mode;
+
+	if (rssi_level != DM_RATR_STA_INIT)
+		mask = ODM_Get_Rate_Bitmap(&pHalData->odmpriv, mac_id, mask, rssi_level);
+
+	rtl8723b_set_FwMacIdConfig_cmd(padapter, mac_id, raid, bw, shortGI, mask);
 }
 
 u32 rtw_hal_read_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask)
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
index 826a20529..593354e41 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
@@ -697,38 +697,8 @@ void rtl8723b_set_FwJoinBssRpt_cmd(struct adapter *padapter, u8 mstatus)
 		rtl8723b_download_rsvd_page(padapter, RT_MEDIA_CONNECT);
 }
 
-/* arg[0] = macid */
-/* arg[1] = raid */
-/* arg[2] = shortGIrate */
-/* arg[3] = init_rate */
-void rtl8723b_Add_RateATid(
-	struct adapter *padapter,
-	u32 bitmap,
-	u8 *arg,
-	u8 rssi_level
-)
-{
-	struct hal_com_data	*pHalData = GET_HAL_DATA(padapter);
-	struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-	struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-	struct sta_info *psta;
-	u8 mac_id = arg[0];
-	u8 raid = arg[1];
-	u8 shortGI = arg[2];
-	u8 bw;
-	u32 mask = bitmap&0x0FFFFFFF;
-
-	psta = pmlmeinfo->FW_sta_info[mac_id].psta;
-	if (!psta)
-		return;
 
-	bw = psta->bw_mode;
 
-	if (rssi_level != DM_RATR_STA_INIT)
-		mask = ODM_Get_Rate_Bitmap(&pHalData->odmpriv, mac_id, mask, rssi_level);
-
-	rtl8723b_set_FwMacIdConfig_cmd(padapter, mac_id, raid, bw, shortGI, mask);
-}
 
 static void ConstructBtNullFunctionData(
 	struct adapter *padapter,
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
index 384c5e643..f9aab253f 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
@@ -356,38 +356,3 @@ void rtl8723bs_recv_tasklet(struct tasklet_struct *t)
 		rtw_enqueue_recvbuf(precvbuf, &precvpriv->free_recv_buf_queue);
 	} while (1);
 }
-
-
-/*
- * Free recv private variable of hardware dependent
- * 1. recv buf
- * 2. recv tasklet
- *
- */
-void rtl8723bs_free_recv_priv(struct adapter *padapter)
-{
-	u32 i;
-	struct recv_priv *precvpriv;
-	struct recv_buf *precvbuf;
-
-	precvpriv = &padapter->recvpriv;
-
-	/* 3 1. kill tasklet */
-	tasklet_kill(&precvpriv->recv_tasklet);
-
-	/* 3 2. free all recv buffers */
-	precvbuf = (struct recv_buf *)precvpriv->precv_buf;
-	if (precvbuf) {
-		precvpriv->free_recv_buf_queue_cnt = 0;
-		for (i = 0; i < NR_RECVBUFF; i++) {
-			list_del_init(&precvbuf->list);
-			if (precvbuf->pskb)
-				dev_kfree_skb_any(precvbuf->pskb);
-			precvbuf++;
-		}
-		precvpriv->precv_buf = NULL;
-	}
-
-	kfree(precvpriv->pallocated_recv_buf);
-	precvpriv->pallocated_recv_buf = NULL;
-}
diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h b/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h
index 6b2d79e19..df62991c9 100644
--- a/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h
+++ b/drivers/staging/rtl8723bs/include/rtl8723b_cmd.h
@@ -166,7 +166,6 @@ enum {
 void rtl8723b_set_FwPwrMode_cmd(struct adapter *padapter, u8 Mode);
 void rtl8723b_set_FwJoinBssRpt_cmd(struct adapter *padapter, u8 mstatus);
 void rtl8723b_set_rssi_cmd(struct adapter *padapter, u8 *param);
-void rtl8723b_Add_RateATid(struct adapter *padapter, u32 bitmap, u8 *arg, u8 rssi_level);
 void rtl8723b_fw_try_ap_cmd(struct adapter *padapter, u32 need_ack);
 /* s32 rtl8723b_set_lowpwr_lps_cmd(struct adapter *padapter, u8 enable); */
 void rtl8723b_set_FwPsTuneParam_cmd(struct adapter *padapter);
diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_recv.h b/drivers/staging/rtl8723bs/include/rtl8723b_recv.h
index c4c91f5f4..2fc530494 100644
--- a/drivers/staging/rtl8723bs/include/rtl8723b_recv.h
+++ b/drivers/staging/rtl8723bs/include/rtl8723b_recv.h
@@ -82,7 +82,6 @@ struct rxreport_8723b {
 };
 
 
-void rtl8723bs_free_recv_priv(struct adapter *padapter);
 
 void rtl8723b_query_rx_phy_status(union recv_frame *prframe, struct phy_stat *pphy_stat);
 void rtl8723b_process_phy_info(struct adapter *padapter, void *prframe);
-- 
2.55.0


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

* [PATCH 61/61] staging: rtl8723bs: fix tx power limit lookup by using correct channel index
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (59 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 60/61] staging: rtl8723bs: inline recv private data freeing helper Arsenii Pashchenko
@ 2026-07-15 12:48 ` Arsenii Pashchenko
  2026-07-15 13:03 ` [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Greg Kroah-Hartman
  61 siblings, 0 replies; 65+ messages in thread
From: Arsenii Pashchenko @ 2026-07-15 12:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, ulijg308

In phy_get_tx_pwr_lmt(), the result of phy_GetChannelIndexOfTxPowerLimit()
is erroneously assigned back to the input parameter 'channel'.

Since 'channel' is never used again afterward, this triggers a
-Wunused-but-set-parameter compiler warning. Furthermore, the actual
index variable 'idx_channel' remains initialized to -1, causing the
function to always fail the subsequent validation check and prematurely
return MAX_POWER_INDEX.

Fix this by assigning the computed channel index directly to 'idx_channel'.
This resolves the compiler warning and restores the intended hardware
tx power limit lookup logic.

Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
index 7ad04aa85..bbaedf256 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
@@ -718,7 +718,7 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel,
 	if (idx_rate_sctn == 0 || idx_rate_sctn == 1)
 		idx_bandwidth = 0;
 
-	channel--;
+	idx_channel--;
 
 	if (idx_regulation == -1 || idx_bandwidth == -1 ||
 	    idx_rate_sctn == -1 || idx_channel == -1)
-- 
2.55.0


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

* Re: [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix
  2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
                   ` (60 preceding siblings ...)
  2026-07-15 12:48 ` [PATCH 61/61] staging: rtl8723bs: fix tx power limit lookup by using correct channel index Arsenii Pashchenko
@ 2026-07-15 13:03 ` Greg Kroah-Hartman
  61 siblings, 0 replies; 65+ messages in thread
From: Greg Kroah-Hartman @ 2026-07-15 13:03 UTC (permalink / raw)
  To: Arsenii Pashchenko; +Cc: linux-staging, linux-kernel

On Wed, Jul 15, 2026 at 07:47:28PM +0700, Arsenii Pashchenko wrote:
> Hello,
> 
> This patch series performs a massive, systematic cleanup of the legacy 
> vendor HAL layer and redundant abstraction wrappers in the rtl8723bs 
> driver, concluding with a functional fix for the TX power limit lookup.
> 
> The primary goal of this refactoring is to drastically improve the 
> readability and maintainability of the codebase, transforming the 
> highly tangled, Windows-legacy Realtek abstractions into a cleaner, 
> more idiomatic Linux driver structure.
> 
> KEY CHANGES IN THIS SERIES:
> 
> 1. Dead Code & Stub Removal: Eliminated several unimplemented functions, 
>    empty stubs (like OnAtim, DoReserved), duplicate prototypes, and 
>    completely unused helpers (NULL_hdl, set_csa_hdl, tdls_hdl).
> 2. Wrapper Collapse & Inlining: Removed multiple layers of superficial 
>    wrappers around core operations (e.g., rtw_ap_set_group_key, 
>    issue_deauth, issue_probereq, rtw_free_mlme_priv, etc.). High-frequency 
>    or single-use HAL entry points (like SetHwReg8723BS, GetHwReg8723BS, 
>    and xmit helpers) have been carefully inlined directly into their 
>    respective dispatchers to enhance readability.
> 3. Scope & Warning Fixes: Restructured local functions (like 
>    lps_ctrl_wk_hdl) by marking them static and aligning headers, which 
>    resolves missing-prototypes compiler warnings.
> 4. Logical Fixes: In the final patch, a critical copy-paste bug in 
>    phy_get_tx_pwr_lmt() was resolved. The computed channel index from 
>    phy_GetChannelIndexOfTxPowerLimit() was mistakenly assigned back to 
>    the 'channel' parameter and discarded, leaving 'idx_channel' at -1. 
>    This caused the function to always fail validation and return 
>    MAX_POWER_INDEX. Correcting this restores the intended hardware tx 
>    power limit logic and resolves a compiler warning.
> 5. Refined Abstractions: In places where removing a wrapper would 
>    decrease overall elegance or require awkward type workarounds, the 
>    cleanest architectural approach was intentionally preserved.
> 
> TESTING & VERIFICATION:
> 
> - Hardware: I do not possess the physical rtl8723bs hardware, so 
>   real-world runtime wireless testing was not performed.
> - Compilation: The entire series compiles flawlessly against the 
>   latest tree.
> - Code Style: All 61 patches have been fully validated with 
>   `scripts/checkpatch.pl` and return 0 errors / 0 warnings per patch. 
>   (Note: A few pre-existing vendor style warnings remain in the modified 
>   files, but no new ones were introduced).
> 
> This cleanup significantly reduces the boilerplate footprint, making 
> future maintenance and eventual mac80211 migration tasks much more 
> approachable.

How did you do all of these?  Without testing I am loath to take such
large changes, right?  Did you use a llm?

thanks,

greg k-h

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

* Re: [PATCH 01/61] staging: rtl8723bs: remove redundant rtw_ap_set_group_key wrapper
  2026-07-15 12:47 ` [PATCH 01/61] staging: rtl8723bs: remove redundant rtw_ap_set_group_key wrapper Arsenii Pashchenko
@ 2026-07-15 13:15   ` Greg Kroah-Hartman
  2026-07-15 13:19     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 65+ messages in thread
From: Greg Kroah-Hartman @ 2026-07-15 13:15 UTC (permalink / raw)
  To: Arsenii Pashchenko; +Cc: linux-staging, linux-kernel

On Wed, Jul 15, 2026 at 07:47:29PM +0700, Arsenii Pashchenko wrote:
> Eliminate the redundant rtw_ap_set_group_key() wrapper function by
> calling rtw_ap_set_key() directly with the set_tx parameter set to 1.
> This reduces boilerplate code and cleans up the driver interface.
> 
> Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_ap.c           | 7 +------
>  drivers/staging/rtl8723bs/include/rtw_ap.h        | 2 +-
>  drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 8 ++++++--
>  3 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
> index 065850a9e..a6640cd7a 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_ap.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
> @@ -1195,7 +1195,7 @@ u8 rtw_ap_set_pairwise_key(struct adapter *padapter, struct sta_info *psta)
>  	return res;
>  }
>  
> -static int rtw_ap_set_key(struct adapter *padapter,
> +int rtw_ap_set_key(struct adapter *padapter,
>  			  u8 *key,
>  			  u8 alg,
>  			  int keyid,
> @@ -1258,11 +1258,6 @@ static int rtw_ap_set_key(struct adapter *padapter,
>  	return res;
>  }
>  
> -int rtw_ap_set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid)
> -{
> -	return rtw_ap_set_key(padapter, key, alg, keyid, 1);
> -}
> -
>  int rtw_ap_set_wep_key(struct adapter *padapter,
>  		       u8 *key,
>  		       u8 keylen,
> diff --git a/drivers/staging/rtl8723bs/include/rtw_ap.h b/drivers/staging/rtl8723bs/include/rtw_ap.h
> index 83e835eb6..cdd9f291f 100644
> --- a/drivers/staging/rtl8723bs/include/rtw_ap.h
> +++ b/drivers/staging/rtl8723bs/include/rtw_ap.h
> @@ -22,7 +22,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr);
>  void rtw_acl_remove_sta(struct adapter *padapter, u8 *addr);
>  
>  u8 rtw_ap_set_pairwise_key(struct adapter *padapter, struct sta_info *psta);
> -int rtw_ap_set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid);
> +int rtw_ap_set_key(struct adapter *padapter, u8 *key, u8 alg, int keyid, u8 set_tx);
>  int rtw_ap_set_wep_key(struct adapter *padapter, u8 *key, u8 keylen, int keyid, u8 set_tx);
>  
>  void associated_clients_update(struct adapter *padapter, u8 updated);
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> index 1484336d7..ce76a8586 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> @@ -604,7 +604,9 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
>  
>  			psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;/*  */
>  
> -			rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx);
> +			rtw_ap_set_key(padapter, param->u.crypt.key,
> +						   psecuritypriv->dot118021XGrpPrivacy,
> +						   param->u.crypt.idx, 1);

Ok, first patch of the series, this isn't correct.

I'm all for cleanups, but remember, drivers/staging/ is here to get
experience with kernel development.  Sending a 60+ series as your first
contribution to the kernel isn't the best way to start out.

Take your time, don't use a LLM, and fix issues one at a time and then
batch up patches, maybe 5 at a time and send them out, get reviews, fix
them up, wait for them to be accepted, and learn the process.

As-is, with the very first patch in this series being incorrect, I can't
do anything with these at all as-is.

thanks,

greg k-h

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

* Re: [PATCH 01/61] staging: rtl8723bs: remove redundant rtw_ap_set_group_key wrapper
  2026-07-15 13:15   ` Greg Kroah-Hartman
@ 2026-07-15 13:19     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 65+ messages in thread
From: Greg Kroah-Hartman @ 2026-07-15 13:19 UTC (permalink / raw)
  To: Arsenii Pashchenko; +Cc: linux-staging, linux-kernel

On Wed, Jul 15, 2026 at 03:15:41PM +0200, Greg Kroah-Hartman wrote:
> On Wed, Jul 15, 2026 at 07:47:29PM +0700, Arsenii Pashchenko wrote:
> > Eliminate the redundant rtw_ap_set_group_key() wrapper function by
> > calling rtw_ap_set_key() directly with the set_tx parameter set to 1.
> > This reduces boilerplate code and cleans up the driver interface.
> > 
> > Signed-off-by: Arsenii Pashchenko <ulijg308@gmail.com>
> > ---
> >  drivers/staging/rtl8723bs/core/rtw_ap.c           | 7 +------
> >  drivers/staging/rtl8723bs/include/rtw_ap.h        | 2 +-
> >  drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 8 ++++++--
> >  3 files changed, 8 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
> > index 065850a9e..a6640cd7a 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_ap.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
> > @@ -1195,7 +1195,7 @@ u8 rtw_ap_set_pairwise_key(struct adapter *padapter, struct sta_info *psta)
> >  	return res;
> >  }
> >  
> > -static int rtw_ap_set_key(struct adapter *padapter,
> > +int rtw_ap_set_key(struct adapter *padapter,
> >  			  u8 *key,
> >  			  u8 alg,
> >  			  int keyid,
> > @@ -1258,11 +1258,6 @@ static int rtw_ap_set_key(struct adapter *padapter,
> >  	return res;
> >  }
> >  
> > -int rtw_ap_set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid)
> > -{
> > -	return rtw_ap_set_key(padapter, key, alg, keyid, 1);
> > -}
> > -
> >  int rtw_ap_set_wep_key(struct adapter *padapter,
> >  		       u8 *key,
> >  		       u8 keylen,
> > diff --git a/drivers/staging/rtl8723bs/include/rtw_ap.h b/drivers/staging/rtl8723bs/include/rtw_ap.h
> > index 83e835eb6..cdd9f291f 100644
> > --- a/drivers/staging/rtl8723bs/include/rtw_ap.h
> > +++ b/drivers/staging/rtl8723bs/include/rtw_ap.h
> > @@ -22,7 +22,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr);
> >  void rtw_acl_remove_sta(struct adapter *padapter, u8 *addr);
> >  
> >  u8 rtw_ap_set_pairwise_key(struct adapter *padapter, struct sta_info *psta);
> > -int rtw_ap_set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid);
> > +int rtw_ap_set_key(struct adapter *padapter, u8 *key, u8 alg, int keyid, u8 set_tx);
> >  int rtw_ap_set_wep_key(struct adapter *padapter, u8 *key, u8 keylen, int keyid, u8 set_tx);
> >  
> >  void associated_clients_update(struct adapter *padapter, u8 updated);
> > diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> > index 1484336d7..ce76a8586 100644
> > --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> > +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> > @@ -604,7 +604,9 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
> >  
> >  			psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;/*  */
> >  
> > -			rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx);
> > +			rtw_ap_set_key(padapter, param->u.crypt.key,
> > +						   psecuritypriv->dot118021XGrpPrivacy,
> > +						   param->u.crypt.idx, 1);
> 
> Ok, first patch of the series, this isn't correct.
> 
> I'm all for cleanups, but remember, drivers/staging/ is here to get
> experience with kernel development.  Sending a 60+ series as your first
> contribution to the kernel isn't the best way to start out.
> 
> Take your time, don't use a LLM, and fix issues one at a time and then
> batch up patches, maybe 5 at a time and send them out, get reviews, fix
> them up, wait for them to be accepted, and learn the process.
> 
> As-is, with the very first patch in this series being incorrect, I can't
> do anything with these at all as-is.

As for _why_ this patch is wrong, there's the obvious "coding style is
incorrect" which is easy to see.  The real problem is that it doesn't
actually make anything "simpler" at all.  You are perputating an
incorrect api here.  Think about why you are setting a value to 1, and
what that does and if that makes sense at all.  Walk it back and see if
the variable is always set to the same value, why is that variable
needed at all?  And if it's not needed, why is the function parameter
needed?

Unwind the mess, and work to clean things up properly, by learning and
understanding the code, not by throwing a fuzzy-text-matching-tool at
the thing.  If we wanted that type of cleanup, we would have done that
ages ago, that's not the point of this kernel code at all.

thanks,

greg k-h

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

end of thread, other threads:[~2026-07-15 13:19 UTC | newest]

Thread overview: 65+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-15 12:47 [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 01/61] staging: rtl8723bs: remove redundant rtw_ap_set_group_key wrapper Arsenii Pashchenko
2026-07-15 13:15   ` Greg Kroah-Hartman
2026-07-15 13:19     ` Greg Kroah-Hartman
2026-07-15 12:47 ` [PATCH 02/61] staging: rtl8723bs: replace is_same_ess with rtw_ssid_differ Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 03/61] staging: rtl8723bs: remove redundant rtw_to_roam wrapper Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 04/61] staging: rtl8723bs: remove redundant rtw_dec_to_roam helper Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 05/61] staging: rtl8723bs: remove unused OnAtim stub function Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 06/61] staging: rtl8723bs: remove DoReserved stub and clean up OnAction_tbl Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 07/61] staging: rtl8723bs: remove redundant issue_deauth wrapper Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 08/61] staging: rtl8723bs: remove unused NULL_hdl function Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 09/61] staging: rtl8723bs: remove unused set_csa_hdl function Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 10/61] staging: rtl8723bs: remove unused tdls_hdl function Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 11/61] staging: rtl8723bs: inline rtw_ps_deny_get() and remove dead code Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 12/61] staging: rtl8723bs: replace custom CMAC with kernel Crypto API helper Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 13/61] staging: rtl8723bs: remove redundant rtw_get_oper_ch() wrapper Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 14/61] staging: rtl8723bs: remove ODM_CheckPowerStatus and dead branches Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 15/61] staging: rtl8723bs: remove unimplemented halbtcoutsrc_GetBtReg helper Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 16/61] staging: rtl8723bs: remove rtw_free_evt_priv wrapper and rename helper Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 17/61] staging: rtl8723bs: remove rtw_free_cmd_priv " Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 18/61] staging: rtl8723bs: replace rtw_dm_in_lps_hdl with direct hal call Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 19/61] staging: rtl8723bs: make lps_ctrl_wk_hdl() static Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 20/61] staging: rtl8723bs: sanitize and align efuse read function headers Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 21/61] staging: rtl8723bs: replace rtw_reset_continual_io_error with atomic_set Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 22/61] staging: rtl8723bs: inline single-use init_mlme_default_rate_set Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 23/61] staging: rtl8723bs: remove issue_probereq wrapper and rename helper Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 24/61] staging: rtl8723bs: remove register_task_alive inline helper Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 25/61] staging: rtl8723bs: remove unregister_task_alive " Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 26/61] staging: rtl8723bs: clean up Michael MIC pseudo header logic Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 27/61] staging: rtl8723bs: replace rtw_set_oper_bw with direct assignment Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 28/61] staging: rtl8723bs: inline single-use _clear_cam_entry helper Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 29/61] staging: rtl8723bs: collapse set_sta_rate and Update_RA_Entry wrappers Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 30/61] staging: rtl8723bs: replace correct_TSF with direct HAL call Arsenii Pashchenko
2026-07-15 12:47 ` [PATCH 31/61] staging: rtl8723bs: replace rtw_sctx_done with direct status call Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 32/61] staging: rtl8723bs: remove rtw_free_mlme_priv wrapper and rename helper Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 33/61] staging: rtl8723bs: remove duplicate prototype of rtw_free_network_nolock Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 34/61] staging: rtl8723bs: replace rtw_get_beacon_interval_from_ie with define Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 35/61] staging: rtl8723bs: inline _rtw_free_network_nolock into wrapper Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 36/61] staging: rtl8723bs: remove rtw_wmm_event_callback and update handler Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 37/61] staging: rtl8723bs: replace halbtc8723b1ant_SwMechanism with direct call Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 38/61] staging: rtl8723bs: remove redundant ternary operators from bool returns Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 39/61] staging: rtl8723bs: remove redundant DM wrapper Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 40/61] staging: rtl8723bs: remove EXhalbtc8723b2ant_InitHwConfig Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 41/61] staging: rtl8723bs: remove EXhalbtc8723b1ant_InitHwConfig Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 42/61] staging: rtl8723bs: remove ConfigureTxpowerTrack wrapper Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 43/61] staging: rtl8723bs: remove hal_init_macaddr wrapper Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 44/61] staging: rtl8723bs: remove rtw_init_hal_com_default_value Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 45/61] staging: rtl8723bs: remove c2h_evt_clear wrapper Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 46/61] staging: rtl8723bs: remove rtw_get_mgntframe_raid helper Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 47/61] staging: rtl8723bs: clean up phy power conversion function Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 48/61] staging: rtl8723bs: remove PHY_TxPowerByRateConfiguration wrapper Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 49/61] staging: rtl8723bs: remove phy_GetChannelIndexOfTxPowerLimit helper Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 50/61] staging: rtl8723bs: inline SetHwReg8723BS into rtw_hal_set_hwreg Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 51/61] staging: rtl8723bs: inline GetHwReg8723BS into rtw_hal_get_hwreg Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 52/61] staging: rtl8723bs: inline SetHwRegWithBuf8723B into helper Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 53/61] staging: rtl8723bs: inline GetHalDefVar8723BSDIO " Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 54/61] staging: rtl8723bs: inline SetHalODMVar into rtw_hal_set_odm_var Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 55/61] staging: rtl8723bs: inline CheckIPSStatus logic with defines Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 56/61] staging: rtl8723bs: inline rtl8723bs_hal_xmitframe_enqueue helper Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 57/61] staging: rtl8723bs: inline rtl8723bs_hal_xmit into rtw_hal_xmit Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 58/61] staging: rtl8723bs: extend rtw_hal_mgnt_xmit functionality Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 59/61] staging: rtl8723bs: inline rtl8723bs_init_xmit_priv helper Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 60/61] staging: rtl8723bs: inline recv private data freeing helper Arsenii Pashchenko
2026-07-15 12:48 ` [PATCH 61/61] staging: rtl8723bs: fix tx power limit lookup by using correct channel index Arsenii Pashchenko
2026-07-15 13:03 ` [PATCH 00/61] staging: rtl8723bs: monolithic HAL cleanup and tx power limit fix Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.