public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] staging: rtl8723bs: cleanup and indentation refactoring
@ 2026-01-23 21:19 Michael Huang
  2026-01-23 21:19 ` [PATCH v3 1/2] staging: rtl8723bs: refactor nested loops to reduce indentation Michael Huang
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Michael Huang @ 2026-01-23 21:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Michael Huang

This series improves the code quality and readability of rtw_mlme_ext.c
in the rtl8723bs driver.

The first patch refactors several deeply nested loops and if-statements
by using guard clauses (continue statements). This flattens the logic
and makes the code easier to follow.

The second patch addresses various style issues reported by
checkpatch.pl, including line length exceeding 100 columns,
unnecessary parentheses, and unnecessary braces.

Michael Huang (2):
  staging: rtl8723bs: refactor nested loops to reduce indentation
  staging: rtl8723bs: fix line length and coding style issues

 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 142 ++++++++++--------
 1 file changed, 80 insertions(+), 62 deletions(-)

--
2.43.0


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

* [PATCH v3 1/2] staging: rtl8723bs: refactor nested loops to reduce indentation
  2026-01-23 21:19 [PATCH v3 0/2] staging: rtl8723bs: cleanup and indentation refactoring Michael Huang
@ 2026-01-23 21:19 ` Michael Huang
  2026-01-24 10:59   ` Dan Carpenter
  2026-01-23 21:19 ` [PATCH v3 2/2] staging: rtl8723bs: fix line length and coding style issues Michael Huang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 20+ messages in thread
From: Michael Huang @ 2026-01-23 21:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Michael Huang

Use guard clauses (continue statements) to flatten the logic in
rtw_mlme_ext.c. This improves code readability by reducing deep
nesting levels.

Signed-off-by: Michael Huang <tehsiu.huang@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 61 +++++++++++--------
 1 file changed, 35 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index fa1e3ad59254..0ab3629608ce 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -3682,32 +3682,31 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter)
 
 		spin_unlock_bh(&(pmlmepriv->scanned_queue.lock));
 
-
 		for (i = 0; i < 8; i++) {
-			if (ICS[i][0] == 1) {
-				int j, k = 0;
+			int j, k = 0;
 
-				InfoContent[k] = i;
-				/* SET_BSS_INTOLERANT_ELE_REG_CLASS(InfoContent, i); */
-				k++;
+			if (ICS[i][0] != 1)
+				continue;
 
-				for (j = 1; j <= 14; j++) {
-					if (ICS[i][j] == 1) {
-						if (k < 16) {
-							InfoContent[k] = j; /* channel number */
-							/* SET_BSS_INTOLERANT_ELE_CHANNEL(InfoContent+k, j); */
-							k++;
-						}
-					}
-				}
+			InfoContent[k] = i;
+			/* SET_BSS_INTOLERANT_ELE_REG_CLASS(InfoContent, i); */
+			k++;
 
-				pframe = rtw_set_ie(pframe, WLAN_EID_BSS_INTOLERANT_CHL_REPORT, k, InfoContent, &(pattrib->pktlen));
+			for (j = 1; j <= 14; j++) {
+				if (ICS[i][j] != 1)
+					continue;
 
+				if (k < 16) {
+					InfoContent[k] = j; /* channel number */
+					/* SET_BSS_INTOLERANT_ELE_CHANNEL(InfoContent+k, j); */
+					k++;
+				}
 			}
 
+			pframe = rtw_set_ie(pframe,
+					    WLAN_EID_BSS_INTOLERANT_CHL_REPORT,
+					    k, InfoContent, &pattrib->pktlen);
 		}
-
-
 	}
 
 
@@ -3831,14 +3830,24 @@ void site_survey(struct adapter *padapter)
 				int i;
 
 				for (i = 0; i < RTW_SSID_SCAN_AMOUNT; i++) {
-					if (pmlmeext->sitesurvey_res.ssid[i].ssid_length) {
-						/* 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);
-						else
-							issue_probereq_ex(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL, 0, 0, 0, 0);
-						issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL);
-					}
+					if (!pmlmeext->sitesurvey_res.ssid[i].ssid_length)
+						continue;
+
+					/* 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);
+					else
+						issue_probereq_ex(padapter,
+								  &pmlmeext->sitesurvey_res.ssid[i],
+								  NULL,
+								  0, 0, 0, 0);
+
+					issue_probereq(padapter,
+						       &pmlmeext->sitesurvey_res.ssid[i],
+						       NULL);
 				}
 
 				if (pmlmeext->sitesurvey_res.scan_mode == SCAN_ACTIVE) {
-- 
2.43.0


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

* [PATCH v3 2/2] staging: rtl8723bs: fix line length and coding style issues
  2026-01-23 21:19 [PATCH v3 0/2] staging: rtl8723bs: cleanup and indentation refactoring Michael Huang
  2026-01-23 21:19 ` [PATCH v3 1/2] staging: rtl8723bs: refactor nested loops to reduce indentation Michael Huang
@ 2026-01-23 21:19 ` Michael Huang
  2026-01-24  6:51 ` [PATCH v3 0/2] staging: rtl8723bs: cleanup and indentation refactoring Greg Kroah-Hartman
  2026-01-24 10:49 ` [PATCH v4 " Michael Huang
  3 siblings, 0 replies; 20+ messages in thread
From: Michael Huang @ 2026-01-23 21:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Michael Huang

Fix checkpatch.pl warnings regarding line length exceeding 100
columns, white spaces, and unnecessary braces in rtw_mlme_ext.c.

Signed-off-by: Michael Huang <tehsiu.huang@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 81 ++++++++++---------
 1 file changed, 45 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 0ab3629608ce..848d503ffd1d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1120,11 +1120,10 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
 
 	pstat->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS);
 	if (!wpa_ie) {
-		if (elems.wps_ie) {
+		if (elems.wps_ie)
 			pstat->flags |= WLAN_STA_WPS;
-		} else {
+		else
 			pstat->flags |= WLAN_STA_MAYBE_WPS;
-		}
 
 
 		/*  AP support WPA/RSN, and sta is going to do WPS, but AP is not ready */
@@ -4939,7 +4938,9 @@ void _linked_info_dump(struct adapter *padapter)
 	if (padapter->bLinkInfoDump) {
 
 		if ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)
-			rtw_hal_get_def_var(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB);
+			rtw_hal_get_def_var(padapter,
+					    HAL_DEF_UNDERCORATEDSMOOTHEDPWDB,
+					    &UndecoratedSmoothedPWDB);
 
 		for (i = 0; i < NUM_STA; i++) {
 			if (pdvobj->macid[i]) {
@@ -4978,7 +4979,6 @@ void linked_status_chk(struct adapter *padapter)
 	struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 	struct sta_priv *pstapriv = &padapter->stapriv;
 
-
 	if (is_client_associated_to_ap(padapter)) {
 		/* linked infrastructure client mode */
 
@@ -4994,7 +4994,8 @@ void linked_status_chk(struct adapter *padapter)
 		link_count_limit = 7; /*  16 sec */
 
 		/*  Marked by Kurt 20130715 */
-		/*  For WiDi 3.5 and latered on, they don't ask WiDi sink to do roaming, so we could not check rx limit that strictly. */
+		/*  For WiDi 3.5 and latered on, they don't ask WiDi sink to do roaming, */
+		/* so we could not check rx limit that strictly. */
 		/*  todo: To check why we under miracast session, rx_chk would be false */
 		psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.mac_address);
 		if (psta) {
@@ -5007,9 +5008,18 @@ void linked_status_chk(struct adapter *padapter)
 			{
 				if (rx_chk != _SUCCESS) {
 					if (pmlmeext->retry == 0) {
-						issue_probereq_ex(padapter, &pmlmeinfo->network.ssid, pmlmeinfo->network.mac_address, 0, 0, 0, 0);
-						issue_probereq_ex(padapter, &pmlmeinfo->network.ssid, pmlmeinfo->network.mac_address, 0, 0, 0, 0);
-						issue_probereq_ex(padapter, &pmlmeinfo->network.ssid, pmlmeinfo->network.mac_address, 0, 0, 0, 0);
+						issue_probereq_ex(padapter,
+								  &pmlmeinfo->network.ssid,
+								  pmlmeinfo->network.mac_address,
+								  0, 0, 0, 0);
+						issue_probereq_ex(padapter,
+								  &pmlmeinfo->network.ssid,
+								  pmlmeinfo->network.mac_address,
+								  0, 0, 0, 0);
+						issue_probereq_ex(padapter,
+								  &pmlmeinfo->network.ssid,
+								  pmlmeinfo->network.mac_address,
+								  0, 0, 0, 0);
 					}
 				}
 
@@ -5033,7 +5043,7 @@ void linked_status_chk(struct adapter *padapter)
 			}
 
 			if (tx_chk == _FAIL) {
-				pmlmeinfo->link_count %= (link_count_limit+1);
+				pmlmeinfo->link_count %= (link_count_limit + 1);
 			} else {
 				pxmitpriv->last_tx_pkts = pxmitpriv->tx_pkts;
 				pmlmeinfo->link_count = 0;
@@ -5051,7 +5061,6 @@ void linked_status_chk(struct adapter *padapter)
 					continue;
 
 				if (pmlmeinfo->FW_sta_info[i].rx_pkt == sta_rx_pkts(psta)) {
-
 					if (pmlmeinfo->FW_sta_info[i].retry < 3) {
 						pmlmeinfo->FW_sta_info[i].retry++;
 					} else {
@@ -5069,9 +5078,7 @@ void linked_status_chk(struct adapter *padapter)
 		}
 
 		/* set_link_timer(pmlmeext, DISCONNECT_TO); */
-
 	}
-
 }
 
 void survey_timer_hdl(struct timer_list *t)
@@ -5195,7 +5202,7 @@ u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf)
 		type = _HW_STATE_AP_;
 		/* start_ap_mode(padapter); */
 	} else if (psetop->mode == Ndis802_11Infrastructure) {
-		pmlmeinfo->state &= ~(BIT(0)|BIT(1));/*  clear state */
+		pmlmeinfo->state &= ~(BIT(0) | BIT(1));/*  clear state */
 		pmlmeinfo->state |= WIFI_FW_STATION_STATE;/* set to	STATION_STATE */
 		type = _HW_STATE_STATION_;
 	} else if (psetop->mode == Ndis802_11IBSS) {
@@ -5214,7 +5221,6 @@ u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf)
 	}
 
 	return H2C_SUCCESS;
-
 }
 
 u8 createbss_hdl(struct adapter *padapter, u8 *pbuf)
@@ -5518,8 +5524,11 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf)
 
 		for (i = 0; i < RTW_SSID_SCAN_AMOUNT; i++) {
 			if (pparm->ssid[i].ssid_length) {
-				memcpy(pmlmeext->sitesurvey_res.ssid[i].ssid, pparm->ssid[i].ssid, IW_ESSID_MAX_SIZE);
-				pmlmeext->sitesurvey_res.ssid[i].ssid_length = pparm->ssid[i].ssid_length;
+				memcpy(pmlmeext->sitesurvey_res.ssid[i].ssid,
+				       pparm->ssid[i].ssid,
+				       IW_ESSID_MAX_SIZE);
+				pmlmeext->sitesurvey_res.ssid[i].ssid_length =
+					pparm->ssid[i].ssid_length;
 			} else {
 				pmlmeext->sitesurvey_res.ssid[i].ssid_length = 0;
 			}
@@ -5547,7 +5556,8 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf)
 		}
 	}
 
-	if ((pmlmeext->sitesurvey_res.state == SCAN_START) || (pmlmeext->sitesurvey_res.state == SCAN_TXNULL)) {
+	if ((pmlmeext->sitesurvey_res.state == SCAN_START) ||
+	    (pmlmeext->sitesurvey_res.state == SCAN_TXNULL)) {
 		/* disable dynamic functions, such as high power, DIG */
 		Save_DM_Func_Flag(padapter);
 		Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false);
@@ -5571,7 +5581,6 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf)
 	site_survey(padapter);
 
 	return H2C_SUCCESS;
-
 }
 
 u8 setauth_hdl(struct adapter *padapter, unsigned char *pbuf)
@@ -5701,7 +5710,6 @@ u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf)
 	return	H2C_SUCCESS;
 }
 
-
 u8 chk_bmc_sleepq_cmd(struct adapter *padapter)
 {
 	struct cmd_obj *ph2c;
@@ -5747,8 +5755,8 @@ u8 set_tx_beacon_cmd(struct adapter *padapter)
 
 	memcpy(&(ptxBeacon_parm->network), &(pmlmeinfo->network), sizeof(struct wlan_bssid_ex));
 
-	len_diff = update_hidden_ssid(ptxBeacon_parm->network.ies+_BEACON_IE_OFFSET_,
-				      ptxBeacon_parm->network.ie_length-_BEACON_IE_OFFSET_,
+	len_diff = update_hidden_ssid(ptxBeacon_parm->network.ies + _BEACON_IE_OFFSET_,
+				      ptxBeacon_parm->network.ie_length - _BEACON_IE_OFFSET_,
 				      pmlmeinfo->hidden_ssid_mode);
 	ptxBeacon_parm->network.ie_length += len_diff;
 
@@ -5803,8 +5811,8 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf)
 		goto _abort_event_;
 
 	peventbuf = (uint *)pbuf;
-	evt_sz = (u16)(*peventbuf&0xffff);
-	evt_code = (u8)((*peventbuf>>16)&0xff);
+	evt_sz = (u16)(*peventbuf & 0xffff);
+	evt_code = (u8)((*peventbuf >> 16) & 0xff);
 
 	/*  checking if event code is valid */
 	if (evt_code >= MAX_C2HEVT)
@@ -5812,7 +5820,7 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf)
 
 	/*  checking if event size match the event parm size */
 	if ((wlanevents[evt_code].parmsize != 0) &&
-			(wlanevents[evt_code].parmsize != evt_sz))
+	    (wlanevents[evt_code].parmsize != evt_sz))
 		goto _abort_event_;
 
 	atomic_inc(&pevt_priv->event_seq);
@@ -5826,12 +5834,8 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf)
 		pevt_priv->evt_done_cnt++;
 	}
 
-
 _abort_event_:
-
-
 	return H2C_SUCCESS;
-
 }
 
 u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf)
@@ -5855,7 +5859,7 @@ u8 chk_bmc_sleepq_hdl(struct adapter *padapter, unsigned char *pbuf)
 	if (!psta_bmc)
 		return H2C_SUCCESS;
 
