public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/22] iio: make masklength __private (round 2)
@ 2024-07-18 13:37 Nuno Sa via B4 Relay
  2024-07-18 13:37 ` [PATCH 01/22] iio: adc: cc10001_adc: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
                   ` (22 more replies)
  0 siblings, 23 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:37 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

Hi Jonathan,

Here it goes the second round about annotating .masklength as __private.

Again, only compile tested for arm with allyesconfig.

---
Nuno Sa (22):
      iio: adc: cc10001_adc: make use of iio_for_each_active_channel()
      iio: adc: dln2-adc: use new '.masklength' accessors
      iio: adc: hx711: make use of iio_for_each_active_channel()
      iio: dummy: iio_simple_dummy_buffer: use iio_for_each_active_channel()
      iio: health: afe4403: make use of iio_for_each_active_channel()
      iio: health: max30102: make use of iio_get_masklength()
      iio: health: afe4404: make use of iio_for_each_active_channel()
      iio: humidity: am2315: make use of iio_for_each_active_channel()
      iio: imu: bmi160_core: make use of iio_for_each_active_channel()
      iio: imu: bno055: make use of iio_get_masklength()
      iio: imu: kmx61: make use of iio_for_each_active_channel()
      iio: light: adjd_s311: make use of iio_for_each_active_channel()
      iio: light: gp2ap020a00f: make use of iio_for_each_active_channel()
      iio: light: isl29125: make use of iio_for_each_active_channel()
      iio: light: si1145: use new '.masklength' accessors
      iio: light: tcs3414: make use of iio_for_each_active_channel()
      iio: light: tcs3472: make use of iio_for_each_active_channel()
      iio: magnetometer: rm3100-core: make use of iio_get_masklength()
      iio: pressure: dlhl60d: make use of iio_for_each_active_channel()
      iio: proximity: hx9023s: make use of iio_for_each_active_channel()
      iio: proximity: sx9500: make use of iio_for_each_active_channel()
      iio: proximity: sx_common: make use of iio_for_each_active_channel()

 drivers/iio/adc/cc10001_adc.c               | 4 +---
 drivers/iio/adc/dln2-adc.c                  | 8 +++-----
 drivers/iio/adc/hx711.c                     | 5 +----
 drivers/iio/dummy/iio_simple_dummy_buffer.c | 2 +-
 drivers/iio/health/afe4403.c                | 3 +--
 drivers/iio/health/afe4404.c                | 3 +--
 drivers/iio/health/max30102.c               | 2 +-
 drivers/iio/humidity/am2315.c               | 3 +--
 drivers/iio/imu/bmi160/bmi160_core.c        | 3 +--
 drivers/iio/imu/bno055/bno055.c             | 2 +-
 drivers/iio/imu/kmx61.c                     | 3 +--
 drivers/iio/light/adjd_s311.c               | 3 +--
 drivers/iio/light/gp2ap020a00f.c            | 9 +++------
 drivers/iio/light/isl29125.c                | 3 +--
 drivers/iio/light/si1145.c                  | 7 +++----
 drivers/iio/light/tcs3414.c                 | 3 +--
 drivers/iio/light/tcs3472.c                 | 3 +--
 drivers/iio/magnetometer/rm3100-core.c      | 2 +-
 drivers/iio/pressure/dlhl60d.c              | 3 +--
 drivers/iio/proximity/hx9023s.c             | 4 ++--
 drivers/iio/proximity/sx9500.c              | 3 +--
 drivers/iio/proximity/sx_common.c           | 6 ++----
 22 files changed, 30 insertions(+), 54 deletions(-)
---
base-commit: 986da024b99a72e64f6bdb3f3f0e52af024b1f50
change-id: 20240711-dev-iio-masklength-private2-cd8d93f07781
--

Thanks!
- Nuno Sá



^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 01/22] iio: adc: cc10001_adc: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
@ 2024-07-18 13:37 ` Nuno Sa via B4 Relay
  2024-07-20 15:59   ` Jonathan Cameron
  2024-07-18 13:37 ` [PATCH 02/22] iio: adc: dln2-adc: use new '.masklength' accessors Nuno Sa via B4 Relay
                   ` (21 subsequent siblings)
  22 siblings, 1 reply; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:37 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/cc10001_adc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/iio/adc/cc10001_adc.c b/drivers/iio/adc/cc10001_adc.c
index a432342348abe..2c51b90b71018 100644
--- a/drivers/iio/adc/cc10001_adc.c
+++ b/drivers/iio/adc/cc10001_adc.c
@@ -157,9 +157,7 @@ static irqreturn_t cc10001_adc_trigger_h(int irq, void *p)
 
 	i = 0;
 	sample_invalid = false;
