From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Yan Wang <rk.code@outlook.com>
Cc: linus.walleij@linaro.org, brgl@bgdev.pl,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] gpio: mmio: restroe get multiple gpio mask
Date: Mon, 24 Apr 2023 16:31:39 +0300 [thread overview]
Message-ID: <ZEaEu7Yxd+E53sth@smile.fi.intel.com> (raw)
In-Reply-To: <KL1PR01MB544800D7E51C9209A9BD998BE6669@KL1PR01MB5448.apcprd01.prod.exchangelabs.com>
On Sun, Apr 23, 2023 at 05:06:48PM +0800, Yan Wang wrote:
> Simplify the code,should not modify its logic.
> Fixes: 761b5c30c206 ("gpio: mmio: replace open-coded for_each_set_bit()")
What does it fix?
...
> for_each_set_bit(i, mask, gc->bgpio_bits) {
> - if (test_bit(i, bits))
> - *set_mask |= bgpio_line2mask(gc, i);
> - else
> - *clear_mask |= bgpio_line2mask(gc, i);
> + if (*mask == 0)
> + break;
Huh?!
We never enter here if mask is 0. So, do not add a dead code, please.
Moreover, in principle mask can be longer than 1 long, this code simply wrong.
NAK
> + if (__test_and_clear_bit(i, mask)) {
> + if (test_bit(i, bits))
> + *set_mask |= bgpio_line2mask(gc, i);
> + else
> + *clear_mask |= bgpio_line2mask(gc, i);
> + }
> }
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-04-24 13:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-23 9:06 [PATCH v1] gpio: mmio: restroe get multiple gpio mask Yan Wang
2023-04-24 6:56 ` Linus Walleij
2023-04-24 9:03 ` Yan Wang
2023-04-24 13:31 ` Andy Shevchenko [this message]
2023-04-24 14:21 ` Yan Wang
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=ZEaEu7Yxd+E53sth@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rk.code@outlook.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