diff mbox series

[18/20] iio: adc: at91_adc: make use of iio_for_each_active_channel()

Message ID 20240702-dev-iio-masklength-private-v1-18-98193bf536a6@analog.com (mailing list archive)
State Accepted
Commit f3184b2f2c72839514763ca761663ad38c84751d
Headers show
Series iio: make masklength __private (round 1) | expand

Commit Message

Nuno Sa via B4 Relay July 2, 2024, 4:02 p.m. UTC
From: Nuno Sa <nuno.sa@analog.com>

Use iio_for_each_active_channel() to iterate over active channels
accessing '.masklength' so it can be annotated as __private when there are
no more direct users of it.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
 drivers/iio/adc/at91_adc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Alexandru Ardelean July 3, 2024, 6:25 a.m. UTC | #1
On Tue, Jul 2, 2024 at 7:03 PM Nuno Sa via B4 Relay
<devnull+nuno.sa.analog.com@kernel.org> wrote:
>
> From: Nuno Sa <nuno.sa@analog.com>
>
> Use iio_for_each_active_channel() to iterate over active channels
> accessing '.masklength' so it can be annotated as __private when there are
> no more direct users of it.
>

Reviewed-by: Alexandru Ardelean <aardelean@baylibre.com>

> Signed-off-by: Nuno Sa <nuno.sa@analog.com>
> ---
>  drivers/iio/adc/at91_adc.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index eb501e3c86a5..af4b0224076f 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -268,9 +268,7 @@ static irqreturn_t at91_adc_trigger_handler(int irq, void *p)
>         struct iio_chan_spec const *chan;
>         int i, j = 0;
>
> -       for (i = 0; i < idev->masklength; i++) {
> -               if (!test_bit(i, idev->active_scan_mask))
> -                       continue;
> +       iio_for_each_active_channel(idev, i) {
>                 chan = idev->channels + i;
>                 st->buffer[j] = at91_adc_readl(st, AT91_ADC_CHAN(st, chan->channel));
>                 j++;
>
> --
> 2.45.2
>
>
>
diff mbox series

Patch

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index eb501e3c86a5..af4b0224076f 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -268,9 +268,7 @@  static irqreturn_t at91_adc_trigger_handler(int irq, void *p)
 	struct iio_chan_spec const *chan;
 	int i, j = 0;
 
-	for (i = 0; i < idev->masklength; i++) {
-		if (!test_bit(i, idev->active_scan_mask))
-			continue;
+	iio_for_each_active_channel(idev, i) {
 		chan = idev->channels + i;
 		st->buffer[j] = at91_adc_readl(st, AT91_ADC_CHAN(st, chan->channel));
 		j++;