-	for_each_set_bit(scan_idx, indio_dev->active_scan_mask,
-				  indio_dev->masklength) {
-
+	iio_for_each_active_channel(indio_dev, scan_idx) {
 		channel = indio_dev->channels[scan_idx].channel;
 		cc10001_adc_start(adc_dev, channel);
 

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 02/22] iio: adc: dln2-adc: use new '.masklength' accessors
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
  2024-07-18 13:37 ` [PATCH 01/22] iio: adc: cc10001_adc: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
@ 2024-07-18 13:37 ` Nuno Sa via B4 Relay
  2024-07-20 16:00   ` Jonathan Cameron
  2024-07-18 13:37 ` [PATCH 03/22] iio: adc: hx711: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
                   ` (20 subsequent siblings)
  22 siblings, 1 reply; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:37 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

From: Nuno Sa <nuno.sa@analog.com>

Make use of iio_get_masklength) and iio_for_each_active_channel() 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/dln2-adc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/dln2-adc.c b/drivers/iio/adc/dln2-adc.c
index 06cfbbabaf8dc..de7252a10047d 100644
--- a/drivers/iio/adc/dln2-adc.c
+++ b/drivers/iio/adc/dln2-adc.c
@@ -108,7 +108,7 @@ static void dln2_adc_update_demux(struct dln2_adc *dln2)
 	dln2->demux_count = 0;
 
 	/* Optimize all 8-channels case */
-	if (indio_dev->masklength &&
+	if (iio_get_masklength(indio_dev) &&
 	    (*indio_dev->active_scan_mask & 0xff) == 0xff) {
 		dln2_adc_add_demux(dln2, 0, 0, 16);
 		dln2->ts_pad_offset = 0;
@@ -117,9 +117,7 @@ static void dln2_adc_update_demux(struct dln2_adc *dln2)
 	}
 
 	/* Build demux table from fixed 8-channels to active_scan_mask */
-	for_each_set_bit(out_ind,
-			 indio_dev->active_scan_mask,
-			 indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, out_ind) {
 		/* Handle timestamp separately */
 		if (out_ind == DLN2_ADC_MAX_CHANNELS)
 			break;
@@ -541,7 +539,7 @@ static int dln2_adc_triggered_buffer_postenable(struct iio_dev *indio_dev)
 
 	/* Assign trigger channel based on first enabled channel */
 	trigger_chan = find_first_bit(indio_dev->active_scan_mask,
-				      indio_dev->masklength);
+				      iio_get_masklength(indio_dev));
 	if (trigger_chan < DLN2_ADC_MAX_CHANNELS) {
 		dln2->trigger_chan = trigger_chan;
 		ret = dln2_adc_set_chan_period(dln2, dln2->trigger_chan,

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 03/22] iio: adc: hx711: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
  2024-07-18 13:37 ` [PATCH 01/22] iio: adc: cc10001_adc: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
  2024-07-18 13:37 ` [PATCH 02/22] iio: adc: dln2-adc: use new '.masklength' accessors Nuno Sa via B4 Relay
@ 2024-07-18 13:37 ` Nuno Sa via B4 Relay
  2024-07-20 16:01   ` Jonathan Cameron
  2024-07-18 13:37 ` [PATCH 04/22] iio: dummy: iio_simple_dummy_buffer: use iio_for_each_active_channel() Nuno Sa via B4 Relay
                   ` (19 subsequent siblings)
  22 siblings, 1 reply; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:37 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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(-)

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++;

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 04/22] iio: dummy: iio_simple_dummy_buffer: use iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (2 preceding siblings ...)
  2024-07-18 13:37 ` [PATCH 03/22] iio: adc: hx711: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
@ 2024-07-18 13:37 ` Nuno Sa via B4 Relay
  2024-07-20 16:02   ` Jonathan Cameron
  2024-07-18 13:37 ` [PATCH 05/22] iio: health: afe4403: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
                   ` (18 subsequent siblings)
  22 siblings, 1 reply; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:37 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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

diff --git a/drivers/iio/dummy/iio_simple_dummy_buffer.c b/drivers/iio/dummy/iio_simple_dummy_buffer.c
index 9b2f99449a829..4ca3f1aaff999 100644
--- a/drivers/iio/dummy/iio_simple_dummy_buffer.c
+++ b/drivers/iio/dummy/iio_simple_dummy_buffer.c
@@ -68,7 +68,7 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p)
 	 * Here let's pretend we have random access. And the values are in the
 	 * constant table fakedata.
 	 */
-	for_each_set_bit(j, indio_dev->active_scan_mask, indio_dev->masklength)
+	iio_for_each_active_channel(indio_dev, j)
 		data[i++] = fakedata[j];
 
 	iio_push_to_buffers_with_timestamp(indio_dev, data,

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 05/22] iio: health: afe4403: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (3 preceding siblings ...)
  2024-07-18 13:37 ` [PATCH 04/22] iio: dummy: iio_simple_dummy_buffer: use iio_for_each_active_channel() Nuno Sa via B4 Relay
@ 2024-07-18 13:37 ` Nuno Sa via B4 Relay
  2024-07-20 16:03   ` Jonathan Cameron
  2024-07-18 13:37 ` [PATCH 06/22] iio: health: max30102: make use of iio_get_masklength() Nuno Sa via B4 Relay
                   ` (17 subsequent siblings)
  22 siblings, 1 reply; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:37 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/health/afe4403.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c
index 52326dc521ac..85637e8ac45f 100644
--- a/drivers/iio/health/afe4403.c
+++ b/drivers/iio/health/afe4403.c
@@ -321,8 +321,7 @@ static irqreturn_t afe4403_trigger_handler(int irq, void *private)
 	if (ret)
 		goto err;
 
-	for_each_set_bit(bit, indio_dev->active_scan_mask,
-			 indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, bit) {
 		ret = spi_write_then_read(afe->spi,
 					  &afe4403_channel_values[bit], 1,
 					  rx, sizeof(rx));

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 06/22] iio: health: max30102: make use of iio_get_masklength()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (4 preceding siblings ...)
  2024-07-18 13:37 ` [PATCH 05/22] iio: health: afe4403: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
