diff mbox series

[16/20] iio: adc: ad799x: make use of iio_get_masklength()

Message ID 20240702-dev-iio-masklength-private-v1-16-98193bf536a6@analog.com (mailing list archive)
State Accepted
Commit 972df0e9a08b62679ff8dcdd8cb650642804c38f
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_get_masklength() to access '.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/ad799x.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Alexandru Ardelean July 3, 2024, 6:21 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_get_masklength() to access '.masklength' so it can be annotated
> as __private when there are no more direct users of it.
>

At this point, I am wondering if it would make sense to go a little
further with the abstraction and find a wrapper for the
"bitmap_weight(indio_dev->active_scan_mask, indio_dev->masklength)"

Maybe it's doable at a later point.

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

> Signed-off-by: Nuno Sa <nuno.sa@analog.com>
> ---
>  drivers/iio/adc/ad799x.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
> index 0f0dcd9ca6b60..0f107e3fc2c85 100644
> --- a/drivers/iio/adc/ad799x.c
> +++ b/drivers/iio/adc/ad799x.c
> @@ -237,7 +237,8 @@ static int ad799x_update_scan_mode(struct iio_dev *indio_dev,
>         if (!st->rx_buf)
>                 return -ENOMEM;
>
> -       st->transfer_size = bitmap_weight(scan_mask, indio_dev->masklength) * 2;
> +       st->transfer_size = bitmap_weight(scan_mask,
> +                                         iio_get_masklength(indio_dev)) * 2;
>
>         switch (st->id) {
>         case ad7992:
>
> --
> 2.45.2
>
>
>
diff mbox series

Patch

diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
index 0f0dcd9ca6b60..0f107e3fc2c85 100644
--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -237,7 +237,8 @@  static int ad799x_update_scan_mode(struct iio_dev *indio_dev,
 	if (!st->rx_buf)
 		return -ENOMEM;
 
-	st->transfer_size = bitmap_weight(scan_mask, indio_dev->masklength) * 2;
+	st->transfer_size = bitmap_weight(scan_mask,
+					  iio_get_masklength(indio_dev)) * 2;
 
 	switch (st->id) {
 	case ad7992: