From: Dan Carpenter <dan.carpenter@linaro.org>
To: Michael Huang <tehsiu.huang@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Joe Perches <joe@perches.com>,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: rtl8723bs: refactor BSS Coexistence channel report logic
Date: Thu, 29 Jan 2026 09:55:51 +0300 [thread overview]
Message-ID: <aXsEd2bzf35y8i_E@stanley.mountain> (raw)
In-Reply-To: <20260128204510.53433-1-tehsiu.huang@gmail.com>
On Wed, Jan 28, 2026 at 12:45:10PM -0800, Michael Huang wrote:
> Refactor the 'ICS' array in issue_action_BSSCoexistPacket() to improve
> readability and maintainability. This addresses technical debt related
> to magic numbers and ambiguous array usage.
>
> The original implementation used a multi-purpose 2D array (ICS[8][15])
> where magic numbers were prevalent and the first element of each row
> was overloaded as a status flag. This patch:
>
> - Introduces descriptive macros: BSS_COEX_MAX_CLASSES,
> BSS_COEX_MAX_CHANNELS, and BSS_COEX_MAX_INFO_LEN.
> - Splits the overloaded array into two distinct boolean arrays:
> 'class_active' (for group status) and 'ch_present' (for channel data).
> - Converts the logic to use 'bool' types and 0-indexed loops,
> conforming to standard C programming practices.
> - Adds defensive boundary checks (ch > 0 && ch < MAX) to ensure
> robustness against unexpected channel data.
>
> This refactoring maintains the current 2.4GHz reporting behavior while
> providing a structured and extensible foundation for future Operating
> Class support according to IEEE 802.11 specifications.
>
> Signed-off-by: Michael Huang <tehsiu.huang@gmail.com>
> ---
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 41 +++++++------------
> .../staging/rtl8723bs/include/rtw_mlme_ext.h | 3 ++
> 2 files changed, 18 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> index 884fcce50d9c..481295224f14 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> @@ -3587,8 +3587,9 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter)
> struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
> struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
> struct __queue *queue = &(pmlmepriv->scanned_queue);
> - u8 InfoContent[16] = {0};
> - u8 ICS[8][15];
> + u8 InfoContent[BSS_COEX_MAX_INFO_LEN] = {0};
> + bool class_active[BSS_COEX_MAX_CLASSES] = {false};
We only ever set the first element in the class_active[] array.
#puzzled
> + bool ch_present[BSS_COEX_MAX_CLASSES][BSS_COEX_MAX_CHANNELS] = {{false}};
Btw, use "= {};" to initialize arrays to zero. It's not standard C, but
it's kernel C.
regards,
dan carpenter
next prev parent reply other threads:[~2026-01-29 6:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 20:45 [PATCH] staging: rtl8723bs: refactor BSS Coexistence channel report logic Michael Huang
2026-01-29 6:55 ` Dan Carpenter [this message]
2026-01-29 8:01 ` [PATCH v2] " Michael Huang
2026-01-29 8:54 ` Greg Kroah-Hartman
2026-01-29 9:54 ` Te-Hsiu Huang
2026-01-29 14:14 ` Greg Kroah-Hartman
2026-01-29 18:46 ` Te-Hsiu Huang
2026-01-30 8:30 ` Dan Carpenter
2026-01-30 9:46 ` Te-Hsiu Huang
2026-01-29 8:05 ` [PATCH] " Te-Hsiu Huang
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=aXsEd2bzf35y8i_E@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--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