@ 2024-07-18 13:37 ` Nuno Sa via B4 Relay
  2024-07-20 16:04   ` Jonathan Cameron
  2024-07-18 13:37 ` [PATCH 07/22] iio: health: afe4404: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
                   ` (16 subsequent siblings)
  22 siblings, 1 reply; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:37 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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

diff --git a/drivers/iio/health/max30102.c b/drivers/iio/health/max30102.c
index 07a343e35a81..1d074eb6a8c5 100644
--- a/drivers/iio/health/max30102.c
+++ b/drivers/iio/health/max30102.c
@@ -293,7 +293,7 @@ static irqreturn_t max30102_interrupt_handler(int irq, void *private)
 	struct iio_dev *indio_dev = private;
 	struct max30102_data *data = iio_priv(indio_dev);
 	unsigned int measurements = bitmap_weight(indio_dev->active_scan_mask,
-						  indio_dev->masklength);
+						  iio_get_masklength(indio_dev));
 	int ret, cnt = 0;
 
 	mutex_lock(&data->lock);

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 07/22] iio: health: afe4404: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (5 preceding siblings ...)
  2024-07-18 13:37 ` [PATCH 06/22] iio: health: max30102: make use of iio_get_masklength() Nuno Sa via B4 Relay
@ 2024-07-18 13:37 ` Nuno Sa via B4 Relay
  2024-07-20 16:05   ` Jonathan Cameron
  2024-07-18 13:37 ` [PATCH 08/22] iio: humidity: am2315: " Nuno Sa via B4 Relay
                   ` (15 subsequent siblings)
  22 siblings, 1 reply; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:37 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/health/afe4404.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c
index 7f69baa1ed53..d49e1572a439 100644
--- a/drivers/iio/health/afe4404.c
+++ b/drivers/iio/health/afe4404.c
@@ -333,8 +333,7 @@ static irqreturn_t afe4404_trigger_handler(int irq, void *private)
 	struct afe4404_data *afe = iio_priv(indio_dev);
 	int ret, bit, i = 0;
 
-	for_each_set_bit(bit, indio_dev->active_scan_mask,
-			 indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, bit) {
 		ret = regmap_read(afe->regmap, afe4404_channel_values[bit],
 				  &afe->buffer[i++]);
 		if (ret)

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 08/22] iio: humidity: am2315: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (6 preceding siblings ...)
  2024-07-18 13:37 ` [PATCH 07/22] iio: health: afe4404: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
