From: Dan Carpenter <dan.carpenter@oracle.com>
To: Shreyansh Chouhan <chouhan.shreyansh630@gmail.com>
Cc: gregkh@linuxfoundation.org, fabioaiuto83@gmail.com,
ross.schm.dev@gmail.com, straube.linux@gmail.com,
linux-staging@lists.linux.dev, linux-kernel@bger.kernel.org
Subject: Re: [PATCH 1/2] [RFC] staging: rtl8723bs: refactor to reduce indents
Date: Mon, 24 May 2021 12:05:58 +0300 [thread overview]
Message-ID: <20210524090557.GM1955@kadam> (raw)
In-Reply-To: <20210522091719.64277-2-chouhan.shreyansh630@gmail.com>
On Sat, May 22, 2021 at 02:47:18PM +0530, Shreyansh Chouhan wrote:
> Reduce the number of indents in rtw_wlan_util.c file by refactoring the
> code.
>
> Moved the part of code that rearranged ac paramaters in the function
> WMMOnAssocResp to a separate function named sort_wmm_ac_params. It takes
> both the array of ac params and their indexes as arguments and sorts them.
> Has return type void.
>
> Moved the part of code that checked for the realtek vendor in the
> function check_assoc_AP to a separate function named
> get_realtek_assoc_AP_vender. It takes a pointer to struct
> ndis_80211_var_ie as an argument and returns a u32 realtek vendor.
>
> Signed-off-by: Shreyansh Chouhan <chouhan.shreyansh630@gmail.com>
> ---
> .../staging/rtl8723bs/core/rtw_wlan_util.c | 108 +++++++++---------
> 1 file changed, 56 insertions(+), 52 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
> index ce47ef4edea0..36e515a7ab5c 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
> @@ -777,6 +777,32 @@ int WMM_param_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE)
> return true;
> }
>
> +static void sort_wmm_ac_params(u32 *inx, u32 *edca)
> +{
> + u32 i, j, change_inx = false;
> +
> + /* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */
> + for (i = 0; i < 4; i++) {
> + for (j = i + 1; j < 4; j++) {
> + /* compare CW and AIFS */
> + if ((edca[j] & 0xFFFF) < (edca[i] & 0xFFFF)) {
> + change_inx = true;
> + } else if ((edca[j] & 0xFFFF) == (edca[i] & 0xFFFF)) {
> + /* compare TXOP */
> + if ((edca[j] >> 16) > (edca[i] >> 16))
> + change_inx = true;
> + }
> +
> + if (change_inx) {
> + swap(edca[i], edca[j]);
> + swap(inx[i], inx[j]);
Using swap() is the correct thing to do, but send that change as a
separate patch.
Don't send RFC patches, just send normal patches. No need for comments.
> +
> + change_inx = false;
> + }
> + }
> + }
> +}
regards,
dan carpenter
next prev parent reply other threads:[~2021-05-24 9:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-22 9:17 [PATCH 0/2] [RFC] staging: rtl8723bs: refactor to reduce indents Shreyansh Chouhan
2021-05-22 9:17 ` [PATCH 1/2] " Shreyansh Chouhan
2021-05-24 9:05 ` Dan Carpenter [this message]
2021-05-24 16:06 ` Shreyansh Chouhan
2021-05-22 9:17 ` [PATCH 2/2] [RFC] staging: rtl8723bs: remove unnecessary braces from conditionals Shreyansh Chouhan
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=20210524090557.GM1955@kadam \
--to=dan.carpenter@oracle.com \
--cc=chouhan.shreyansh630@gmail.com \
--cc=fabioaiuto83@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@bger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=ross.schm.dev@gmail.com \
--cc=straube.linux@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