-	if ((pstapriv->tim_bitmap&BIT(0)) && (psta_bmc->sleepq_len > 0)) {
+	if ((pstapriv->tim_bitmap & BIT(0)) && (psta_bmc->sleepq_len > 0)) {
 		msleep(10);/*  10ms, ATIM(HIQ) Windows */
 
 		/* spin_lock_bh(&psta_bmc->sleep_q.lock); */
@@ -5954,8 +5958,13 @@ u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf)
 
 	setChannelPlan_param = (struct SetChannelPlan_param *)pbuf;
 
-	pmlmeext->max_chan_nums = init_channel_set(padapter, setChannelPlan_param->channel_plan, pmlmeext->channel_set);
-	init_channel_list(padapter, pmlmeext->channel_set, pmlmeext->max_chan_nums, &pmlmeext->channel_list);
+	pmlmeext->max_chan_nums = init_channel_set(padapter,
+						   setChannelPlan_param->channel_plan,
+						   pmlmeext->channel_set);
+	init_channel_list(padapter,
+			  pmlmeext->channel_set,
+			  pmlmeext->max_chan_nums,
+			  &pmlmeext->channel_list);
 
 	if (padapter->rtw_wdev && padapter->rtw_wdev->wiphy) {
 		struct regulatory_request request;
@@ -5975,9 +5984,10 @@ u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf)
 /*  TDLS_ESTABLISHED	: write RCR DATA BIT */
 /*  TDLS_CS_OFF		: go back to the channel linked with AP, terminating channel switch procedure */
 /*  TDLS_INIT_CH_SEN	: init channel sensing, receive all data and mgnt frame */
-/*  TDLS_DONE_CH_SEN: channel sensing and report candidate channel */
+/*  TDLS_DONE_CH_SEN	: channel sensing and report candidate channel */
 /*  TDLS_OFF_CH		: first time set channel to off channel */
-/*  TDLS_BASE_CH		: go back tp the channel linked with AP when set base channel as target channel */
+/*  TDLS_BASE_CH	: go back tp the channel linked with AP when set */
+/*			  base channel as target channel */
 /*  TDLS_P_OFF_CH	: periodically go to off channel */
 /*  TDLS_P_BASE_CH	: periodically go back to base channel */
 /*  TDLS_RS_RCR		: restore RCR */
@@ -5991,8 +6001,7 @@ u8 run_in_thread_hdl(struct adapter *padapter, u8 *pbuf)
 {
 	struct RunInThread_param *p;
 
-
-	if (pbuf == NULL)
+	if (!pbuf)
 		return H2C_PARAMETERS_ERROR;
 	p = (struct RunInThread_param *)pbuf;
 
-- 
2.43.0


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

* Re: [PATCH v3 0/2] staging: rtl8723bs: cleanup and indentation refactoring
  2026-01-23 21:19 [PATCH v3 0/2] staging: rtl8723bs: cleanup and indentation refactoring Michael Huang
  2026-01-23 21:19 ` [PATCH v3 1/2] staging: rtl8723bs: refactor nested loops to reduce indentation Michael Huang
  2026-01-23 21:19 ` [PATCH v3 2/2] staging: rtl8723bs: fix line length and coding style issues Michael Huang
@ 2026-01-24  6:51 ` Greg Kroah-Hartman
  2026-01-24 10:49 ` [PATCH v4 " Michael Huang
  3 siblings, 0 replies; 20+ messages in thread
From: Greg Kroah-Hartman @ 2026-01-24  6:51 UTC (permalink / raw)
  To: Michael Huang; +Cc: linux-staging, linux-kernel

On Fri, Jan 23, 2026 at 01:19:02PM -0800, Michael Huang wrote:
> This series improves the code quality and readability of rtw_mlme_ext.c
> in the rtl8723bs driver.
> 
> The first patch refactors several deeply nested loops and if-statements
> by using guard clauses (continue statements). This flattens the logic
> and makes the code easier to follow.
> 
> The second patch addresses various style issues reported by
> checkpatch.pl, including line length exceeding 100 columns,
> unnecessary parentheses, and unnecessary braces.
> 
> Michael Huang (2):
>   staging: rtl8723bs: refactor nested loops to reduce indentation
>   staging: rtl8723bs: fix line length and coding style issues
> 
>  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 142 ++++++++++--------
>  1 file changed, 80 insertions(+), 62 deletions(-)
> 
> --
> 2.43.0
> 
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
  did not list below the --- line any changes from the previous version.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/process/submitting-patches.rst for what
  needs to be done here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

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

* [PATCH v4 0/2] staging: rtl8723bs: cleanup and indentation refactoring
  2026-01-23 21:19 [PATCH v3 0/2] staging: rtl8723bs: cleanup and indentation refactoring Michael Huang
                   ` (2 preceding siblings ...)
  2026-01-24  6:51 ` [PATCH v3 0/2] staging: rtl8723bs: cleanup and indentation refactoring Greg Kroah-Hartman
@ 2026-01-24 10:49 ` Michael Huang
  2026-01-24 10:49   ` [PATCH v4 1/2] staging: rtl8723bs: refactor nested loops to reduce indentation Michael Huang
                     ` (2 more replies)
  3 siblings, 3 replies; 20+ messages in thread
From: Michael Huang @ 2026-01-24 10:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Michael Huang

This series improves the code quality and readability of rtw_mlme_ext.c
in the rtl8723bs driver.

The first patch refactors several deeply nested loops and if-statements
by using guard clauses (continue statements). This flattens the logic
and makes the code easier to follow.

The second patch addresses various style issues reported by
checkpatch.pl, including line length exceeding 100 columns,
unnecessary parentheses, and unnecessary braces.

---
Changes in v4:
- Corrected the patch format by moving the changelog below the "---" line
  in individual patches as requested by the automated bot.
- This version (v4) serves as the initial clean public submission.

Changes in v3:
- Split changes into a logical two-patch series.
- Fixed commit message line wrapping (75 chars).
- Added missing Signed-off-by tags.
- Fixed line length and alignment issues in the code.

Michael Huang (2):
  staging: rtl8723bs: refactor nested loops to reduce indentation
  staging: rtl8723bs: fix line length and coding style issues

 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 142 ++++++++++--------
 1 file changed, 80 insertions(+), 62 deletions(-)

--
2.43.0


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

* [PATCH v4 1/2] staging: rtl8723bs: refactor nested loops to reduce indentation
  2026-01-24 10:49 ` [PATCH v4 " Michael Huang
@ 2026-01-24 10:49   ` Michael Huang
  2026-01-24 10:49   ` [PATCH v4 2/2] staging: rtl8723bs: fix line length and coding style issues Michael Huang
  2026-01-24 23:15   ` [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring Michael Huang
  2 siblings, 0 replies; 20+ messages in thread
From: Michael Huang @ 2026-01-24 10:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Michael Huang

Use guard clauses (continue statements) to flatten the logic in
rtw_mlme_ext.c. This improves code readability by reducing deep
nesting levels.

Signed-off-by: Michael Huang <tehsiu.huang@gmail.com>
---
Changes in v4:
- Fix canonical patch format by moving the changelog below the "---" line.
- Initial public submission (corrected versioning).

Changes in v3:
- Fix line wrapping in commit description (under 75 chars).
- Properly align multi-line function parameters.
- Remove unnecessary parentheses.
- Add missing Signed-off-by tag.

 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 61 +++++++++++--------
 1 file changed, 35 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index fa1e3ad59254..0ab3629608ce 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -3682,32 +3682,31 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter)

 		spin_unlock_bh(&(pmlmepriv->scanned_queue.lock));

-
 		for (i = 0; i < 8; i++) {
-			if (ICS[i][0] == 1) {
-				int j, k = 0;
+			int j, k = 0;

-				InfoContent[k] = i;
-				/* SET_BSS_INTOLERANT_ELE_REG_CLASS(InfoContent, i); */
-				k++;
+			if (ICS[i][0] != 1)
+				continue;

-				for (j = 1; j <= 14; j++) {
-					if (ICS[i][j] == 1) {
-						if (k < 16) {
-							InfoContent[k] = j; /* channel number */
-							/* SET_BSS_INTOLERANT_ELE_CHANNEL(InfoContent+k, j); */
-							k++;
-						}
-					}
-				}
+			InfoContent[k] = i;
+			/* SET_BSS_INTOLERANT_ELE_REG_CLASS(InfoContent, i); */
+			k++;

-				pframe = rtw_set_ie(pframe, WLAN_EID_BSS_INTOLERANT_CHL_REPORT, k, InfoContent, &(pattrib->pktlen));
+			for (j = 1; j <= 14; j++) {
+				if (ICS[i][j] != 1)
+					continue;

+				if (k < 16) {
+					InfoContent[k] = j; /* channel number */
+					/* SET_BSS_INTOLERANT_ELE_CHANNEL(InfoContent+k, j); */
+					k++;
+				}
 			}

+			pframe = rtw_set_ie(pframe,
+					    WLAN_EID_BSS_INTOLERANT_CHL_REPORT,
+					    k, InfoContent, &pattrib->pktlen);
 		}
-
-
 	}


@@ -3831,14 +3830,24 @@ void site_survey(struct adapter *padapter)
 				int i;

 				for (i = 0; i < RTW_SSID_SCAN_AMOUNT; i++) {
-					if (pmlmeext->sitesurvey_res.ssid[i].ssid_length) {
-						/* 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);
-						else
-							issue_probereq_ex(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL, 0, 0, 0, 0);
-						issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL);
-					}
+					if (!pmlmeext->sitesurvey_res.ssid[i].ssid_length)
+						continue;
+
+					/* 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);
+					else
+						issue_probereq_ex(padapter,
+								  &pmlmeext->sitesurvey_res.ssid[i],
+								  NULL,
+								  0, 0, 0, 0);
+
+					issue_probereq(padapter,
+						       &pmlmeext->sitesurvey_res.ssid[i],
+						       NULL);
 				}

 				if (pmlmeext->sitesurvey_res.scan_mode == SCAN_ACTIVE) {
--
2.43.0


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

* [PATCH v4 2/2] staging: rtl8723bs: fix line length and coding style issues
  2026-01-24 10:49 ` [PATCH v4 " Michael Huang
  2026-01-24 10:49   ` [PATCH v4 1/2] staging: rtl8723bs: refactor nested loops to reduce indentation Michael Huang
@ 2026-01-24 10:49   ` Michael Huang
  2026-01-24 11:02     ` Dan Carpenter
  2026-01-24 23:15   ` [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring Michael Huang
  2 siblings, 1 reply; 20+ messages in thread
From: Michael Huang @ 2026-01-24 10:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Michael Huang

Fix checkpatch.pl warnings regarding line length exceeding 100
columns, white spaces, and unnecessary braces in rtw_mlme_ext.c.

Signed-off-by: Michael Huang <tehsiu.huang@gmail.com>
---
Changes in v4:
- Fix canonical patch format by moving the changelog below the "---" line.
- Initial public submission (corrected versioning).

Changes in v3:
- Fix line wrapping in commit description (under 75 chars).
- Fix line length exceeding 100 columns in comments.
- Add missing Signed-off-by tag.

 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 81 ++++++++++---------
 1 file changed, 45 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 0ab3629608ce..848d503ffd1d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1120,11 +1120,10 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)

 	pstat->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS);
 	if (!wpa_ie) {
-		if (elems.wps_ie) {
+		if (elems.wps_ie)
 			pstat->flags |= WLAN_STA_WPS;
-		} else {
+		else
 			pstat->flags |= WLAN_STA_MAYBE_WPS;
-		}


 		/*  AP support WPA/RSN, and sta is going to do WPS, but AP is not ready */
@@ -4939,7 +4938,9 @@ void _linked_info_dump(struct adapter *padapter)
 	if (padapter->bLinkInfoDump) {

 		if ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)
-			rtw_hal_get_def_var(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB);
+			rtw_hal_get_def_var(padapter,
+					    HAL_DEF_UNDERCORATEDSMOOTHEDPWDB,
+					    &UndecoratedSmoothedPWDB);

 		for (i = 0; i < NUM_STA; i++) {
 			if (pdvobj->macid[i]) {
@@ -4978,7 +4979,6 @@ void linked_status_chk(struct adapter *padapter)
 	struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 	struct sta_priv *pstapriv = &padapter->stapriv;

-
 	if (is_client_associated_to_ap(padapter)) {
 		/* linked infrastructure client mode */

@@ -4994,7 +4994,8 @@ void linked_status_chk(struct adapter *padapter)
 		link_count_limit = 7; /*  16 sec */

 		/*  Marked by Kurt 20130715 */
-		/*  For WiDi 3.5 and latered on, they don't ask WiDi sink to do roaming, so we could not check rx limit that strictly. */
+		/*  For WiDi 3.5 and latered on, they don't ask WiDi sink to do roaming, */
+		/* so we could not check rx limit that strictly. */
 		/*  todo: To check why we under miracast session, rx_chk would be false */
 		psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.mac_address);
 		if (psta) {
@@ -5007,9 +5008,18 @@ void linked_status_chk(struct adapter *padapter)
 			{
 				if (rx_chk != _SUCCESS) {
 					if (pmlmeext->retry == 0) {
-						issue_probereq_ex(padapter, &pmlmeinfo->network.ssid, pmlmeinfo->network.mac_address, 0, 0, 0, 0);
-						issue_probereq_ex(padapter, &pmlmeinfo->network.ssid, pmlmeinfo->network.mac_address, 0, 0, 0, 0);
-						issue_probereq_ex(padapter, &pmlmeinfo->network.ssid, pmlmeinfo->network.mac_address, 0, 0, 0, 0);
+						issue_probereq_ex(padapter,
+								  &pmlmeinfo->network.ssid,
+								  pmlmeinfo->network.mac_address,
+								  0, 0, 0, 0);
+						issue_probereq_ex(padapter,
+								  &pmlmeinfo->network.ssid,
+								  pmlmeinfo->network.mac_address,
+								  0, 0, 0, 0);
+						issue_probereq_ex(padapter,
+								  &pmlmeinfo->network.ssid,
+								  pmlmeinfo->network.mac_address,
+								  0, 0, 0, 0);
 					}
 				}

@@ -5033,7 +5043,7 @@ void linked_status_chk(struct adapter *padapter)
 			}

 			if (tx_chk == _FAIL) {
-				pmlmeinfo->link_count %= (link_count_limit+1);
+				pmlmeinfo->link_count %= (link_count_limit + 1);
 			} else {
 				pxmitpriv->last_tx_pkts = pxmitpriv->tx_pkts;
 				pmlmeinfo->link_count = 0;
@@ -5051,7 +5061,6 @@ void linked_status_chk(struct adapter *padapter)
 					continue;

 				if (pmlmeinfo->FW_sta_info[i].rx_pkt == sta_rx_pkts(psta)) {
-
 					if (pmlmeinfo->FW_sta_info[i].retry < 3) {
 						pmlmeinfo->FW_sta_info[i].retry++;
 					} else {
@@ -5069,9 +5078,7 @@ void linked_status_chk(struct adapter *padapter)
 		}

 		/* set_link_timer(pmlmeext, DISCONNECT_TO); */
-
 	}
-
 }

 void survey_timer_hdl(struct timer_list *t)
@@ -5195,7 +5202,7 @@ u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf)
 		type = _HW_STATE_AP_;
 		/* start_ap_mode(padapter); */
 	} else if (psetop->mode == Ndis802_11Infrastructure) {
-		pmlmeinfo->state &= ~(BIT(0)|BIT(1));/*  clear state */
+		pmlmeinfo->state &= ~(BIT(0) | BIT(1));/*  clear state */
 		pmlmeinfo->state |= WIFI_FW_STATION_STATE;/* set to	STATION_STATE */
 		type = _HW_STATE_STATION_;
 	} else if (psetop->mode == Ndis802_11IBSS) {
@@ -5214,7 +5221,6 @@ u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf)
 	}

 	return H2C_SUCCESS;
-
 }

 u8 createbss_hdl(struct adapter *padapter, u8 *pbuf)
@@ -5518,8 +5524,11 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf)

 		for (i = 0; i < RTW_SSID_SCAN_AMOUNT; i++) {
 			if (pparm->ssid[i].ssid_length) {
-				memcpy(pmlmeext->sitesurvey_res.ssid[i].ssid, pparm->ssid[i].ssid, IW_ESSID_MAX_SIZE);
-				pmlmeext->sitesurvey_res.ssid[i].ssid_length = pparm->ssid[i].ssid_length;
+				memcpy(pmlmeext->sitesurvey_res.ssid[i].ssid,
+				       pparm->ssid[i].ssid,
+				       IW_ESSID_MAX_SIZE);
+				pmlmeext->sitesurvey_res.ssid[i].ssid_length =
+					pparm->ssid[i].ssid_length;
 			} else {
 				pmlmeext->sitesurvey_res.ssid[i].ssid_length = 0;
 			}
@@ -5547,7 +5556,8 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf)
 		}
 	}

-	if ((pmlmeext->sitesurvey_res.state == SCAN_START) || (pmlmeext->sitesurvey_res.state == SCAN_TXNULL)) {
+	if ((pmlmeext->sitesurvey_res.state == SCAN_START) ||
+	    (pmlmeext->sitesurvey_res.state == SCAN_TXNULL)) {
 		/* disable dynamic functions, such as high power, DIG */
 		Save_DM_Func_Flag(padapter);
 		Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false);
@@ -5571,7 +5581,6 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf)
 	site_survey(padapter);

 	return H2C_SUCCESS;
-
 }

 u8 setauth_hdl(struct adapter *padapter, unsigned char *pbuf)
