* [PATCH] iio: adc: ad7606_spi: use bitmap_full() in ad7606_spi_update_scan_mode()
@ 2025-12-16 0:18 Yury Norov (NVIDIA)
2025-12-16 0:23 ` Yury Norov
0 siblings, 1 reply; 4+ messages in thread
From: Yury Norov (NVIDIA) @ 2025-12-16 0:18 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
linux-kernel
Cc: Yury Norov (NVIDIA)
bitmap_empty() is more verbose and efficient, as it stops traversing
scan_mask as soon as the 1st set bit found.
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
---
drivers/iio/adc/ad7606_spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c
index f28e4ca37707..7e17ccbcedd0 100644
--- a/drivers/iio/adc/ad7606_spi.c
+++ b/drivers/iio/adc/ad7606_spi.c
@@ -345,7 +345,7 @@ static int ad7606_spi_update_scan_mode(struct iio_dev *indio_dev,
* has no way of demuxing the data to filter out unwanted
* channels.
*/
- if (bitmap_weight(scan_mask, num_adc_ch) != num_adc_ch)
+ if (!bitmap_full(scan_mask, num_adc_ch))
return -EINVAL;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: adc: ad7606_spi: use bitmap_full() in ad7606_spi_update_scan_mode()
2025-12-16 0:18 [PATCH] iio: adc: ad7606_spi: use bitmap_full() in ad7606_spi_update_scan_mode() Yury Norov (NVIDIA)
@ 2025-12-16 0:23 ` Yury Norov
2025-12-16 0:26 ` David Lechner
0 siblings, 1 reply; 4+ messages in thread
From: Yury Norov @ 2025-12-16 0:23 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
linux-kernel
On Mon, Dec 15, 2025 at 07:18:06PM -0500, Yury Norov (NVIDIA) wrote:
> bitmap_empty() is more verbose and efficient, as it stops traversing
> scan_mask as soon as the 1st set bit found.
Ah, please read this as:
bitmap_full() is more verbose and efficient, as it stops traversing
scan_mask as soon as the 1st unset bit found.
Sorry for miswording the commit message.
> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
> ---
> drivers/iio/adc/ad7606_spi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c
> index f28e4ca37707..7e17ccbcedd0 100644
> --- a/drivers/iio/adc/ad7606_spi.c
> +++ b/drivers/iio/adc/ad7606_spi.c
> @@ -345,7 +345,7 @@ static int ad7606_spi_update_scan_mode(struct iio_dev *indio_dev,
> * has no way of demuxing the data to filter out unwanted
> * channels.
> */
> - if (bitmap_weight(scan_mask, num_adc_ch) != num_adc_ch)
> + if (!bitmap_full(scan_mask, num_adc_ch))
> return -EINVAL;
> }
>
> --
> 2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: adc: ad7606_spi: use bitmap_full() in ad7606_spi_update_scan_mode()
2025-12-16 0:23 ` Yury Norov
@ 2025-12-16 0:26 ` David Lechner
2025-12-21 19:48 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: David Lechner @ 2025-12-16 0:26 UTC (permalink / raw)
To: Yury Norov, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, Nuno Sá, Andy Shevchenko, linux-iio,
linux-kernel
On 12/15/25 6:23 PM, Yury Norov wrote:
> On Mon, Dec 15, 2025 at 07:18:06PM -0500, Yury Norov (NVIDIA) wrote:
>> bitmap_empty() is more verbose and efficient, as it stops traversing
>> scan_mask as soon as the 1st set bit found.
>
> Ah, please read this as:
>
> bitmap_full() is more verbose and efficient, as it stops traversing
> scan_mask as soon as the 1st unset bit found.
>
I think you mean "bitmap_full() is less verbose"?
This isn't a hot path, so efficiency isn't important.
This makes the code easier to understand anyway, so a worthy change.
> Sorry for miswording the commit message.
>
>> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
>> ---
>> drivers/iio/adc/ad7606_spi.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c
>> index f28e4ca37707..7e17ccbcedd0 100644
>> --- a/drivers/iio/adc/ad7606_spi.c
>> +++ b/drivers/iio/adc/ad7606_spi.c
>> @@ -345,7 +345,7 @@ static int ad7606_spi_update_scan_mode(struct iio_dev *indio_dev,
>> * has no way of demuxing the data to filter out unwanted
>> * channels.
>> */
>> - if (bitmap_weight(scan_mask, num_adc_ch) != num_adc_ch)
>> + if (!bitmap_full(scan_mask, num_adc_ch))
>> return -EINVAL;
>> }
>>
>> --
>> 2.43.0
With the commit message fixed:
Reviewed-by: David Lechner <dlechner@baylibre.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: adc: ad7606_spi: use bitmap_full() in ad7606_spi_update_scan_mode()
2025-12-16 0:26 ` David Lechner
@ 2025-12-21 19:48 ` Jonathan Cameron
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2025-12-21 19:48 UTC (permalink / raw)
To: David Lechner
Cc: Yury Norov, Lars-Peter Clausen, Michael Hennerich, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
On Mon, 15 Dec 2025 18:26:46 -0600
David Lechner <dlechner@baylibre.com> wrote:
> On 12/15/25 6:23 PM, Yury Norov wrote:
> > On Mon, Dec 15, 2025 at 07:18:06PM -0500, Yury Norov (NVIDIA) wrote:
> >> bitmap_empty() is more verbose and efficient, as it stops traversing
> >> scan_mask as soon as the 1st set bit found.
> >
> > Ah, please read this as:
> >
> > bitmap_full() is more verbose and efficient, as it stops traversing
> > scan_mask as soon as the 1st unset bit found.
> >
>
> I think you mean "bitmap_full() is less verbose"?
>
> This isn't a hot path, so efficiency isn't important.
>
> This makes the code easier to understand anyway, so a worthy change.
>
Tweaked patch description as discussed (with a more inserted
before efficient as it's "less verbose and more efficient" and applied.
Thanks,
Jonathan
>
> > Sorry for miswording the commit message.
> >
> >> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
> >> ---
> >> drivers/iio/adc/ad7606_spi.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c
> >> index f28e4ca37707..7e17ccbcedd0 100644
> >> --- a/drivers/iio/adc/ad7606_spi.c
> >> +++ b/drivers/iio/adc/ad7606_spi.c
> >> @@ -345,7 +345,7 @@ static int ad7606_spi_update_scan_mode(struct iio_dev *indio_dev,
> >> * has no way of demuxing the data to filter out unwanted
> >> * channels.
> >> */
> >> - if (bitmap_weight(scan_mask, num_adc_ch) != num_adc_ch)
> >> + if (!bitmap_full(scan_mask, num_adc_ch))
> >> return -EINVAL;
> >> }
> >>
> >> --
> >> 2.43.0
>
> With the commit message fixed:
>
> Reviewed-by: David Lechner <dlechner@baylibre.com>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-21 19:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-16 0:18 [PATCH] iio: adc: ad7606_spi: use bitmap_full() in ad7606_spi_update_scan_mode() Yury Norov (NVIDIA)
2025-12-16 0:23 ` Yury Norov
2025-12-16 0:26 ` David Lechner
2025-12-21 19:48 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox