From: Oscar Carter <oscar.carter@gmx.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Oscar Carter <oscar.carter@gmx.com>,
Forest Bond <forest@alittletooquiet.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org,
Malcolm Priestley <tvboxspy@gmail.com>,
"John B . Wyatt IV" <jbwyatt4@gmail.com>,
linux-kernel@vger.kernel.org,
Colin Ian King <colin.king@canonical.com>
Subject: Re: [PATCH] staging: vt6656: Use fls instead of for loop in vnt_update_top_rates
Date: Mon, 20 Apr 2020 17:02:35 +0200 [thread overview]
Message-ID: <20200420150235.GA3159@ubuntu> (raw)
In-Reply-To: <20200420121059.GC2659@kadam>
On Mon, Apr 20, 2020 at 03:10:59PM +0300, Dan Carpenter wrote:
> On Sun, Apr 19, 2020 at 12:09:21PM +0200, Oscar Carter wrote:
> > - for (i = RATE_11M;; i--) {
> > - if (priv->basic_rates & (u16)(1 << i)) {
> > - top_cck = i;
> > - break;
> > - }
> > - if (i == RATE_1M)
> > - break;
> > - }
> > + pos = fls(priv->basic_rates & GENMASK(RATE_54M, RATE_6M));
> > + priv->top_ofdm_basic_rate = pos ? pos-- : RATE_24M;
> ^^^^^
> Argh... Come on. I don't want to have to break out the C standard to
> see if this is defined behavior and where the sequence points are. A
> pre-op would be clear but the most clear thing is to write it like this:
>
> priv->top_ofdm_basic_rate = pos ? (pos - 1) : RATE_24M;
>
Ok, I do the modification as you suggested and resend a new version.
>
> >
> > - priv->top_cck_basic_rate = top_cck;
> > + pos = fls(priv->basic_rates & GENMASK(RATE_11M, RATE_1M));
> > + priv->top_cck_basic_rate = pos ? pos-- : RATE_1M;
> ^^^^^
> Same.
>
> regards,
> dan carpenter
>
thanks,
oscar carter
prev parent reply other threads:[~2020-04-20 15:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-19 10:09 [PATCH] staging: vt6656: Use fls instead of for loop in vnt_update_top_rates Oscar Carter
2020-04-20 12:10 ` Dan Carpenter
2020-04-20 15:02 ` Oscar Carter [this message]
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=20200420150235.GA3159@ubuntu \
--to=oscar.carter@gmx.com \
--cc=colin.king@canonical.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=forest@alittletooquiet.net \
--cc=gregkh@linuxfoundation.org \
--cc=jbwyatt4@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tvboxspy@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;
as well as URLs for NNTP newsgroup(s).