@@ -5701,7 +5710,6 @@ u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf)
 	return	H2C_SUCCESS;
 }

-
 u8 chk_bmc_sleepq_cmd(struct adapter *padapter)
 {
 	struct cmd_obj *ph2c;
@@ -5747,8 +5755,8 @@ u8 set_tx_beacon_cmd(struct adapter *padapter)

 	memcpy(&(ptxBeacon_parm->network), &(pmlmeinfo->network), sizeof(struct wlan_bssid_ex));

-	len_diff = update_hidden_ssid(ptxBeacon_parm->network.ies+_BEACON_IE_OFFSET_,
-				      ptxBeacon_parm->network.ie_length-_BEACON_IE_OFFSET_,
+	len_diff = update_hidden_ssid(ptxBeacon_parm->network.ies + _BEACON_IE_OFFSET_,
+				      ptxBeacon_parm->network.ie_length - _BEACON_IE_OFFSET_,
 				      pmlmeinfo->hidden_ssid_mode);
 	ptxBeacon_parm->network.ie_length += len_diff;

@@ -5803,8 +5811,8 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf)
 		goto _abort_event_;

 	peventbuf = (uint *)pbuf;
-	evt_sz = (u16)(*peventbuf&0xffff);
-	evt_code = (u8)((*peventbuf>>16)&0xff);
+	evt_sz = (u16)(*peventbuf & 0xffff);
+	evt_code = (u8)((*peventbuf >> 16) & 0xff);

 	/*  checking if event code is valid */
 	if (evt_code >= MAX_C2HEVT)
@@ -5812,7 +5820,7 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf)

 	/*  checking if event size match the event parm size */
 	if ((wlanevents[evt_code].parmsize != 0) &&
-			(wlanevents[evt_code].parmsize != evt_sz))
+	    (wlanevents[evt_code].parmsize != evt_sz))
 		goto _abort_event_;

 	atomic_inc(&pevt_priv->event_seq);
@@ -5826,12 +5834,8 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf)
 		pevt_priv->evt_done_cnt++;
 	}

-
 _abort_event_:
-
-
 	return H2C_SUCCESS;
-
 }

 u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf)
@@ -5855,7 +5859,7 @@ u8 chk_bmc_sleepq_hdl(struct adapter *padapter, unsigned char *pbuf)
 	if (!psta_bmc)
 		return H2C_SUCCESS;

