Linux kernel staging patches
 help / color / mirror / Atom feed
From: Arsenii Pashchenko <ulijg308@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	ulijg308@gmail.com
Subject: [PATCH 03/61] staging: rtl8723bs: remove redundant rtw_to_roam wrapper
Date: Wed, 15 Jul 2026 19:47:31 +0700	[thread overview]
Message-ID: <20260715124829.90290-4-ulijg308@gmail.com> (raw)
In-Reply-To: <20260715124829.90290-1-ulijg308@gmail.com>

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


  parent reply	other threads:[~2026-07-15 12:50 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Arsenii Pashchenko [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260715124829.90290-4-ulijg308@gmail.com \
    --to=ulijg308@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox