From: Yury Norov <yury.norov@gmail.com>
To: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"David Laight" <David.Laight@ACULAB.COM>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Joe Perches" <joe@perches.com>,
"Julia Lawall" <Julia.Lawall@inria.fr>,
"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Nicolas Palix" <nicolas.palix@imag.fr>,
"Peter Zijlstra" <peterz@infradead.org>,
"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
"Matti Vaittinen" <Matti.Vaittinen@fi.rohmeurope.com>,
linux-kernel@vger.kernel.org
Cc: Yury Norov <yury.norov@gmail.com>,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
linux-iio@vger.kernel.org
Subject: [PATCH 05/22] iio: replace bitmap_weight with bitmap_weitght_{eq,le} where appropriate
Date: Tue, 10 May 2022 08:47:33 -0700 [thread overview]
Message-ID: <20220510154750.212913-6-yury.norov@gmail.com> (raw)
In-Reply-To: <20220510154750.212913-1-yury.norov@gmail.com>
bitmap_weight_{eq,le} is better than bitmap_weight because it
may return earlier.
CC: Jonathan Cameron <jic23@kernel.org>
CC: Lars-Peter Clausen <lars@metafoo.de>
CC: Michael Hennerich <Michael.Hennerich@analog.com>
CC: linux-iio@vger.kernel.org
CC: linux-kernel@vger.kernel.org
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
drivers/iio/adc/ad_sigma_delta.c | 2 +-
drivers/iio/industrialio-buffer.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c
index 261a9a6b45e1..6445b591f071 100644
--- a/drivers/iio/adc/ad_sigma_delta.c
+++ b/drivers/iio/adc/ad_sigma_delta.c
@@ -525,7 +525,7 @@ static bool ad_sd_validate_scan_mask(struct iio_dev *indio_dev, const unsigned l
{
struct ad_sigma_delta *sigma_delta = iio_device_get_drvdata(indio_dev);
- return bitmap_weight(mask, indio_dev->masklength) <= sigma_delta->num_slots;
+ return bitmap_weight_le(mask, indio_dev->masklength, sigma_delta->num_slots);
}
static const struct iio_buffer_setup_ops ad_sd_buffer_setup_ops = {
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 06141ca27e1f..18d3d756aee1 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -1824,7 +1824,7 @@ void iio_buffers_free_sysfs_and_mask(struct iio_dev *indio_dev)
bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev,
const unsigned long *mask)
{
- return bitmap_weight(mask, indio_dev->masklength) == 1;
+ return bitmap_weight_eq(mask, indio_dev->masklength, 1);
}
EXPORT_SYMBOL_GPL(iio_validate_scan_mask_onehot);
--
2.32.0
next parent reply other threads:[~2022-05-10 15:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220510154750.212913-1-yury.norov@gmail.com>
2022-05-10 15:47 ` Yury Norov [this message]
2022-05-14 15:53 ` [PATCH 05/22] iio: replace bitmap_weight with bitmap_weitght_{eq,le} where appropriate Jonathan Cameron
2022-05-14 16:31 ` Joe Perches
2022-05-15 16:40 ` Jonathan Cameron
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=20220510154750.212913-6-yury.norov@gmail.com \
--to=yury.norov@gmail.com \
--cc=David.Laight@ACULAB.COM \
--cc=Julia.Lawall@inria.fr \
--cc=Matti.Vaittinen@fi.rohmeurope.com \
--cc=Michael.Hennerich@analog.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=joe@perches.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=mirq-linux@rere.qmqm.pl \
--cc=nicolas.palix@imag.fr \
--cc=npiggin@gmail.com \
--cc=peterz@infradead.org \
/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