diff mbox series

[08/20] iio: accel: cros_ec_accel_legacy: make use of iio_get_masklength()

Message ID 20240702-dev-iio-masklength-private-v1-8-98193bf536a6@analog.com (mailing list archive)
State Accepted
Commit bac3b7c43d6d9ed6749b9dc9f56a8c0e0e73cb02
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>

Ue 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/accel/cros_ec_accel_legacy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

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

I would have suggested maybe a "iio_for_each_active_channel()" here
instead, but after looking into the driver a bit more, it looks like
it's part of a broader rework.

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

> Signed-off-by: Nuno Sa <nuno.sa@analog.com>
> ---
>  drivers/iio/accel/cros_ec_accel_legacy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/accel/cros_ec_accel_legacy.c b/drivers/iio/accel/cros_ec_accel_legacy.c
> index 0f403342b1fc..f7e4dc02b34d 100644
> --- a/drivers/iio/accel/cros_ec_accel_legacy.c
> +++ b/drivers/iio/accel/cros_ec_accel_legacy.c
> @@ -62,7 +62,7 @@ static int cros_ec_accel_legacy_read_cmd(struct iio_dev *indio_dev,
>                 return ret;
>         }
>
> -       for_each_set_bit(i, &scan_mask, indio_dev->masklength) {
> +       for_each_set_bit(i, &scan_mask, iio_get_masklength(indio_dev)) {
>                 *data = st->resp->dump.sensor[sensor_num].data[i] *
>                         st->sign[i];
>                 data++;
>
> --
> 2.45.2
>
>
>
Nuno Sá July 3, 2024, 7:08 a.m. UTC | #2
On Wed, 2024-07-03 at 09:37 +0300, Alexandru Ardelean wrote:
> On Tue, Jul 2, 2024 at 7:02 PM Nuno Sa via B4 Relay
> <devnull+nuno.sa.analog.com@kernel.org> wrote:
> > 
> > From: Nuno Sa <nuno.sa@analog.com>
> > 
> > Ue iio_get_masklength() to access '.masklength' so it can be annotated
> > as __private when there are no more direct users of it.
> > 
> 
> I would have suggested maybe a "iio_for_each_active_channel()" here
> instead, but after looking into the driver a bit more, it looks like
> it's part of a broader rework.
> 

Yeah, we have a scan_mask that I don't think it's guaranteed to be indio_dev-
>active_scan_mask. Also don't think (at this point) we need another
iio_for_each_active_channel() helper which takes mask as most of usecases use
indio_dev->active_scan_mask

- Nuno Sá
>
diff mbox series

Patch

diff --git a/drivers/iio/accel/cros_ec_accel_legacy.c b/drivers/iio/accel/cros_ec_accel_legacy.c
index 0f403342b1fc..f7e4dc02b34d 100644
--- a/drivers/iio/accel/cros_ec_accel_legacy.c
+++ b/drivers/iio/accel/cros_ec_accel_legacy.c
@@ -62,7 +62,7 @@  static int cros_ec_accel_legacy_read_cmd(struct iio_dev *indio_dev,
 		return ret;
 	}
 
-	for_each_set_bit(i, &scan_mask, indio_dev->masklength) {
+	for_each_set_bit(i, &scan_mask, iio_get_masklength(indio_dev)) {
 		*data = st->resp->dump.sensor[sensor_num].data[i] *
 			st->sign[i];
 		data++;