diff mbox series

[03/22] iio: adc: hx711: make use of iio_for_each_active_channel()

Message ID 20240718-dev-iio-masklength-private2-v1-3-8e12cd042906@analog.com (mailing list archive)
State Accepted
Headers show
Series iio: make masklength __private (round 2) | expand

Commit Message

Nuno Sa via B4 Relay July 18, 2024, 1:37 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/hx711.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Jonathan Cameron July 20, 2024, 4:01 p.m. UTC | #1
On Thu, 18 Jul 2024 15:37:49 +0200
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.
> 
> Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Even before this work from you, this code could certainly have been
less contrary!

Applied.

> ---
>  drivers/iio/adc/hx711.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
> index b3372ccff7d5..376f4e02de97 100644
> --- a/drivers/iio/adc/hx711.c
> +++ b/drivers/iio/adc/hx711.c
> @@ -363,10 +363,7 @@ static irqreturn_t hx711_trigger(int irq, void *p)
>  
>  	memset(hx711_data->buffer, 0, sizeof(hx711_data->buffer));
>  
> -	for (i = 0; i < indio_dev->masklength; i++) {
> -		if (!test_bit(i, indio_dev->active_scan_mask))
> -			continue;
> -
> +	iio_for_each_active_channel(indio_dev, i) {
>  		hx711_data->buffer[j] = hx711_reset_read(hx711_data,
>  					indio_dev->channels[i].channel);
>  		j++;
>
diff mbox series

Patch

diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
index b3372ccff7d5..376f4e02de97 100644
--- a/drivers/iio/adc/hx711.c
+++ b/drivers/iio/adc/hx711.c
@@ -363,10 +363,7 @@  static irqreturn_t hx711_trigger(int irq, void *p)
 
 	memset(hx711_data->buffer, 0, sizeof(hx711_data->buffer));
 
-	for (i = 0; i < indio_dev->masklength; i++) {
-		if (!test_bit(i, indio_dev->active_scan_mask))
-			continue;
-
+	iio_for_each_active_channel(indio_dev, i) {
 		hx711_data->buffer[j] = hx711_reset_read(hx711_data,
 					indio_dev->channels[i].channel);
 		j++;