-	if ((pstapriv->tim_bitmap&BIT(0)) && (psta_bmc->sleepq_len > 0)) {
+	if ((pstapriv->tim_bitmap & BIT(0)) && (psta_bmc->sleepq_len > 0)) {
 		msleep(10);/*  10ms, ATIM(HIQ) Windows */

 		/* spin_lock_bh(&psta_bmc->sleep_q.lock); */
@@ -5954,8 +5958,13 @@ u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf)

 	setChannelPlan_param = (struct SetChannelPlan_param *)pbuf;

-	pmlmeext->max_chan_nums = init_channel_set(padapter, setChannelPlan_param->channel_plan, pmlmeext->channel_set);
-	init_channel_list(padapter, pmlmeext->channel_set, pmlmeext->max_chan_nums, &pmlmeext->channel_list);
+	pmlmeext->max_chan_nums = init_channel_set(padapter,
+						   setChannelPlan_param->channel_plan,
+						   pmlmeext->channel_set);
+	init_channel_list(padapter,
+			  pmlmeext->channel_set,
+			  pmlmeext->max_chan_nums,
+			  &pmlmeext->channel_list);

 	if (padapter->rtw_wdev && padapter->rtw_wdev->wiphy) {
 		struct regulatory_request request;
@@ -5975,9 +5984,10 @@ u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf)
 /*  TDLS_ESTABLISHED	: write RCR DATA BIT */
 /*  TDLS_CS_OFF		: go back to the channel linked with AP, terminating channel switch procedure */
 /*  TDLS_INIT_CH_SEN	: init channel sensing, receive all data and mgnt frame */
-/*  TDLS_DONE_CH_SEN: channel sensing and report candidate channel */
+/*  TDLS_DONE_CH_SEN	: channel sensing and report candidate channel */
 /*  TDLS_OFF_CH		: first time set channel to off channel */
-/*  TDLS_BASE_CH		: go back tp the channel linked with AP when set base channel as target channel */
+/*  TDLS_BASE_CH	: go back tp the channel linked with AP when set */
+/*			  base channel as target channel */
 /*  TDLS_P_OFF_CH	: periodically go to off channel */
 /*  TDLS_P_BASE_CH	: periodically go back to base channel */
 /*  TDLS_RS_RCR		: restore RCR */
@@ -5991,8 +6001,7 @@ u8 run_in_thread_hdl(struct adapter *padapter, u8 *pbuf)
 {
 	struct RunInThread_param *p;

-
-	if (pbuf == NULL)
+	if (!pbuf)
 		return H2C_PARAMETERS_ERROR;
 	p = (struct RunInThread_param *)pbuf;

--
2.43.0


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

* Re: [PATCH v3 1/2] staging: rtl8723bs: refactor nested loops to reduce indentation
  2026-01-23 21:19 ` [PATCH v3 1/2] staging: rtl8723bs: refactor nested loops to reduce indentation Michael Huang
@ 2026-01-24 10:59   ` Dan Carpenter
  0 siblings, 0 replies; 20+ messages in thread
From: Dan Carpenter @ 2026-01-24 10:59 UTC (permalink / raw)
  To: Michael Huang; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel

On Fri, Jan 23, 2026 at 01:19:03PM -0800, Michael Huang wrote:
> Use guard clauses (continue statements) to flatten the logic in

Just say continue statements.  I saw "Use guard" and thought you
were going to use "guard statements" which is a different thing in
the kernel.

> rtw_mlme_ext.c. This improves code readability by reducing deep
> nesting levels.
> 
> Signed-off-by: Michael Huang <tehsiu.huang@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 61 +++++++++++--------
>  1 file changed, 35 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> index fa1e3ad59254..0ab3629608ce 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> @@ -3682,32 +3682,31 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter)
>  
>  		spin_unlock_bh(&(pmlmepriv->scanned_queue.lock));
>  
> -
>  		for (i = 0; i < 8; i++) {
> -			if (ICS[i][0] == 1) {
> -				int j, k = 0;
> +			int j, k = 0;
>  
> -				InfoContent[k] = i;
> -				/* SET_BSS_INTOLERANT_ELE_REG_CLASS(InfoContent, i); */
> -				k++;
> +			if (ICS[i][0] != 1)
> +				continue;
>  
> -				for (j = 1; j <= 14; j++) {
> -					if (ICS[i][j] == 1) {
> -						if (k < 16) {
> -							InfoContent[k] = j; /* channel number */
> -							/* SET_BSS_INTOLERANT_ELE_CHANNEL(InfoContent+k, j); */
> -							k++;
> -						}
> -					}
> -				}
> +			InfoContent[k] = i;
> +			/* SET_BSS_INTOLERANT_ELE_REG_CLASS(InfoContent, i); */
> +			k++;
>  
> -				pframe = rtw_set_ie(pframe, WLAN_EID_BSS_INTOLERANT_CHL_REPORT, k, InfoContent, &(pattrib->pktlen));
> +			for (j = 1; j <= 14; j++) {
> +				if (ICS[i][j] != 1)
> +					continue;
>  
> +				if (k < 16) {
> +					InfoContent[k] = j; /* channel number */
> +					/* SET_BSS_INTOLERANT_ELE_CHANNEL(InfoContent+k, j); */
> +					k++;
> +				}
>  			}
>  
> +			pframe = rtw_set_ie(pframe,
> +					    WLAN_EID_BSS_INTOLERANT_CHL_REPORT,
> +					    k, InfoContent, &pattrib->pktlen);

This is unrelated.  Do it in a separate patch.

>  		}
> -
> -
>  	}
>  
>  
> @@ -3831,14 +3830,24 @@ void site_survey(struct adapter *padapter)
>  				int i;
>  
>  				for (i = 0; i < RTW_SSID_SCAN_AMOUNT; i++) {
> -					if (pmlmeext->sitesurvey_res.ssid[i].ssid_length) {
> -						/* 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);
> -						else
> -							issue_probereq_ex(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL, 0, 0, 0, 0);
> -						issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL);
> -					}
> +					if (!pmlmeext->sitesurvey_res.ssid[i].ssid_length)
> +						continue;
> +
> +					/* IOT issue, When wifi_spec is not set. */
> +					/* Send one probe req without WPS IE. */

You can flip the conditions around without rephrasing the comments.
Do that in a separate patch.

> +					if (padapter->registrypriv.wifi_spec)
> +						issue_probereq(padapter,
> +							       &pmlmeext->sitesurvey_res.ssid[i],
> +							       NULL);

All these reformating and removing extra parens makes the patch harder
to review.  I understand that checkpatch complains if you don't do it,
but it's unrelated to the change you are making so it needs to be done
in a separate step.  (I'm not your boss and I can't tell you what to
do.  If you don't want to do the second step you can also skip it.  The
point is don't do unrelated things in the same patch).

regards,
dan carpenter


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

* Re: [PATCH v4 2/2] staging: rtl8723bs: fix line length and coding style issues
  2026-01-24 10:49   ` [PATCH v4 2/2] staging: rtl8723bs: fix line length and coding style issues Michael Huang
@ 2026-01-24 11:02     ` Dan Carpenter
  0 siblings, 0 replies; 20+ messages in thread
From: Dan Carpenter @ 2026-01-24 11:02 UTC (permalink / raw)
  To: Michael Huang; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel

On Sat, Jan 24, 2026 at 02:49:20AM -0800, Michael Huang wrote:
> Fix checkpatch.pl warnings regarding line length exceeding 100
> columns, white spaces, and unnecessary braces in rtw_mlme_ext.c.

Fix one type of warning per patch.

regards,
dan carpenter


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

* [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring
  2026-01-24 10:49 ` [PATCH v4 " Michael Huang
  2026-01-24 10:49   ` [PATCH v4 1/2] staging: rtl8723bs: refactor nested loops to reduce indentation Michael Huang
  2026-01-24 10:49   ` [PATCH v4 2/2] staging: rtl8723bs: fix line length and coding style issues Michael Huang
@ 2026-01-24 23:15   ` Michael Huang
  2026-01-24 23:15     ` [PATCH v5 1/7] staging: rtl8723bs: use continue statements to reduce indentation Michael Huang
                       ` (7 more replies)
  2 siblings, 8 replies; 20+ messages in thread
From: Michael Huang @ 2026-01-24 23:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Dan Carpenter, linux-staging, linux-kernel, Michael Huang

This series refactors the function in rtw_mlme_ext.c to
improve readability and comply with Linux kernel coding standards.

Following feedback from Dan Carpenter, this version (v5) deconstructs
the previous changes into seven atomic patches. This separation ensures
that logical changes (such as flattening nested loops) are isolated
from purely stylistic cleanups (such as fixing indentation or NULL
checks), making the review process more straightforward and less
error-prone.

Each patch focuses on a single category of improvement:
1. Logic flattening: Use continue statements to reduce indentation.
2. Comment positioning: Adjust comments to align with new logic.
3. New lines cleanup: Removed unnecessary new lines
4. Line length compliance: Resolve 100-column limit warnings.
5. Operator spacing: Add missing spaces around logical operators.
6. Braces removal: Clean up unnecessary braces in single-line branches.
7. NULL check simplification: Use the "!ptr" convention for brevity.

---
Changes in v5:
- Split the series into 7 atomic patches for easier review.
- Renamed "guard clauses" to "continue statements" description per feedback.
- Separated logic changes, comment refactoring, and style cleanups.
- Fixed indentation issues (replaced spaces with tabs).
- Simplified NULL pointer checks to use the !ptr convention.

Changes in v4:
- Corrected the patch format by moving the changelog below the "---" line.
- Initial clean public submission of this series.


Michael Huang (7):
  staging: rtl8723bs: use continue statements to reduce indentation
  staging: rtl8723bs: refactor comments to fix the line length warning
    for exceeding 100 columns
  staging: rtl8723bs: remove unnecessary new lines
  staging: rtl8723bs: Fix the line length exceeding 100 columns warning
    in the code
  staging: rtl8723bs: add missing space around operators
  staging: rtl8723bs: remove unnecessary braces
  staging: rtl8723bs: use !ptr instead of ptr == NULL

 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 129 ++++++++++--------
 1 file changed, 70 insertions(+), 59 deletions(-)

--
2.43.0


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

* [PATCH v5 1/7] staging: rtl8723bs: use continue statements to reduce indentation
  2026-01-24 23:15   ` [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring Michael Huang
@ 2026-01-24 23:15     ` Michael Huang
  2026-01-25 18:13       ` Joe Perches
  2026-01-24 23:15     ` [PATCH v5 2/7] staging: rtl8723bs: refactor comments to fix the line length warning for exceeding 100 columns Michael Huang
                       ` (6 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Michael Huang @ 2026-01-24 23:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Dan Carpenter, linux-staging, linux-kernel, Michael Huang

Refactor nested if-statements using "continue"
statements. This flattens the logic, reduces deep indentation,
and improves overall code readability.

Signed-off-by: Michael Huang <tehsiu.huang@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 48 ++++++++++---------
 1 file changed, 25 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index fa1e3ad59254..d80c1a2620e2 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -3684,29 +3684,29 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter)
 
 
 		for (i = 0; i < 8; i++) {
-			if (ICS[i][0] == 1) {
-				int j, k = 0;
+			int j, k = 0;
 
-				InfoContent[k] = i;
-				/* SET_BSS_INTOLERANT_ELE_REG_CLASS(InfoContent, i); */
-				k++;
+			if (ICS[i][0] != 1)
+				continue;
 
-				for (j = 1; j <= 14; j++) {
-					if (ICS[i][j] == 1) {
-						if (k < 16) {
-							InfoContent[k] = j; /* channel number */
-							/* SET_BSS_INTOLERANT_ELE_CHANNEL(InfoContent+k, j); */
-							k++;
-						}
-					}
-				}
+			InfoContent[k] = i;
+			/* SET_BSS_INTOLERANT_ELE_REG_CLASS(InfoContent, i); */
+			k++;
 
-				pframe = rtw_set_ie(pframe, WLAN_EID_BSS_INTOLERANT_CHL_REPORT, k, InfoContent, &(pattrib->pktlen));
+			for (j = 1; j <= 14; j++) {
+				if (ICS[i][j] != 1)
+					continue;
 
+				if (k < 16) {
+					InfoContent[k] = j; /* channel number */
+					/* SET_BSS_INTOLERANT_ELE_CHANNEL(InfoContent+k, j); */
+					k++;
+				}
 			}
 
-		}
+			pframe = rtw_set_ie(pframe, WLAN_EID_BSS_INTOLERANT_CHL_REPORT, k, InfoContent, &(pattrib->pktlen));
 
+		}
 
 	}
 
@@ -3831,14 +3831,16 @@ void site_survey(struct adapter *padapter)
 				int i;
 
 				for (i = 0; i < RTW_SSID_SCAN_AMOUNT; i++) {
-					if (pmlmeext->sitesurvey_res.ssid[i].ssid_length) {
-						/* 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);
-						else
-							issue_probereq_ex(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL, 0, 0, 0, 0);
+					if (!pmlmeext->sitesurvey_res.ssid[i].ssid_length)
+						continue;
+
+					/* 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);
-					}
+					else
+						issue_probereq_ex(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL, 0, 0, 0, 0);
+
+					issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL);
 				}
 
 				if (pmlmeext->sitesurvey_res.scan_mode == SCAN_ACTIVE) {
-- 
2.43.0


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

* [PATCH v5 2/7] staging: rtl8723bs: refactor comments to fix the line length warning for exceeding 100 columns
  2026-01-24 23:15   ` [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring Michael Huang
  2026-01-24 23:15     ` [PATCH v5 1/7] staging: rtl8723bs: use continue statements to reduce indentation Michael Huang
@ 2026-01-24 23:15     ` Michael Huang
  2026-01-24 23:15     ` [PATCH v5 3/7] staging: rtl8723bs: remove unnecessary new lines Michael Huang
                       ` (5 subsequent siblings)
  7 siblings, 0 replies; 20+ messages in thread
From: Michael Huang @ 2026-01-24 23:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Dan Carpenter, linux-staging, linux-kernel, Michael Huang

Adjust the positioning and formatting of comments to align with the
flattened code structure. This ensures comments remain relevant and
clear following the logic refactoring.

Signed-off-by: Michael Huang <tehsiu.huang@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index d80c1a2620e2..4039504ad666 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -4987,7 +4987,8 @@ void linked_status_chk(struct adapter *padapter)
 		link_count_limit = 7; /*  16 sec */
 
 		/*  Marked by Kurt 20130715 */
-		/*  For WiDi 3.5 and latered on, they don't ask WiDi sink to do roaming, so we could not check rx limit that strictly. */
+		/*  For WiDi 3.5 and latered on, they don't ask WiDi sink to do roaming, */
+		/* so we could not check rx limit that strictly. */
 		/*  todo: To check why we under miracast session, rx_chk would be false */
 		psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.mac_address);
 		if (psta) {
@@ -5968,9 +5969,10 @@ u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf)
 /*  TDLS_ESTABLISHED	: write RCR DATA BIT */
 /*  TDLS_CS_OFF		: go back to the channel linked with AP, terminating channel switch procedure */
 /*  TDLS_INIT_CH_SEN	: init channel sensing, receive all data and mgnt frame */
-/*  TDLS_DONE_CH_SEN: channel sensing and report candidate channel */
+/*  TDLS_DONE_CH_SEN	: channel sensing and report candidate channel */
 /*  TDLS_OFF_CH		: first time set channel to off channel */
-/*  TDLS_BASE_CH		: go back tp the channel linked with AP when set base channel as target channel */
+/*  TDLS_BASE_CH	: go back tp the channel linked with AP when set */
+/*			  base channel as target channel */
 /*  TDLS_P_OFF_CH	: periodically go to off channel */
 /*  TDLS_P_BASE_CH	: periodically go back to base channel */
 /*  TDLS_RS_RCR		: restore RCR */
-- 
2.43.0


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

* [PATCH v5 3/7] staging: rtl8723bs: remove unnecessary new lines
  2026-01-24 23:15   ` [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring Michael Huang
  2026-01-24 23:15     ` [PATCH v5 1/7] staging: rtl8723bs: use continue statements to reduce indentation Michael Huang
  2026-01-24 23:15     ` [PATCH v5 2/7] staging: rtl8723bs: refactor comments to fix the line length warning for exceeding 100 columns Michael Huang
@ 2026-01-24 23:15     ` Michael Huang
  2026-01-24 23:15     ` [PATCH v5 4/7] staging: rtl8723bs: Fix the line length exceeding 100 columns warning in the code Michael Huang
                       ` (4 subsequent siblings)
  7 siblings, 0 replies; 20+ messages in thread
From: Michael Huang @ 2026-01-24 23:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Dan Carpenter, linux-staging, linux-kernel, Michael Huang

Removed the unnecessary new lines

Signed-off-by: Michael Huang <tehsiu.huang@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 4039504ad666..bc0c9ee801e1 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -4971,7 +4971,6 @@ void linked_status_chk(struct adapter *padapter)
 	struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 	struct sta_priv *pstapriv = &padapter->stapriv;
 
-
 	if (is_client_associated_to_ap(padapter)) {
 		/* linked infrastructure client mode */
 
@@ -5045,7 +5044,6 @@ void linked_status_chk(struct adapter *padapter)
 					continue;
 
 				if (pmlmeinfo->FW_sta_info[i].rx_pkt == sta_rx_pkts(psta)) {
-
 					if (pmlmeinfo->FW_sta_info[i].retry < 3) {
 						pmlmeinfo->FW_sta_info[i].retry++;
 					} else {
@@ -5063,9 +5061,7 @@ void linked_status_chk(struct adapter *padapter)
 		}
 
 		/* set_link_timer(pmlmeext, DISCONNECT_TO); */
-
 	}
-
 }
 
 void survey_timer_hdl(struct timer_list *t)
@@ -5208,7 +5204,6 @@ u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf)
 	}
 
 	return H2C_SUCCESS;
-
 }
 
 u8 createbss_hdl(struct adapter *padapter, u8 *pbuf)
@@ -5565,7 +5560,6 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf)
 	site_survey(padapter);
 
 	return H2C_SUCCESS;
-
 }
 
 u8 setauth_hdl(struct adapter *padapter, unsigned char *pbuf)
@@ -5695,7 +5689,6 @@ u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf)
 	return	H2C_SUCCESS;
 }
 
-
 u8 chk_bmc_sleepq_cmd(struct adapter *padapter)
 {
 	struct cmd_obj *ph2c;
@@ -5820,12 +5813,8 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf)
 		pevt_priv->evt_done_cnt++;
 	}
 
-
 _abort_event_:
-
-
 	return H2C_SUCCESS;
-
 }
 
 u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf)
-- 
2.43.0


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

* [PATCH v5 4/7] staging: rtl8723bs: Fix the line length exceeding 100 columns warning in the code
  2026-01-24 23:15   ` [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring Michael Huang
                       ` (2 preceding siblings ...)
  2026-01-24 23:15     ` [PATCH v5 3/7] staging: rtl8723bs: remove unnecessary new lines Michael Huang
@ 2026-01-24 23:15     ` Michael Huang
  2026-01-24 23:15     ` [PATCH v5 5/7] staging: rtl8723bs: add missing space around operators Michael Huang
                       ` (3 subsequent siblings)
  7 siblings, 0 replies; 20+ messages in thread
From: Michael Huang @ 2026-01-24 23:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Dan Carpenter, linux-staging, linux-kernel, Michael Huang

Split lines that exceed the 100-character limit into multiple lines.
This resolves checkpatch.pl warnings and improves the visual layout
of the source code.