@ 2024-07-18 13:37 ` Nuno Sa via B4 Relay
  2024-07-18 13:37 ` [PATCH 09/22] iio: imu: bmi160_core: " Nuno Sa via B4 Relay
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:37 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/humidity/am2315.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/humidity/am2315.c b/drivers/iio/humidity/am2315.c
index a56474be5dd2..6b0aa3a3f025 100644
--- a/drivers/iio/humidity/am2315.c
+++ b/drivers/iio/humidity/am2315.c
@@ -174,8 +174,7 @@ static irqreturn_t am2315_trigger_handler(int irq, void *p)
 		data->scan.chans[1] = sensor_data.temp_data;
 	} else {
 		i = 0;
-		for_each_set_bit(bit, indio_dev->active_scan_mask,
-				 indio_dev->masklength) {
+		iio_for_each_active_channel(indio_dev, bit) {
 			data->scan.chans[i] = (bit ? sensor_data.temp_data :
 					       sensor_data.hum_data);
 			i++;

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 09/22] iio: imu: bmi160_core: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (7 preceding siblings ...)
  2024-07-18 13:37 ` [PATCH 08/22] iio: humidity: am2315: " Nuno Sa via B4 Relay
@ 2024-07-18 13:37 ` Nuno Sa via B4 Relay
  2024-07-18 13:37 ` [PATCH 10/22] iio: imu: bno055: make use of iio_get_masklength() Nuno Sa via B4 Relay
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:37 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/imu/bmi160/bmi160_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
index 90aa04d94da54..495e8a74ac676 100644
--- a/drivers/iio/imu/bmi160/bmi160_core.c
+++ b/drivers/iio/imu/bmi160/bmi160_core.c
@@ -435,8 +435,7 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p)
 	int i, ret, j = 0, base = BMI160_REG_DATA_MAGN_XOUT_L;
 	__le16 sample;
 
-	for_each_set_bit(i, indio_dev->active_scan_mask,
-			 indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, i) {
 		ret = regmap_bulk_read(data->regmap, base + i * sizeof(sample),
 				       &sample, sizeof(sample));
 		if (ret)

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 10/22] iio: imu: bno055: make use of iio_get_masklength()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (8 preceding siblings ...)
  2024-07-18 13:37 ` [PATCH 09/22] iio: imu: bmi160_core: " Nuno Sa via B4 Relay
@ 2024-07-18 13:37 ` Nuno Sa via B4 Relay
  2024-07-18 13:37 ` [PATCH 11/22] iio: imu: kmx61: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:37 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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

diff --git a/drivers/iio/imu/bno055/bno055.c b/drivers/iio/imu/bno055/bno055.c
index 52744dd98e65b..ea6519b22b2f3 100644
--- a/drivers/iio/imu/bno055/bno055.c
+++ b/drivers/iio/imu/bno055/bno055.c
@@ -1458,7 +1458,7 @@ static irqreturn_t bno055_trigger_handler(int irq, void *p)
 	 * then we split the transfer, skipping the gap.
 	 */
 	for_each_set_bitrange(start, end, iio_dev->active_scan_mask,
-			      iio_dev->masklength) {
+			      iio_get_masklength(iio_dev)) {
 		/*
 		 * First transfer will start from the beginning of the first
 		 * ones-field in the bitmap

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 11/22] iio: imu: kmx61: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (9 preceding siblings ...)
  2024-07-18 13:37 ` [PATCH 10/22] iio: imu: bno055: make use of iio_get_masklength() Nuno Sa via B4 Relay
@ 2024-07-18 13:37 ` Nuno Sa via B4 Relay
  2024-07-18 13:37 ` [PATCH 12/22] iio: light: adjd_s311: " Nuno Sa via B4 Relay
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:37 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/imu/kmx61.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c
index d37eca5ef761..c61c012e25bb 100644
--- a/drivers/iio/imu/kmx61.c
+++ b/drivers/iio/imu/kmx61.c
@@ -1200,8 +1200,7 @@ static irqreturn_t kmx61_trigger_handler(int irq, void *p)
 		base = KMX61_MAG_XOUT_L;
 
 	mutex_lock(&data->lock);
-	for_each_set_bit(bit, indio_dev->active_scan_mask,
-			 indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, bit) {
 		ret = kmx61_read_measurement(data, base, bit);
 		if (ret < 0) {
 			mutex_unlock(&data->lock);

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 12/22] iio: light: adjd_s311: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (10 preceding siblings ...)
  2024-07-18 13:37 ` [PATCH 11/22] iio: imu: kmx61: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
@ 2024-07-18 13:37 ` Nuno Sa via B4 Relay
  2024-07-18 13:37 ` [PATCH 13/22] iio: light: gp2ap020a00f: " Nuno Sa via B4 Relay
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:37 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/light/adjd_s311.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/light/adjd_s311.c b/drivers/iio/light/adjd_s311.c
index 5169f12c3ebaf..c1b43053fbc73 100644
--- a/drivers/iio/light/adjd_s311.c
+++ b/drivers/iio/light/adjd_s311.c
@@ -125,8 +125,7 @@ static irqreturn_t adjd_s311_trigger_handler(int irq, void *p)
 	if (ret < 0)
 		goto done;
 
-	for_each_set_bit(i, indio_dev->active_scan_mask,
-		indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, i) {
 		ret = i2c_smbus_read_word_data(data->client,
 			ADJD_S311_DATA_REG(i));
 		if (ret < 0)

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 13/22] iio: light: gp2ap020a00f: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (11 preceding siblings ...)
  2024-07-18 13:37 ` [PATCH 12/22] iio: light: adjd_s311: " Nuno Sa via B4 Relay
@ 2024-07-18 13:37 ` Nuno Sa via B4 Relay
  2024-07-18 13:38 ` [PATCH 14/22] iio: light: isl29125: " Nuno Sa via B4 Relay
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:37 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/light/gp2ap020a00f.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c
index 757383456da6..b3f87dded040 100644
--- a/drivers/iio/light/gp2ap020a00f.c
+++ b/drivers/iio/light/gp2ap020a00f.c
@@ -965,8 +965,7 @@ static irqreturn_t gp2ap020a00f_trigger_handler(int irq, void *data)
 	size_t d_size = 0;
 	int i, out_val, ret;
 
-	for_each_set_bit(i, indio_dev->active_scan_mask,
-		indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, i) {
 		ret = regmap_bulk_read(priv->regmap,
 				GP2AP020A00F_DATA_REG(i),
 				&priv->buffer[d_size], 2);
@@ -1397,8 +1396,7 @@ static int gp2ap020a00f_buffer_postenable(struct iio_dev *indio_dev)
 	 * two separate IIO channels they are treated in the driver logic
 	 * as if they were controlled independently.
 	 */
-	for_each_set_bit(i, indio_dev->active_scan_mask,
-		indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, i) {
 		switch (i) {
 		case GP2AP020A00F_SCAN_MODE_LIGHT_CLEAR:
 			err = gp2ap020a00f_exec_cmd(data,
@@ -1435,8 +1433,7 @@ static int gp2ap020a00f_buffer_predisable(struct iio_dev *indio_dev)
 
 	mutex_lock(&data->lock);
 
-	for_each_set_bit(i, indio_dev->active_scan_mask,
-		indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, i) {
 		switch (i) {
 		case GP2AP020A00F_SCAN_MODE_LIGHT_CLEAR:
 			err = gp2ap020a00f_exec_cmd(data,

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 14/22] iio: light: isl29125: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (12 preceding siblings ...)
  2024-07-18 13:37 ` [PATCH 13/22] iio: light: gp2ap020a00f: " Nuno Sa via B4 Relay
@ 2024-07-18 13:38 ` Nuno Sa via B4 Relay
  2024-07-18 13:38 ` [PATCH 15/22] iio: light: si1145: use new '.masklength' accessors Nuno Sa via B4 Relay
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/light/isl29125.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/light/isl29125.c b/drivers/iio/light/isl29125.c
index 59329546df58..b176bf4c884b 100644
--- a/drivers/iio/light/isl29125.c
+++ b/drivers/iio/light/isl29125.c
@@ -181,8 +181,7 @@ static irqreturn_t isl29125_trigger_handler(int irq, void *p)
 	struct isl29125_data *data = iio_priv(indio_dev);
 	int i, j = 0;
 
-	for_each_set_bit(i, indio_dev->active_scan_mask,
-		indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, i) {
 		int ret = i2c_smbus_read_word_data(data->client,
 			isl29125_regs[i].data);
 		if (ret < 0)

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 15/22] iio: light: si1145: use new '.masklength' accessors
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (13 preceding siblings ...)
  2024-07-18 13:38 ` [PATCH 14/22] iio: light: isl29125: " Nuno Sa via B4 Relay
@ 2024-07-18 13:38 ` Nuno Sa via B4 Relay
  2024-07-18 13:38 ` [PATCH 16/22] iio: light: tcs3414: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

From: Nuno Sa <nuno.sa@analog.com>

Make use of iio_get_masklength) and iio_for_each_active_channel() 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/light/si1145.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/light/si1145.c b/drivers/iio/light/si1145.c
index 77666b780a5c5..66abda021696a 100644
--- a/drivers/iio/light/si1145.c
+++ b/drivers/iio/light/si1145.c
@@ -465,11 +465,10 @@ static irqreturn_t si1145_trigger_handler(int irq, void *private)
 			goto done;
 	}
 
-	for_each_set_bit(i, indio_dev->active_scan_mask,
-		indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, i) {
 		int run = 1;
 
-		while (i + run < indio_dev->masklength) {
+		while (i + run < iio_get_masklength(indio_dev)) {
 			if (!test_bit(i + run, indio_dev->active_scan_mask))
 				break;
 			if (indio_dev->channels[i + run].address !=
@@ -514,7 +513,7 @@ static int si1145_set_chlist(struct iio_dev *indio_dev, unsigned long scan_mask)
 	if (data->scan_mask == scan_mask)
 		return 0;
 
-	for_each_set_bit(i, &scan_mask, indio_dev->masklength) {
+	for_each_set_bit(i, &scan_mask, iio_get_masklength(indio_dev)) {
 		switch (indio_dev->channels[i].address) {
 		case SI1145_REG_ALSVIS_DATA:
 			reg |= SI1145_CHLIST_EN_ALSVIS;

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 16/22] iio: light: tcs3414: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (14 preceding siblings ...)
  2024-07-18 13:38 ` [PATCH 15/22] iio: light: si1145: use new '.masklength' accessors Nuno Sa via B4 Relay
@ 2024-07-18 13:38 ` Nuno Sa via B4 Relay
  2024-07-18 13:38 ` [PATCH 17/22] iio: light: tcs3472: " Nuno Sa via B4 Relay
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/light/tcs3414.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/light/tcs3414.c b/drivers/iio/light/tcs3414.c
index c9566615b964..4fecdf10aeb1 100644
--- a/drivers/iio/light/tcs3414.c
+++ b/drivers/iio/light/tcs3414.c
@@ -206,8 +206,7 @@ static irqreturn_t tcs3414_trigger_handler(int irq, void *p)
 	struct tcs3414_data *data = iio_priv(indio_dev);
 	int i, j = 0;
 
-	for_each_set_bit(i, indio_dev->active_scan_mask,
-		indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, i) {
 		int ret = i2c_smbus_read_word_data(data->client,
 			TCS3414_DATA_GREEN + 2*i);
 		if (ret < 0)

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 17/22] iio: light: tcs3472: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (15 preceding siblings ...)
  2024-07-18 13:38 ` [PATCH 16/22] iio: light: tcs3414: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
@ 2024-07-18 13:38 ` Nuno Sa via B4 Relay
  2024-07-18 13:38 ` [PATCH 18/22] iio: magnetometer: rm3100-core: make use of iio_get_masklength() Nuno Sa via B4 Relay
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/light/tcs3472.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/light/tcs3472.c b/drivers/iio/light/tcs3472.c
index 89384dba83dd..04452b4664f3 100644
--- a/drivers/iio/light/tcs3472.c
+++ b/drivers/iio/light/tcs3472.c
@@ -383,8 +383,7 @@ static irqreturn_t tcs3472_trigger_handler(int irq, void *p)
 	if (ret < 0)
 		goto done;
 
-	for_each_set_bit(i, indio_dev->active_scan_mask,
-		indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, i) {
 		ret = i2c_smbus_read_word_data(data->client,
 			TCS3472_CDATA + 2*i);
 		if (ret < 0)

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 18/22] iio: magnetometer: rm3100-core: make use of iio_get_masklength()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (16 preceding siblings ...)
  2024-07-18 13:38 ` [PATCH 17/22] iio: light: tcs3472: " Nuno Sa via B4 Relay
@ 2024-07-18 13:38 ` Nuno Sa via B4 Relay
  2024-07-18 13:38 ` [PATCH 19/22] iio: pressure: dlhl60d: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/magnetometer/rm3100-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/magnetometer/rm3100-core.c b/drivers/iio/magnetometer/rm3100-core.c
index 42b70cd42b393..0e03a772fa43d 100644
--- a/drivers/iio/magnetometer/rm3100-core.c
+++ b/drivers/iio/magnetometer/rm3100-core.c
@@ -464,7 +464,7 @@ static irqreturn_t rm3100_trigger_handler(int irq, void *p)
 	struct iio_poll_func *pf = p;
 	struct iio_dev *indio_dev = pf->indio_dev;
 	unsigned long scan_mask = *indio_dev->active_scan_mask;
-	unsigned int mask_len = indio_dev->masklength;
+	unsigned int mask_len = iio_get_masklength(indio_dev);
 	struct rm3100_data *data = iio_priv(indio_dev);
 	struct regmap *regmap = data->regmap;
 	int ret, i, bit;

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 19/22] iio: pressure: dlhl60d: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (17 preceding siblings ...)
  2024-07-18 13:38 ` [PATCH 18/22] iio: magnetometer: rm3100-core: make use of iio_get_masklength() Nuno Sa via B4 Relay
@ 2024-07-18 13:38 ` Nuno Sa via B4 Relay
  2024-07-18 13:38 ` [PATCH 20/22] iio: proximity: hx9023s: " Nuno Sa via B4 Relay
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/pressure/dlhl60d.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/pressure/dlhl60d.c b/drivers/iio/pressure/dlhl60d.c
index 0bba4c5a8d405..c1cea9d40424e 100644
--- a/drivers/iio/pressure/dlhl60d.c
+++ b/drivers/iio/pressure/dlhl60d.c
@@ -256,8 +256,7 @@ static irqreturn_t dlh_trigger_handler(int irq, void *private)
 	if (ret)
 		goto out;
 
-	for_each_set_bit(chn, indio_dev->active_scan_mask,
-			 indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, chn) {
 		memcpy(&tmp_buf[i++],
 			&st->rx_buf[1] + chn * DLH_NUM_DATA_BYTES,
 			DLH_NUM_DATA_BYTES);

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 20/22] iio: proximity: hx9023s: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (18 preceding siblings ...)
  2024-07-18 13:38 ` [PATCH 19/22] iio: pressure: dlhl60d: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
@ 2024-07-18 13:38 ` Nuno Sa via B4 Relay
  2024-07-18 13:38 ` [PATCH 21/22] iio: proximity: sx9500: " Nuno Sa via B4 Relay
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/proximity/hx9023s.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
index 63e3b56d4f4ce..fe14a62a13428 100644
--- a/drivers/iio/proximity/hx9023s.c
+++ b/drivers/iio/proximity/hx9023s.c
@@ -936,7 +936,7 @@ static irqreturn_t hx9023s_trigger_handler(int irq, void *private)
 		goto out;
 	}
 
-	for_each_set_bit(bit, indio_dev->active_scan_mask, indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, bit) {
 		index = indio_dev->channels[bit].channel;
 		data->buffer.channels[i++] = cpu_to_le16(data->ch_data[index].diff);
 	}
@@ -957,7 +957,7 @@ static int hx9023s_buffer_preenable(struct iio_dev *indio_dev)
 	unsigned int bit;
 
 	guard(mutex)(&data->mutex);
-	for_each_set_bit(bit, indio_dev->active_scan_mask, indio_dev->masklength)
+	iio_for_each_active_channel(indio_dev, bit)
 		__set_bit(indio_dev->channels[bit].channel, &channels);
 
 	hx9023s_update_chan_en(data, channels, data->chan_event);

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 21/22] iio: proximity: sx9500: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (19 preceding siblings ...)
  2024-07-18 13:38 ` [PATCH 20/22] iio: proximity: hx9023s: " Nuno Sa via B4 Relay
@ 2024-07-18 13:38 ` Nuno Sa via B4 Relay
  2024-07-18 13:38 ` [PATCH 22/22] iio: proximity: sx_common: " Nuno Sa via B4 Relay
  2024-07-20 15:58 ` [PATCH 00/22] iio: make masklength __private (round 2) Jonathan Cameron
  22 siblings, 0 replies; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/proximity/sx9500.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
index 92630812ece2..3f4eace05cfc 100644
--- a/drivers/iio/proximity/sx9500.c
+++ b/drivers/iio/proximity/sx9500.c
@@ -654,8 +654,7 @@ static irqreturn_t sx9500_trigger_handler(int irq, void *private)
 
 	mutex_lock(&data->mutex);
 
-	for_each_set_bit(bit, indio_dev->active_scan_mask,
-			 indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, bit) {
 		ret = sx9500_read_prox_data(data, &indio_dev->channels[bit],
 					    &val);
 		if (ret < 0)

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 22/22] iio: proximity: sx_common: make use of iio_for_each_active_channel()
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (20 preceding siblings ...)
  2024-07-18 13:38 ` [PATCH 21/22] iio: proximity: sx9500: " Nuno Sa via B4 Relay
@ 2024-07-18 13:38 ` Nuno Sa via B4 Relay
  2024-07-20 16:14   ` Jonathan Cameron
  2024-07-20 15:58 ` [PATCH 00/22] iio: make masklength __private (round 2) Jonathan Cameron
  22 siblings, 1 reply; 32+ messages in thread
From: Nuno Sa via B4 Relay @ 2024-07-18 13:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andreas Klinger, Song Qiang

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/proximity/sx_common.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/proximity/sx_common.c b/drivers/iio/proximity/sx_common.c
index a95e9814aaf2..71aa6dced7d3 100644
--- a/drivers/iio/proximity/sx_common.c
+++ b/drivers/iio/proximity/sx_common.c
@@ -369,8 +369,7 @@ static irqreturn_t sx_common_trigger_handler(int irq, void *private)
 
 	mutex_lock(&data->mutex);
 
-	for_each_set_bit(bit, indio_dev->active_scan_mask,
-			 indio_dev->masklength) {
+	iio_for_each_active_channel(indio_dev, bit) {
 		ret = data->chip_info->ops.read_prox_data(data,
 						     &indio_dev->channels[bit],
 						     &val);
@@ -398,8 +397,7 @@ static int sx_common_buffer_preenable(struct iio_dev *indio_dev)
 	int bit, ret;
 
 	mutex_lock(&data->mutex);
-	for_each_set_bit(bit, indio_dev->active_scan_mask,
-			 indio_dev->masklength)
+	iio_for_each_active_channel(indio_dev, bit)
 		__set_bit(indio_dev->channels[bit].channel, &channels);
 
 	ret = sx_common_update_chan_en(data, channels, data->chan_event);

-- 
2.45.2



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/22] iio: make masklength __private (round 2)
  2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
                   ` (21 preceding siblings ...)
  2024-07-18 13:38 ` [PATCH 22/22] iio: proximity: sx_common: " Nuno Sa via B4 Relay
@ 2024-07-20 15:58 ` Jonathan Cameron
  22 siblings, 0 replies; 32+ messages in thread
From: Jonathan Cameron @ 2024-07-20 15:58 UTC (permalink / raw)
  To: Nuno Sa via B4 Relay
  Cc: nuno.sa, linux-iio, Lars-Peter Clausen, Andreas Klinger,
	Song Qiang

On Thu, 18 Jul 2024 15:37:46 +0200
Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@kernel.org> wrote:

> Hi Jonathan,
> 
> Here it goes the second round about annotating .masklength as __private.
> 
> Again, only compile tested for arm with allyesconfig.
I'm going to pick up as many of these as I'm happy with. However
I'll only be putting them in the testing branch so there is plenty of
time yet for additional feedback as I can rebase that as much as needed

Thanks,

Jonathan

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 01/22] iio: adc: cc10001_adc: make use of iio_for_each_active_channel()
  2024-07-18 13:37 ` [PATCH 01/22] iio: adc: cc10001_adc: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
@ 2024-07-20 15:59   ` Jonathan Cameron
  0 siblings, 0 replies; 32+ messages in thread
From: Jonathan Cameron @ 2024-07-20 15:59 UTC (permalink / raw)
  To: Nuno Sa via B4 Relay
  Cc: nuno.sa, linux-iio, Lars-Peter Clausen, Andreas Klinger,
	Song Qiang

On Thu, 18 Jul 2024 15:37:47 +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>
Applied

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 02/22] iio: adc: dln2-adc: use new '.masklength' accessors
  2024-07-18 13:37 ` [PATCH 02/22] iio: adc: dln2-adc: use new '.masklength' accessors Nuno Sa via B4 Relay
@ 2024-07-20 16:00   ` Jonathan Cameron
  0 siblings, 0 replies; 32+ messages in thread
From: Jonathan Cameron @ 2024-07-20 16:00 UTC (permalink / raw)
  To: Nuno Sa via B4 Relay
  Cc: nuno.sa, linux-iio, Lars-Peter Clausen, Andreas Klinger,
	Song Qiang

On Thu, 18 Jul 2024 15:37:48 +0200
Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@kernel.org> wrote:

> From: Nuno Sa <nuno.sa@analog.com>
> 
> Make use of iio_get_masklength) and iio_for_each_active_channel() 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>
Applied

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 03/22] iio: adc: hx711: make use of iio_for_each_active_channel()
  2024-07-18 13:37 ` [PATCH 03/22] iio: adc: hx711: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
@ 2024-07-20 16:01   ` Jonathan Cameron
  0 siblings, 0 replies; 32+ messages in thread
From: Jonathan Cameron @ 2024-07-20 16:01 UTC (permalink / raw)
  To: Nuno Sa via B4 Relay
  Cc: nuno.sa, linux-iio, Lars-Peter Clausen, Andreas Klinger,
	Song Qiang

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++;
> 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 04/22] iio: dummy: iio_simple_dummy_buffer: use iio_for_each_active_channel()
  2024-07-18 13:37 ` [PATCH 04/22] iio: dummy: iio_simple_dummy_buffer: use iio_for_each_active_channel() Nuno Sa via B4 Relay
@ 2024-07-20 16:02   ` Jonathan Cameron
  0 siblings, 0 replies; 32+ messages in thread
From: Jonathan Cameron @ 2024-07-20 16:02 UTC (permalink / raw)
  To: Nuno Sa via B4 Relay
  Cc: nuno.sa, linux-iio, Lars-Peter Clausen, Andreas Klinger,
	Song Qiang

On Thu, 18 Jul 2024 15:37:50 +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.
Even without the __private bit the new code is nicer!
> 
> Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Applied.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 05/22] iio: health: afe4403: make use of iio_for_each_active_channel()
  2024-07-18 13:37 ` [PATCH 05/22] iio: health: afe4403: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
@ 2024-07-20 16:03   ` Jonathan Cameron
  0 siblings, 0 replies; 32+ messages in thread
From: Jonathan Cameron @ 2024-07-20 16:03 UTC (permalink / raw)
  To: Nuno Sa via B4 Relay
  Cc: nuno.sa, linux-iio, Lars-Peter Clausen, Andreas Klinger,
	Song Qiang

On Thu, 18 Jul 2024 15:37:51 +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>

Applied

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 06/22] iio: health: max30102: make use of iio_get_masklength()
  2024-07-18 13:37 ` [PATCH 06/22] iio: health: max30102: make use of iio_get_masklength() Nuno Sa via B4 Relay
@ 2024-07-20 16:04   ` Jonathan Cameron
  0 siblings, 0 replies; 32+ messages in thread
From: Jonathan Cameron @ 2024-07-20 16:04 UTC (permalink / raw)
  To: Nuno Sa via B4 Relay
  Cc: nuno.sa, linux-iio, Lars-Peter Clausen, Andreas Klinger,
	Song Qiang

On Thu, 18 Jul 2024 15:37:52 +0200
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.
> 
> Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Applied

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 07/22] iio: health: afe4404: make use of iio_for_each_active_channel()
  2024-07-18 13:37 ` [PATCH 07/22] iio: health: afe4404: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
@ 2024-07-20 16:05   ` Jonathan Cameron
  0 siblings, 0 replies; 32+ messages in thread
From: Jonathan Cameron @ 2024-07-20 16:05 UTC (permalink / raw)
  To: Nuno Sa via B4 Relay
  Cc: nuno.sa, linux-iio, Lars-Peter Clausen, Andreas Klinger,
	Song Qiang

On Thu, 18 Jul 2024 15:37:53 +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>
Applied.
Hmm. Maybe I should have been optimistic an looked through whole lot
first so as to save on emails ;)


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 22/22] iio: proximity: sx_common: make use of iio_for_each_active_channel()
  2024-07-18 13:38 ` [PATCH 22/22] iio: proximity: sx_common: " Nuno Sa via B4 Relay
@ 2024-07-20 16:14   ` Jonathan Cameron
  0 siblings, 0 replies; 32+ messages in thread
From: Jonathan Cameron @ 2024-07-20 16:14 UTC (permalink / raw)
  To: Nuno Sa via B4 Relay
  Cc: nuno.sa, linux-iio, Lars-Peter Clausen, Andreas Klinger,
	Song Qiang

On Thu, 18 Jul 2024 15:38:08 +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>
I applied them all to the testing branch of iio.git which will be rebased on rc1
once available then pushed out as togreg for linux-next to pick up.

A few of the functions that got changes were pieces of nastiness that I'd long
banished from my mind so at least I got to look at those again :)
Datashuffling logic is 'fun'.


Thanks,

Jonathan

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2024-07-20 16:15 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-18 13:37 [PATCH 00/22] iio: make masklength __private (round 2) Nuno Sa via B4 Relay
2024-07-18 13:37 ` [PATCH 01/22] iio: adc: cc10001_adc: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
2024-07-20 15:59   ` Jonathan Cameron
2024-07-18 13:37 ` [PATCH 02/22] iio: adc: dln2-adc: use new '.masklength' accessors Nuno Sa via B4 Relay
2024-07-20 16:00   ` Jonathan Cameron
2024-07-18 13:37 ` [PATCH 03/22] iio: adc: hx711: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
2024-07-20 16:01   ` Jonathan Cameron
2024-07-18 13:37 ` [PATCH 04/22] iio: dummy: iio_simple_dummy_buffer: use iio_for_each_active_channel() Nuno Sa via B4 Relay
2024-07-20 16:02   ` Jonathan Cameron
2024-07-18 13:37 ` [PATCH 05/22] iio: health: afe4403: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
2024-07-20 16:03   ` Jonathan Cameron
2024-07-18 13:37 ` [PATCH 06/22] iio: health: max30102: make use of iio_get_masklength() Nuno Sa via B4 Relay
2024-07-20 16:04   ` Jonathan Cameron
2024-07-18 13:37 ` [PATCH 07/22] iio: health: afe4404: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
2024-07-20 16:05   ` Jonathan Cameron
2024-07-18 13:37 ` [PATCH 08/22] iio: humidity: am2315: " Nuno Sa via B4 Relay
2024-07-18 13:37 ` [PATCH 09/22] iio: imu: bmi160_core: " Nuno Sa via B4 Relay
2024-07-18 13:37 ` [PATCH 10/22] iio: imu: bno055: make use of iio_get_masklength() Nuno Sa via B4 Relay
2024-07-18 13:37 ` [PATCH 11/22] iio: imu: kmx61: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
2024-07-18 13:37 ` [PATCH 12/22] iio: light: adjd_s311: " Nuno Sa via B4 Relay
2024-07-18 13:37 ` [PATCH 13/22] iio: light: gp2ap020a00f: " Nuno Sa via B4 Relay
2024-07-18 13:38 ` [PATCH 14/22] iio: light: isl29125: " Nuno Sa via B4 Relay
2024-07-18 13:38 ` [PATCH 15/22] iio: light: si1145: use new '.masklength' accessors Nuno Sa via B4 Relay
2024-07-18 13:38 ` [PATCH 16/22] iio: light: tcs3414: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
2024-07-18 13:38 ` [PATCH 17/22] iio: light: tcs3472: " Nuno Sa via B4 Relay
2024-07-18 13:38 ` [PATCH 18/22] iio: magnetometer: rm3100-core: make use of iio_get_masklength() Nuno Sa via B4 Relay
2024-07-18 13:38 ` [PATCH 19/22] iio: pressure: dlhl60d: make use of iio_for_each_active_channel() Nuno Sa via B4 Relay
2024-07-18 13:38 ` [PATCH 20/22] iio: proximity: hx9023s: " Nuno Sa via B4 Relay
2024-07-18 13:38 ` [PATCH 21/22] iio: proximity: sx9500: " Nuno Sa via B4 Relay
2024-07-18 13:38 ` [PATCH 22/22] iio: proximity: sx_common: " Nuno Sa via B4 Relay
2024-07-20 16:14   ` Jonathan Cameron
2024-07-20 15:58 ` [PATCH 00/22] iio: make masklength __private (round 2) Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox