From: Dan Carpenter <dan.carpenter@linaro.org>
To: Michael Huang <tehsiu.huang@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] staging: rtl8723bs: refactor nested loops to reduce indentation
Date: Sat, 24 Jan 2026 13:59:26 +0300 [thread overview]
Message-ID: <aXSmDkzs4P79BZRW@stanley.mountain> (raw)
In-Reply-To: <20260123211904.64589-2-tehsiu.huang@gmail.com>
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
next prev parent reply other threads:[~2026-01-24 10:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=aXSmDkzs4P79BZRW@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=tehsiu.huang@gmail.com \
/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