Signed-off-by: Michael Huang <tehsiu.huang@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 40 ++++++++++++++-----
 1 file changed, 30 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index bc0c9ee801e1..7f9251583a97 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -4932,7 +4932,9 @@ void _linked_info_dump(struct adapter *padapter)
 	if (padapter->bLinkInfoDump) {
 
 		if ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)
-			rtw_hal_get_def_var(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB);
+			rtw_hal_get_def_var(padapter,
+					    HAL_DEF_UNDERCORATEDSMOOTHEDPWDB,
+					    &UndecoratedSmoothedPWDB);
 
 		for (i = 0; i < NUM_STA; i++) {
 			if (pdvobj->macid[i]) {
@@ -5000,9 +5002,18 @@ void linked_status_chk(struct adapter *padapter)
 			{
 				if (rx_chk != _SUCCESS) {
 					if (pmlmeext->retry == 0) {
-						issue_probereq_ex(padapter, &pmlmeinfo->network.ssid, pmlmeinfo->network.mac_address, 0, 0, 0, 0);
-						issue_probereq_ex(padapter, &pmlmeinfo->network.ssid, pmlmeinfo->network.mac_address, 0, 0, 0, 0);
-						issue_probereq_ex(padapter, &pmlmeinfo->network.ssid, pmlmeinfo->network.mac_address, 0, 0, 0, 0);
+						issue_probereq_ex(padapter,
+								  &pmlmeinfo->network.ssid,
+								  pmlmeinfo->network.mac_address,
+								  0, 0, 0, 0);
+						issue_probereq_ex(padapter,
+								  &pmlmeinfo->network.ssid,
+								  pmlmeinfo->network.mac_address,
+								  0, 0, 0, 0);
+						issue_probereq_ex(padapter,
+								  &pmlmeinfo->network.ssid,
+								  pmlmeinfo->network.mac_address,
+								  0, 0, 0, 0);
 					}
 				}
 
@@ -5507,8 +5518,11 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf)
 
 		for (i = 0; i < RTW_SSID_SCAN_AMOUNT; i++) {
 			if (pparm->ssid[i].ssid_length) {
-				memcpy(pmlmeext->sitesurvey_res.ssid[i].ssid, pparm->ssid[i].ssid, IW_ESSID_MAX_SIZE);
-				pmlmeext->sitesurvey_res.ssid[i].ssid_length = pparm->ssid[i].ssid_length;
+				memcpy(pmlmeext->sitesurvey_res.ssid[i].ssid,
+				       pparm->ssid[i].ssid,
+				       IW_ESSID_MAX_SIZE);
+				pmlmeext->sitesurvey_res.ssid[i].ssid_length =
+					pparm->ssid[i].ssid_length;
 			} else {
 				pmlmeext->sitesurvey_res.ssid[i].ssid_length = 0;
 			}
@@ -5536,7 +5550,8 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf)
 		}
 	}
 
-	if ((pmlmeext->sitesurvey_res.state == SCAN_START) || (pmlmeext->sitesurvey_res.state == SCAN_TXNULL)) {
+	if ((pmlmeext->sitesurvey_res.state == SCAN_START) ||
+	    (pmlmeext->sitesurvey_res.state == SCAN_TXNULL)) {
 		/* disable dynamic functions, such as high power, DIG */
 		Save_DM_Func_Flag(padapter);
 		Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false);
@@ -5799,7 +5814,7 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf)
 
 	/*  checking if event size match the event parm size */
 	if ((wlanevents[evt_code].parmsize != 0) &&
-			(wlanevents[evt_code].parmsize != evt_sz))
+	    (wlanevents[evt_code].parmsize != evt_sz))
 		goto _abort_event_;
 
 	atomic_inc(&pevt_priv->event_seq);
@@ -5937,8 +5952,13 @@ u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf)
 
 	setChannelPlan_param = (struct SetChannelPlan_param *)pbuf;
 
-	pmlmeext->max_chan_nums = init_channel_set(padapter, setChannelPlan_param->channel_plan, pmlmeext->channel_set);
-	init_channel_list(padapter, pmlmeext->channel_set, pmlmeext->max_chan_nums, &pmlmeext->channel_list);
+	pmlmeext->max_chan_nums = init_channel_set(padapter,
+						   setChannelPlan_param->channel_plan,
+						   pmlmeext->channel_set);
+	init_channel_list(padapter,
+			  pmlmeext->channel_set,
+			  pmlmeext->max_chan_nums,
+			  &pmlmeext->channel_list);
 
 	if (padapter->rtw_wdev && padapter->rtw_wdev->wiphy) {
 		struct regulatory_request request;
-- 
2.43.0


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

* [PATCH v5 5/7] staging: rtl8723bs: add missing space around operators
  2026-01-24 23:15   ` [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring Michael Huang
                       ` (3 preceding siblings ...)
  2026-01-24 23:15     ` [PATCH v5 4/7] staging: rtl8723bs: Fix the line length exceeding 100 columns warning in the code Michael Huang
@ 2026-01-24 23:15     ` Michael Huang
  2026-01-24 23:15     ` [PATCH v5 6/7] staging: rtl8723bs: remove unnecessary braces Michael Huang
                       ` (2 subsequent siblings)
  7 siblings, 0 replies; 20+ messages in thread
From: Michael Huang @ 2026-01-24 23:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Dan Carpenter, linux-staging, linux-kernel, Michael Huang

Add required spaces around logical and assignment operators.

Signed-off-by: Michael Huang <tehsiu.huang@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 7f9251583a97..5277267e9ef1 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -5037,7 +5037,7 @@ void linked_status_chk(struct adapter *padapter)
 			}
 
 			if (tx_chk == _FAIL) {
-				pmlmeinfo->link_count %= (link_count_limit+1);
+				pmlmeinfo->link_count %= (link_count_limit + 1);
 			} else {
 				pxmitpriv->last_tx_pkts = pxmitpriv->tx_pkts;
 				pmlmeinfo->link_count = 0;
@@ -5196,7 +5196,7 @@ u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf)
 		type = _HW_STATE_AP_;
 		/* start_ap_mode(padapter); */
 	} else if (psetop->mode == Ndis802_11Infrastructure) {
-		pmlmeinfo->state &= ~(BIT(0)|BIT(1));/*  clear state */
+		pmlmeinfo->state &= ~(BIT(0) | BIT(1));/*  clear state */
 		pmlmeinfo->state |= WIFI_FW_STATION_STATE;/* set to	STATION_STATE */
 		type = _HW_STATE_STATION_;
 	} else if (psetop->mode == Ndis802_11IBSS) {
@@ -5749,8 +5749,8 @@ u8 set_tx_beacon_cmd(struct adapter *padapter)
 
 	memcpy(&(ptxBeacon_parm->network), &(pmlmeinfo->network), sizeof(struct wlan_bssid_ex));
 
-	len_diff = update_hidden_ssid(ptxBeacon_parm->network.ies+_BEACON_IE_OFFSET_,
-				      ptxBeacon_parm->network.ie_length-_BEACON_IE_OFFSET_,
+	len_diff = update_hidden_ssid(ptxBeacon_parm->network.ies + _BEACON_IE_OFFSET_,
+				      ptxBeacon_parm->network.ie_length - _BEACON_IE_OFFSET_,
 				      pmlmeinfo->hidden_ssid_mode);
 	ptxBeacon_parm->network.ie_length += len_diff;
 
@@ -5805,8 +5805,8 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf)
 		goto _abort_event_;
 
 	peventbuf = (uint *)pbuf;
-	evt_sz = (u16)(*peventbuf&0xffff);
-	evt_code = (u8)((*peventbuf>>16)&0xff);
+	evt_sz = (u16)(*peventbuf & 0xffff);
+	evt_code = (u8)((*peventbuf >> 16) & 0xff);
 
 	/*  checking if event code is valid */
 	if (evt_code >= MAX_C2HEVT)
@@ -5853,7 +5853,7 @@ u8 chk_bmc_sleepq_hdl(struct adapter *padapter, unsigned char *pbuf)
 	if (!psta_bmc)
 		return H2C_SUCCESS;
 
-	if ((pstapriv->tim_bitmap&BIT(0)) && (psta_bmc->sleepq_len > 0)) {
+	if ((pstapriv->tim_bitmap & BIT(0)) && (psta_bmc->sleepq_len > 0)) {
 		msleep(10);/*  10ms, ATIM(HIQ) Windows */
 
 		/* spin_lock_bh(&psta_bmc->sleep_q.lock); */
-- 
2.43.0


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

* [PATCH v5 6/7] staging: rtl8723bs: remove unnecessary braces
  2026-01-24 23:15   ` [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring Michael Huang
                       ` (4 preceding siblings ...)
  2026-01-24 23:15     ` [PATCH v5 5/7] staging: rtl8723bs: add missing space around operators Michael Huang
@ 2026-01-24 23:15     ` Michael Huang
  2026-01-24 23:15     ` [PATCH v5 7/7] staging: rtl8723bs: use !ptr instead of ptr == NULL Michael Huang
  2026-01-25 22:22     ` [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring Dan Carpenter
  7 siblings, 0 replies; 20+ messages in thread
From: Michael Huang @ 2026-01-24 23:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Dan Carpenter, linux-staging, linux-kernel, Michael Huang

Remove braces from single-line conditional statements.

Signed-off-by: Michael Huang <tehsiu.huang@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 5277267e9ef1..4ba4f85be02d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1120,11 +1120,10 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
 
 	pstat->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS);
 	if (!wpa_ie) {
-		if (elems.wps_ie) {
+		if (elems.wps_ie)
 			pstat->flags |= WLAN_STA_WPS;
-		} else {
+		else
 			pstat->flags |= WLAN_STA_MAYBE_WPS;
-		}
 
 
 		/*  AP support WPA/RSN, and sta is going to do WPS, but AP is not ready */
-- 
2.43.0


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

* [PATCH v5 7/7] staging: rtl8723bs: use !ptr instead of ptr == NULL
  2026-01-24 23:15   ` [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring Michael Huang
                       ` (5 preceding siblings ...)
  2026-01-24 23:15     ` [PATCH v5 6/7] staging: rtl8723bs: remove unnecessary braces Michael Huang
@ 2026-01-24 23:15     ` Michael Huang
  2026-01-25 22:22     ` [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring Dan Carpenter
  7 siblings, 0 replies; 20+ messages in thread
From: Michael Huang @ 2026-01-24 23:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Dan Carpenter, linux-staging, linux-kernel, Michael Huang

Simplify pointer null checks by using the "!ptr" convention instead of
the more verbose "ptr == NULL" comparison.

Signed-off-by: Michael Huang <tehsiu.huang@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 4ba4f85be02d..884fcce50d9c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -5994,8 +5994,7 @@ u8 run_in_thread_hdl(struct adapter *padapter, u8 *pbuf)
 {
 	struct RunInThread_param *p;
 
-
-	if (pbuf == NULL)
+	if (!pbuf)
 		return H2C_PARAMETERS_ERROR;
 	p = (struct RunInThread_param *)pbuf;
 
-- 
2.43.0


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

* Re: [PATCH v5 1/7] staging: rtl8723bs: use continue statements to reduce indentation
  2026-01-24 23:15     ` [PATCH v5 1/7] staging: rtl8723bs: use continue statements to reduce indentation Michael Huang
@ 2026-01-25 18:13       ` Joe Perches
  2026-01-25 23:20         ` Te-Hsiu Huang
  0 siblings, 1 reply; 20+ messages in thread
From: Joe Perches @ 2026-01-25 18:13 UTC (permalink / raw)
  To: Michael Huang, Greg Kroah-Hartman
  Cc: Dan Carpenter, linux-staging, linux-kernel

On Sat, 2026-01-24 at 15:15 -0800, Michael Huang wrote:
> Refactor nested if-statements using "continue"
> statements. This flattens the logic, reduces deep indentation,
> and improves overall code readability.
[]
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
[]
> @@ -3684,29 +3684,29 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter)
>  
>  
>  		for (i = 0; i < 8; i++) {
> -			if (ICS[i][0] == 1) {

Several additional things to consider for readability

o Rename ICS to something more meaningful
o Separate the ICS[x][0] uses to another named array [8]
o Adding #defines for the array bounds 8 and 15 (or 14)
o Change the loop bounds from 1 to 0 and 15 to 14 
o Converting this/these arrays to bool
o Use boolean logic

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

* Re: [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring
  2026-01-24 23:15   ` [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring Michael Huang
                       ` (6 preceding siblings ...)
  2026-01-24 23:15     ` [PATCH v5 7/7] staging: rtl8723bs: use !ptr instead of ptr == NULL Michael Huang
@ 2026-01-25 22:22     ` Dan Carpenter
  7 siblings, 0 replies; 20+ messages in thread
From: Dan Carpenter @ 2026-01-25 22:22 UTC (permalink / raw)
  To: Michael Huang; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel

On Sat, Jan 24, 2026 at 03:15:50PM -0800, Michael Huang wrote:
> This series refactors the function in rtw_mlme_ext.c to
> improve readability and comply with Linux kernel coding standards.
> 
> Following feedback from Dan Carpenter, this version (v5) deconstructs
> the previous changes into seven atomic patches. This separation ensures
> that logical changes (such as flattening nested loops) are isolated
> from purely stylistic cleanups (such as fixing indentation or NULL
> checks), making the review process more straightforward and less
> error-prone.
> 
> Each patch focuses on a single category of improvement:
> 1. Logic flattening: Use continue statements to reduce indentation.
> 2. Comment positioning: Adjust comments to align with new logic.
> 3. New lines cleanup: Removed unnecessary new lines
> 4. Line length compliance: Resolve 100-column limit warnings.
> 5. Operator spacing: Add missing spaces around logical operators.
> 6. Braces removal: Clean up unnecessary braces in single-line branches.
> 7. NULL check simplification: Use the "!ptr" convention for brevity.
> 
> ---
> Changes in v5:
> - Split the series into 7 atomic patches for easier review.
> - Renamed "guard clauses" to "continue statements" description per feedback.
> - Separated logic changes, comment refactoring, and style cleanups.
> - Fixed indentation issues (replaced spaces with tabs).
> - Simplified NULL pointer checks to use the !ptr convention.

Thanks!

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter


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

* Re: [PATCH v5 1/7] staging: rtl8723bs: use continue statements to reduce indentation
  2026-01-25 18:13       ` Joe Perches
@ 2026-01-25 23:20         ` Te-Hsiu Huang
  0 siblings, 0 replies; 20+ messages in thread
From: Te-Hsiu Huang @ 2026-01-25 23:20 UTC (permalink / raw)
  To: Joe Perches
  Cc: Greg Kroah-Hartman, Dan Carpenter, linux-staging, linux-kernel

On Sun, Jan 25, 2026 at 10:13 AM Joe Perches <joe@perches.com> wrote:

> Several additional things to consider for readability
>
> o Rename ICS to something more meaningful
> o Separate the ICS[x][0] uses to another named array [8]
> o Adding #defines for the array bounds 8 and 15 (or 14)
> o Change the loop bounds from 1 to 0 and 15 to 14
> o Converting this/these arrays to bool
> o Use boolean logic

Hi Joe,

Thanks for your valuable suggestions!!!

These points—especially renaming ICS, using #defines for array bounds,
and converting to boolean logic—would definitely improve the long-term
maintainability of this driver.

However, to keep this series focused on fixing the immediate
checkpatch warnings and reducing indentation as suggested by Dan,
would it be acceptable to handle these larger refactoring tasks in a
separate follow-up patch series?

I'd like to ensure the current cleanup (v5) is stable and correct
before introducing more significant structural changes to the logic.
Really appreciate your time!

Best regards,
Michael

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

end of thread, other threads:[~2026-01-25 23:20 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-23 21:19 [PATCH v3 0/2] staging: rtl8723bs: cleanup and indentation refactoring Michael Huang
2026-01-23 21:19 ` [PATCH v3 1/2] staging: rtl8723bs: refactor nested loops to reduce indentation Michael Huang
2026-01-24 10:59   ` Dan Carpenter
2026-01-23 21:19 ` [PATCH v3 2/2] staging: rtl8723bs: fix line length and coding style issues Michael Huang
2026-01-24  6:51 ` [PATCH v3 0/2] staging: rtl8723bs: cleanup and indentation refactoring Greg Kroah-Hartman
2026-01-24 10:49 ` [PATCH v4 " Michael Huang
2026-01-24 10:49   ` [PATCH v4 1/2] staging: rtl8723bs: refactor nested loops to reduce indentation Michael Huang
2026-01-24 10:49   ` [PATCH v4 2/2] staging: rtl8723bs: fix line length and coding style issues Michael Huang
2026-01-24 11:02     ` Dan Carpenter
2026-01-24 23:15   ` [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring Michael Huang
2026-01-24 23:15     ` [PATCH v5 1/7] staging: rtl8723bs: use continue statements to reduce indentation Michael Huang
2026-01-25 18:13       ` Joe Perches
2026-01-25 23:20         ` Te-Hsiu Huang
2026-01-24 23:15     ` [PATCH v5 2/7] staging: rtl8723bs: refactor comments to fix the line length warning for exceeding 100 columns Michael Huang
2026-01-24 23:15     ` [PATCH v5 3/7] staging: rtl8723bs: remove unnecessary new lines Michael Huang
2026-01-24 23:15     ` [PATCH v5 4/7] staging: rtl8723bs: Fix the line length exceeding 100 columns warning in the code Michael Huang
2026-01-24 23:15     ` [PATCH v5 5/7] staging: rtl8723bs: add missing space around operators Michael Huang
2026-01-24 23:15     ` [PATCH v5 6/7] staging: rtl8723bs: remove unnecessary braces Michael Huang
2026-01-24 23:15     ` [PATCH v5 7/7] staging: rtl8723bs: use !ptr instead of ptr == NULL Michael Huang
2026-01-25 22:22     ` [PATCH v5 0/7] staging: rtl8723bs: cleanup and refactorcleanup and indentation refactoring Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox