]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: adc: ad7606_spi: use bitmap_full() in ad7606_spi_update_scan_mode()
authorYury Norov (NVIDIA) <yury.norov@gmail.com>
Tue, 16 Dec 2025 00:18:06 +0000 (19:18 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 21 Dec 2025 19:47:04 +0000 (19:47 +0000)
bitmap_full() is less verbose and more efficient, as it stops traversing
scan_mask as soon as the 1st unset bit found.

Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7606_spi.c

index f28e4ca3770763d703ce7162ed353ff90476fbbe..7e17ccbcedd0cd0cc03259aa09b4f4acff309178 100644 (file)
@@ -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;
        }