mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger.
@ 2026-11-09  4:28 Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 01/14] iio: accel: mma8452: unregister own trigger rather than current one Jonathan Cameron
                   ` (13 more replies)
  0 siblings, 14 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

Resend due to wrong linux-iio email address. Sorry for the noise!

LLM used to help pull this fairly straight forward series together.

The primary aim here is to ensure a clean layering between the two sides
of the trigger / pollfunc (push to buffers) divide.  The caller of
iio_trigger_poll() and iio_trigger_poll_nested() should be using data
relevant to the trigger, not iio_dev->trig which is the
current_trigger for the device. Most drivers got this layering right,
but not this set!

This is also step 1 in a plan to make iio_dev->trig opaque allowing
more control of how it is assigned and avoiding traps around lifetimes.

Includes one precursor fix that has been broken long enough I think
we can just merge it via the slow path along with the rest of these.

Jonathan Cameron (14):
  iio: accel: mma8452: unregister own trigger rather than current one
  iio: accel: mma8452: poll own trigger from interrupt handler
  iio: adc: max1027: poll own trigger from interrupt handler
  iio: adc: ti-ads1119: poll own trigger from interrupt handler
  iio: adc: mxs-lradc-adc: poll own trigger from interrupt handler
  iio: adc: at91-sama5d2: poll own trigger on data ready interrupt
  iio: light: vl6180: poll own trigger from interrupt handler
  iio: proximity: vl53l0x-i2c: poll own trigger from interrupt handler
  iio: adc: ad4691: poll own trigger from interrupt handler
  iio: chemical: scd30: poll own trigger from interrupt handler
  iio: proximity: vl53l1x-i2c: poll own trigger from interrupt handler
  iio: proximity: irsd200: poll own trigger from interrupt handler
  iio: light: vcnl4000: poll own trigger from interrupt handler
  iio: adc: at91_adc: poll the enabled trigger from interrupt handler

 drivers/iio/accel/mma8452.c         | 11 ++++++++---
 drivers/iio/adc/ad4691.c            |  4 +++-
 drivers/iio/adc/at91-sama5d2_adc.c  |  2 +-
 drivers/iio/adc/at91_adc.c          |  6 ++++--
 drivers/iio/adc/max1027.c           |  2 +-
 drivers/iio/adc/mxs-lradc-adc.c     |  2 +-
 drivers/iio/adc/ti-ads1119.c        |  2 +-
 drivers/iio/chemical/scd30.h        |  2 ++
 drivers/iio/chemical/scd30_core.c   |  4 +++-
 drivers/iio/light/vcnl4000.c        |  4 +++-
 drivers/iio/light/vl6180.c          |  2 +-
 drivers/iio/proximity/irsd200.c     |  4 +++-
 drivers/iio/proximity/vl53l0x-i2c.c |  2 +-
 drivers/iio/proximity/vl53l1x-i2c.c |  4 +++-
 14 files changed, 35 insertions(+), 16 deletions(-)

-- 
2.56.0


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

* [RESEND PATCH 01/14] iio: accel: mma8452: unregister own trigger rather than current one
  2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
@ 2026-11-09  4:28 ` Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 02/14] iio: accel: mma8452: poll own trigger from interrupt handler Jonathan Cameron
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron, stable

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

mma8452_trigger_cleanup() uses indio_dev->trig to unregister the trigger.
That may or may not be the one it registered as this driver allows
triggers other than its own to be used.

Keep a pointer to the driver's own trigger in struct mma8452_data and
unregister that instead.

Fixes: ae6d9ce05691 ("iio: mma8452: Add support for interrupt driven triggers.")
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/accel/mma8452.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index dc8031e14c29..f9abff3842fc 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -115,6 +115,7 @@
  * @orientation:		mounting matrix, flipped axis etc.
  * @chip_info:			chip specific data
  * @regs:			reference to voltage regulators
+ * @trig:			data ready trigger, if an interrupt is available
  * @buffer:			triggered buffer
  * @sleep_val:			time in ms to sleep while waiting for drdy
  * @ctrl_reg1:			CTRL_REG1 register shadow value
@@ -127,6 +128,7 @@ struct mma8452_data {
 	struct iio_mount_matrix orientation;
 	const struct mma_chip_info *chip_info;
 	struct regulator_bulk_data regs[2];
+	struct iio_trigger *trig;
 
 	/* Ensure correct alignment of time stamp when present */
 	struct {
@@ -1526,6 +1528,7 @@ static int mma8452_trigger_setup(struct iio_dev *indio_dev)
 	if (ret)
 		return ret;
 
+	data->trig = trig;
 	indio_dev->trig = iio_trigger_get(trig);
 
 	return 0;
@@ -1533,8 +1536,10 @@ static int mma8452_trigger_setup(struct iio_dev *indio_dev)
 
 static void mma8452_trigger_cleanup(struct iio_dev *indio_dev)
 {
-	if (indio_dev->trig)
-		iio_trigger_unregister(indio_dev->trig);
+	struct mma8452_data *data = iio_priv(indio_dev);
+
+	if (data->trig)
+		iio_trigger_unregister(data->trig);
 }
 
 static int mma8452_reset(struct i2c_client *client)
-- 
2.56.0


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

* [RESEND PATCH 02/14] iio: accel: mma8452: poll own trigger from interrupt handler
  2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 01/14] iio: accel: mma8452: unregister own trigger rather than current one Jonathan Cameron
@ 2026-11-09  4:28 ` Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 03/14] iio: adc: max1027: " Jonathan Cameron
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

Poll data->trig from mma8452_interrupt() rather than indio_dev->trig.
The data ready interrupt is only enabled by the driver's own trigger's
set_trigger_state() callback, so that is the trigger in use whenever
this path is reached.

This removes a dependency on the trig field of struct iio_dev, which
is to become private to the IIO core.

Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/accel/mma8452.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index f9abff3842fc..44962ac7491f 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -1099,7 +1099,7 @@ static irqreturn_t mma8452_interrupt(int irq, void *p)
 		return IRQ_NONE;
 
 	if (src & MMA8452_INT_DRDY) {
-		iio_trigger_poll_nested(indio_dev->trig);
+		iio_trigger_poll_nested(data->trig);
 		ret = IRQ_HANDLED;
 	}
 
-- 
2.56.0


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

* [RESEND PATCH 03/14] iio: adc: max1027: poll own trigger from interrupt handler
  2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 01/14] iio: accel: mma8452: unregister own trigger rather than current one Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 02/14] iio: accel: mma8452: poll own trigger from interrupt handler Jonathan Cameron
@ 2026-11-09  4:28 ` Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 04/14] iio: adc: ti-ads1119: " Jonathan Cameron
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

Poll st->trig from max1027_handler() rather than indio_dev->trig. The
poll is only reached when the buffer is enabled and the device's own
trigger is in use.

This removes a dependency on the trig field of struct iio_dev, which
is to become private to the IIO core.

Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/adc/max1027.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
index 8d282feea8b5..65a0e85faca9 100644
--- a/drivers/iio/adc/max1027.c
+++ b/drivers/iio/adc/max1027.c
@@ -481,7 +481,7 @@ static irqreturn_t max1027_handler(int irq, void *private)
 	if (!iio_buffer_enabled(indio_dev) || !iio_trigger_using_own(indio_dev))
 		complete(&st->complete);
 	else
-		iio_trigger_poll(indio_dev->trig);
+		iio_trigger_poll(st->trig);
 
 	return IRQ_HANDLED;
 }
-- 
2.56.0


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

* [RESEND PATCH 04/14] iio: adc: ti-ads1119: poll own trigger from interrupt handler
  2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
                   ` (2 preceding siblings ...)
  2026-11-09  4:28 ` [RESEND PATCH 03/14] iio: adc: max1027: " Jonathan Cameron
@ 2026-11-09  4:28 ` Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 05/14] iio: adc: mxs-lradc-adc: " Jonathan Cameron
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

Poll st->trig from ads1119_irq_handler() rather than indio_dev->trig.
The poll is only reached when iio_trigger_using_own() is true.

This removes a dependency on the trig field of struct iio_dev, which
is to become private to the IIO core.

Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/adc/ti-ads1119.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti-ads1119.c b/drivers/iio/adc/ti-ads1119.c
index b0f04741ddc6..e815ba6d9d4f 100644
--- a/drivers/iio/adc/ti-ads1119.c
+++ b/drivers/iio/adc/ti-ads1119.c
@@ -497,7 +497,7 @@ static irqreturn_t ads1119_irq_handler(int irq, void *dev_id)
 	struct ads1119_state *st = iio_priv(indio_dev);
 
 	if (iio_buffer_enabled(indio_dev) && iio_trigger_using_own(indio_dev))
-		iio_trigger_poll(indio_dev->trig);
+		iio_trigger_poll(st->trig);
 	else
 		complete(&st->completion);
 
-- 
2.56.0


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

* [RESEND PATCH 05/14] iio: adc: mxs-lradc-adc: poll own trigger from interrupt handler
  2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
                   ` (3 preceding siblings ...)
  2026-11-09  4:28 ` [RESEND PATCH 04/14] iio: adc: ti-ads1119: " Jonathan Cameron
@ 2026-11-09  4:28 ` Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 06/14] iio: adc: at91-sama5d2: poll own trigger on data ready interrupt Jonathan Cameron
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

Poll adc->trig from the interrupt handler rather than iio->trig.
Conversions that raise this interrupt are only started when the
driver's own trigger is enabled, via its set_trigger_state() callback.

This removes a dependency on the trig field of struct iio_dev, which
is to become private to the IIO core.

Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/adc/mxs-lradc-adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c
index dda5182a5076..0174c7bb8d58 100644
--- a/drivers/iio/adc/mxs-lradc-adc.c
+++ b/drivers/iio/adc/mxs-lradc-adc.c
@@ -393,7 +393,7 @@ static irqreturn_t mxs_lradc_adc_handle_irq(int irq, void *data)
 	if (iio_buffer_enabled(iio)) {
 		if (reg & lradc->buffer_vchans) {
 			spin_lock_irqsave(&adc->lock, flags);
-			iio_trigger_poll(iio->trig);
+			iio_trigger_poll(adc->trig);
 			spin_unlock_irqrestore(&adc->lock, flags);
 		}
 	} else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) {
-- 
2.56.0


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

* [RESEND PATCH 06/14] iio: adc: at91-sama5d2: poll own trigger on data ready interrupt
  2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
                   ` (4 preceding siblings ...)
  2026-11-09  4:28 ` [RESEND PATCH 05/14] iio: adc: mxs-lradc-adc: " Jonathan Cameron
@ 2026-11-09  4:28 ` Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 07/14] iio: light: vl6180: poll own trigger from interrupt handler Jonathan Cameron
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

Poll st->trig from the data ready interrupt path rather than
indio->trig. The data ready interrupt is only enabled for the triggered
buffer when DMA is not in use and the device's own trigger is in use,
see at91_adc_buffer_check_use_irq().

The DMA completion callback still polls indio_dev->trig as it must run
the pollfunc on whichever trigger the device is using.

This removes one dependency on the trig field of struct iio_dev, which
is to become private to the IIO core.

Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/adc/at91-sama5d2_adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index dba4e7b2e77b..e4db74fa1360 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -1711,7 +1711,7 @@ static irqreturn_t at91_adc_interrupt(int irq, void *private)
 		   (status & AT91_SAMA5D2_IER_DRDY)) {
 		/* triggered buffer without DMA */
 		disable_irq_nosync(irq);
-		iio_trigger_poll(indio->trig);
+		iio_trigger_poll(st->trig);
 	} else if (iio_buffer_enabled(indio) && st->dma_st.dma_chan) {
 		/* triggered buffer with DMA - should not happen */
 		disable_irq_nosync(irq);
-- 
2.56.0


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

* [RESEND PATCH 07/14] iio: light: vl6180: poll own trigger from interrupt handler
  2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
                   ` (5 preceding siblings ...)
  2026-11-09  4:28 ` [RESEND PATCH 06/14] iio: adc: at91-sama5d2: poll own trigger on data ready interrupt Jonathan Cameron
@ 2026-11-09  4:28 ` Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 08/14] iio: proximity: vl53l0x-i2c: " Jonathan Cameron
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

Poll data->trig from vl6180_threaded_irq() rather than indio_dev->trig.
The poll is only reached with the buffer enabled, which is only possible
with the driver's own trigger as iio_validate_own_trigger() rejects any
other.

This removes a dependency on the trig field of struct iio_dev, which
is to become private to the IIO core.

Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/light/vl6180.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/vl6180.c b/drivers/iio/light/vl6180.c
index aef8a5333442..44fd0446b583 100644
--- a/drivers/iio/light/vl6180.c
+++ b/drivers/iio/light/vl6180.c
@@ -525,7 +525,7 @@ static irqreturn_t vl6180_threaded_irq(int irq, void *priv)
 	struct vl6180_data *data = iio_priv(indio_dev);
 
 	if (iio_buffer_enabled(indio_dev))
-		iio_trigger_poll_nested(indio_dev->trig);
+		iio_trigger_poll_nested(data->trig);
 	else
 		complete(&data->completion);
 
-- 
2.56.0


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

* [RESEND PATCH 08/14] iio: proximity: vl53l0x-i2c: poll own trigger from interrupt handler
  2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
                   ` (6 preceding siblings ...)
  2026-11-09  4:28 ` [RESEND PATCH 07/14] iio: light: vl6180: poll own trigger from interrupt handler Jonathan Cameron
@ 2026-11-09  4:28 ` Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 09/14] iio: adc: ad4691: " Jonathan Cameron
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

Poll data->trig from vl53l0x_threaded_irq() rather than
indio_dev->trig. vl53l0x_validate_trigger() only accepts the driver's
own trigger, so with the buffer enabled that is the trigger in use.

This removes a dependency on the trig field of struct iio_dev, which
is to become private to the IIO core.

Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/proximity/vl53l0x-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/proximity/vl53l0x-i2c.c b/drivers/iio/proximity/vl53l0x-i2c.c
index 173e69753df7..6c595e647d75 100644
--- a/drivers/iio/proximity/vl53l0x-i2c.c
+++ b/drivers/iio/proximity/vl53l0x-i2c.c
@@ -107,7 +107,7 @@ static irqreturn_t vl53l0x_threaded_irq(int irq, void *priv)
 	struct vl53l0x_data *data = iio_priv(indio_dev);
 
 	if (iio_buffer_enabled(indio_dev))
-		iio_trigger_poll_nested(indio_dev->trig);
+		iio_trigger_poll_nested(data->trig);
 	else
 		complete(&data->completion);
 
-- 
2.56.0


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

* [RESEND PATCH 09/14] iio: adc: ad4691: poll own trigger from interrupt handler
  2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
                   ` (7 preceding siblings ...)
  2026-11-09  4:28 ` [RESEND PATCH 08/14] iio: proximity: vl53l0x-i2c: " Jonathan Cameron
@ 2026-11-09  4:28 ` Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 10/14] iio: chemical: scd30: " Jonathan Cameron
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

Keep a pointer to the CNV burst trigger in struct ad4691_state and poll
that from ad4691_irq() rather than indio_dev->trig. The interrupt is
only enabled for CNV burst mode with the buffer enabled, and the iio_info
used in that mode only accepts the driver's own trigger via
iio_validate_own_trigger(), so this is the same trigger.

This removes a dependency on the trig field of struct iio_dev, which
is to become private to the IIO core.

Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/adc/ad4691.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ad4691.c b/drivers/iio/adc/ad4691.c
index f2f7c4c6424a..f63a68a009f8 100644
--- a/drivers/iio/adc/ad4691.c
+++ b/drivers/iio/adc/ad4691.c
@@ -441,6 +441,7 @@ struct ad4691_state {
 	struct spi_device *spi;
 
 	struct pwm_device *conv_trigger;
+	struct iio_trigger *trig;
 	int irq;
 	int vref_uV;
 	u32 cnv_period_ns;
@@ -1563,7 +1564,7 @@ static irqreturn_t ad4691_irq(int irq, void *private)
 	 * the IRQ.
 	 */
 	disable_irq_nosync(st->irq);
-	iio_trigger_poll(indio_dev->trig);
+	iio_trigger_poll(st->trig);
 
 	return IRQ_HANDLED;
 }
@@ -1861,6 +1862,7 @@ static int ad4691_setup_triggered_buffer(struct iio_dev *indio_dev,
 	if (!trig)
 		return -ENOMEM;
 
+	st->trig = trig;
 	trig->ops = &ad4691_trigger_ops;
 	iio_trigger_set_drvdata(trig, st);
 
-- 
2.56.0


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

* [RESEND PATCH 10/14] iio: chemical: scd30: poll own trigger from interrupt handler
  2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
                   ` (8 preceding siblings ...)
  2026-11-09  4:28 ` [RESEND PATCH 09/14] iio: adc: ad4691: " Jonathan Cameron
@ 2026-11-09  4:28 ` Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 11/14] iio: proximity: vl53l1x-i2c: " Jonathan Cameron
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

Keep a pointer to the driver's trigger in struct scd30_state and poll
that from scd30_irq_handler() rather than indio_dev->trig. With the
buffer enabled, the interrupt is only enabled by the trigger's
set_trigger_state() callback, so it is the driver's own trigger that is
in use.

This removes a dependency on the trig field of struct iio_dev, which
is to become private to the IIO core.

Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/chemical/scd30.h      | 2 ++
 drivers/iio/chemical/scd30_core.c | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/chemical/scd30.h b/drivers/iio/chemical/scd30.h
index 1ac9f3f79271..bdec5cf62a26 100644
--- a/drivers/iio/chemical/scd30.h
+++ b/drivers/iio/chemical/scd30.h
@@ -9,6 +9,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/types.h>
 
+struct iio_trigger;
 struct scd30_state;
 
 enum scd30_cmd {
@@ -57,6 +58,7 @@ struct scd30_state {
 	 */
 	void *priv;
 	int irq;
+	struct iio_trigger *trig;
 	/*
 	 * no way to retrieve current ambient pressure compensation value from
 	 * the sensor so keep one around
diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c
index 770571c21521..ca824436f60e 100644
--- a/drivers/iio/chemical/scd30_core.c
+++ b/drivers/iio/chemical/scd30_core.c
@@ -573,9 +573,10 @@ static void scd30_disable_regulator(void *data)
 static irqreturn_t scd30_irq_handler(int irq, void *priv)
 {
 	struct iio_dev *indio_dev = priv;
+	struct scd30_state *state = iio_priv(indio_dev);
 
 	if (iio_buffer_enabled(indio_dev)) {
-		iio_trigger_poll(indio_dev->trig);
+		iio_trigger_poll(state->trig);
 
 		return IRQ_HANDLED;
 	}
@@ -666,6 +667,7 @@ static int scd30_setup_trigger(struct iio_dev *indio_dev)
 	if (!trig)
 		return -ENOMEM;
 
+	state->trig = trig;
 	trig->ops = &scd30_trigger_ops;
 	iio_trigger_set_drvdata(trig, indio_dev);
 
-- 
2.56.0


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

* [RESEND PATCH 11/14] iio: proximity: vl53l1x-i2c: poll own trigger from interrupt handler
  2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
                   ` (9 preceding siblings ...)
  2026-11-09  4:28 ` [RESEND PATCH 10/14] iio: chemical: scd30: " Jonathan Cameron
@ 2026-11-09  4:28 ` Jonathan Cameron
  2026-11-09  8:42   ` Joshua Crofts
  2026-11-09  4:28 ` [RESEND PATCH 12/14] iio: proximity: irsd200: " Jonathan Cameron
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

Keep a pointer to the driver's trigger in struct vl53l1x_data and poll
that from vl53l1x_irq_handler() rather than indio_dev->trig. Only the
driver's own trigger is accepted, via iio_validate_own_trigger(), so
with the buffer enabled that is the trigger in use.

This removes a dependency on the trig field of struct iio_dev, which
is to become private to the IIO core.

Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/proximity/vl53l1x-i2c.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/proximity/vl53l1x-i2c.c b/drivers/iio/proximity/vl53l1x-i2c.c
index bce238d1b6de..ffc6fe45b165 100644
--- a/drivers/iio/proximity/vl53l1x-i2c.c
+++ b/drivers/iio/proximity/vl53l1x-i2c.c
@@ -102,6 +102,7 @@ struct vl53l1x_data {
 	enum vl53l1x_distance_mode distance_mode;
 	u8 gpio_polarity;
 	int irq;
+	struct iio_trigger *trig;
 };
 
 static const struct regmap_range vl53l1x_volatile_ranges[] = {
@@ -587,7 +588,7 @@ static irqreturn_t vl53l1x_irq_handler(int irq, void *priv)
 	struct vl53l1x_data *data = iio_priv(indio_dev);
 
 	if (iio_buffer_enabled(indio_dev))
-		iio_trigger_poll(indio_dev->trig);
+		iio_trigger_poll(data->trig);
 	else
 		complete(&data->completion);
 
@@ -707,6 +708,7 @@ static int vl53l1x_probe(struct i2c_client *client)
 		if (!trig)
 			return -ENOMEM;
 
+		data->trig = trig;
 		trig->ops = &vl53l1x_trigger_ops;
 		iio_trigger_set_drvdata(trig, indio_dev);
 		ret = devm_iio_trigger_register(dev, trig);
-- 
2.56.0


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

* [RESEND PATCH 12/14] iio: proximity: irsd200: poll own trigger from interrupt handler
  2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
                   ` (10 preceding siblings ...)
  2026-11-09  4:28 ` [RESEND PATCH 11/14] iio: proximity: vl53l1x-i2c: " Jonathan Cameron
@ 2026-11-09  4:28 ` Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 13/14] iio: light: vcnl4000: " Jonathan Cameron
  2026-11-09  4:28 ` [RESEND PATCH 14/14] iio: adc: at91_adc: poll the enabled " Jonathan Cameron
  13 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

Keep a pointer to the driver's trigger in struct irsd200_data and poll
that from irsd200_irq_thread() rather than indio_dev->trig. The data
interrupt source is only enabled by the trigger's set_trigger_state()
callback, so it is the driver's own trigger that is in use whenever this
path is reached.

This removes a dependency on the trig field of struct iio_dev, which
is to become private to the IIO core.

Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/proximity/irsd200.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/proximity/irsd200.c b/drivers/iio/proximity/irsd200.c
index b3db7f3a49f6..82edb135f4bf 100644
--- a/drivers/iio/proximity/irsd200.c
+++ b/drivers/iio/proximity/irsd200.c
@@ -122,6 +122,7 @@ struct irsd200_data {
 	struct regmap *regmap;
 	struct regmap_field *regfields[IRS_REGF_MAX];
 	struct device *dev;
+	struct iio_trigger *trig;
 };
 
 static int irsd200_setup(struct irsd200_data *data)
@@ -698,7 +699,7 @@ static irqreturn_t irsd200_irq_thread(int irq, void *dev_id)
 	}
 
 	if (status & BIT(IRS_INTR_DATA) && iio_buffer_enabled(indio_dev)) {
-		iio_trigger_poll_nested(indio_dev->trig);
+		iio_trigger_poll_nested(data->trig);
 		clear |= BIT(IRS_INTR_DATA);
 	}
 
@@ -917,6 +918,7 @@ static int irsd200_probe(struct i2c_client *client)
 	if (!trigger)
 		return -ENOMEM;
 
+	data->trig = trigger;
 	trigger->ops = &irsd200_trigger_ops;
 	iio_trigger_set_drvdata(trigger, data);
 
-- 
2.56.0


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

* [RESEND PATCH 13/14] iio: light: vcnl4000: poll own trigger from interrupt handler
  2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
                   ` (11 preceding siblings ...)
  2026-11-09  4:28 ` [RESEND PATCH 12/14] iio: proximity: irsd200: " Jonathan Cameron
@ 2026-11-09  4:28 ` Jonathan Cameron
  2026-11-09  8:46   ` Joshua Crofts
  2026-11-09  4:28 ` [RESEND PATCH 14/14] iio: adc: at91_adc: poll the enabled " Jonathan Cameron
  13 siblings, 1 reply; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

Keep a pointer to the driver's trigger in struct vcnl4000_data and poll
that from vcnl4010_irq_thread() on a data ready interrupt rather than
indio_dev->trig.

With the driver's own trigger in use this is the same trigger. The
driver does not restrict which trigger may be used and the data ready
interrupt is enabled whenever the buffer is enabled, so with another
trigger in use the data ready interrupt previously also polled that
trigger, running its consumers in addition to when it fired itself.
Now samples are only captured when the selected trigger fires, with the
trigger handler clearing the data ready status as before.

This removes a dependency on the trig field of struct iio_dev, which
is to become private to the IIO core.

Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/light/vcnl4000.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index 911f8d1c74d4..cab6e0af8c7e 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -206,6 +206,7 @@ struct vcnl4000_data {
 	struct vcnl4200_channel vcnl4200_al;
 	struct vcnl4200_channel vcnl4200_ps;
 	uint32_t near_level;
+	struct iio_trigger *trig;
 };
 
 struct vcnl4000_chip_spec {
@@ -1547,7 +1548,7 @@ static irqreturn_t vcnl4010_irq_thread(int irq, void *p)
 	}
 
 	if (isr & VCNL4010_INT_DRDY && iio_buffer_enabled(indio_dev))
-		iio_trigger_poll_nested(indio_dev->trig);
+		iio_trigger_poll_nested(data->trig);
 
 end:
 	return IRQ_HANDLED;
@@ -1893,6 +1894,7 @@ static int vcnl4010_probe_trigger(struct iio_dev *indio_dev)
 	if (!trigger)
 		return -ENOMEM;
 
+	data->trig = trigger;
 	trigger->ops = &vcnl4010_trigger_ops;
 	iio_trigger_set_drvdata(trigger, indio_dev);
 
-- 
2.56.0


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

* [RESEND PATCH 14/14] iio: adc: at91_adc: poll the enabled trigger from interrupt handler
  2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
                   ` (12 preceding siblings ...)
  2026-11-09  4:28 ` [RESEND PATCH 13/14] iio: light: vcnl4000: " Jonathan Cameron
@ 2026-11-09  4:28 ` Jonathan Cameron
  13 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-11-09  4:28 UTC (permalink / raw)
  To: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

The driver registers several hardware triggers, any of which may be
selected. The end of conversion interrupt is only enabled for buffered
capture by the set_trigger_state() callback of the trigger being
enabled, and handle_adc_eoc_trigger() then polls indio_dev->trig.

Record the trigger in at91_adc_configure_trigger() before enabling the
interrupt and poll that instead. It is not cleared on disable so that
an interrupt still in flight polls the same trigger as before rather
than dereferencing NULL.

Also use the trigger passed to at91_adc_configure_trigger() to look up
its configuration rather than indio_dev->trig, which is the same
trigger.

This removes the driver's dependencies on the trig field of struct
iio_dev, which is to become private to the IIO core.

Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/adc/at91_adc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 0ac74ad92fca..49e7fb2d39f2 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -229,6 +229,7 @@ struct at91_adc_state {
 	u8			sample_hold_time;
 	bool			sleep_mode;
 	struct iio_trigger	**trig;
+	struct iio_trigger	*cur_trig;	/* last enabled of trig[] */
 	bool			use_external;
 	u32			vref_mv;
 	u32			res;		/* resolution used for conversions */
@@ -294,7 +295,7 @@ static void handle_adc_eoc_trigger(int irq, struct iio_dev *idev)
 
 	if (iio_buffer_enabled(idev)) {
 		disable_irq_nosync(irq);
-		iio_trigger_poll(idev->trig);
+		iio_trigger_poll(st->cur_trig);
 	} else {
 		st->last_value = at91_adc_readl(st, AT91_ADC_CHAN(st, st->chnb));
 		/* Needed to ACK the DRDY interruption */
@@ -562,7 +563,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
 
 	value = at91_adc_get_trigger_value_by_name(idev,
 						   st->caps->triggers,
-						   idev->trig->name);
+						   trig->name);
 	if (value < 0)
 		return value;
 
@@ -581,6 +582,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
 					AT91_ADC_CH(chan->channel));
 		}
 
+		st->cur_trig = trig;
 		at91_adc_writel(st, AT91_ADC_IER, reg->drdy_mask);
 
 	} else {
-- 
2.56.0


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

* Re: [RESEND PATCH 11/14] iio: proximity: vl53l1x-i2c: poll own trigger from interrupt handler
  2026-11-09  4:28 ` [RESEND PATCH 11/14] iio: proximity: vl53l1x-i2c: " Jonathan Cameron
@ 2026-11-09  8:42   ` Joshua Crofts
  0 siblings, 0 replies; 17+ messages in thread
From: Joshua Crofts @ 2026-11-09  8:42 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed, David Lechner,
	Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

On Mon,  9 Nov 2026 04:28:48 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
> 
> Keep a pointer to the driver's trigger in struct vl53l1x_data and poll
> that from vl53l1x_irq_handler() rather than indio_dev->trig. Only the
> driver's own trigger is accepted, via iio_validate_own_trigger(), so
> with the buffer enabled that is the trigger in use.
> 
> This removes a dependency on the trig field of struct iio_dev, which
> is to become private to the IIO core.
> 
> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
> ---
>  drivers/iio/proximity/vl53l1x-i2c.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/proximity/vl53l1x-i2c.c b/drivers/iio/proximity/vl53l1x-i2c.c
> index bce238d1b6de..ffc6fe45b165 100644
> --- a/drivers/iio/proximity/vl53l1x-i2c.c
> +++ b/drivers/iio/proximity/vl53l1x-i2c.c
> @@ -102,6 +102,7 @@ struct vl53l1x_data {
>  	enum vl53l1x_distance_mode distance_mode;
>  	u8 gpio_polarity;
>  	int irq;
> +	struct iio_trigger *trig;

Pahole reports a 4 byte hole between irq and trig. Reordering
like this yields a better result:

struct regmap *            regmap;               /*     0     8 */
struct completion          completion __attribute__((__aligned__(8))); /*     8    32 */

/* XXX last struct has 1 hole */

struct reset_control *     xshut_reset;          /*    40     8 */
struct iio_trigger *       trig;                 /*    48     8 */
enum vl53l1x_distance_mode distance_mode;        /*    56     4 */
int                        irq;                  /*    60     4 */
/* --- cacheline 1 boundary (64 bytes) --- */
u8                         gpio_polarity;        /*    64     1 */

-- 
Kind regards,
Joshua Crofts

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

* Re: [RESEND PATCH 13/14] iio: light: vcnl4000: poll own trigger from interrupt handler
  2026-11-09  4:28 ` [RESEND PATCH 13/14] iio: light: vcnl4000: " Jonathan Cameron
@ 2026-11-09  8:46   ` Joshua Crofts
  0 siblings, 0 replies; 17+ messages in thread
From: Joshua Crofts @ 2026-11-09  8:46 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed, David Lechner,
	Nuno Sá,
	Andy Shevchenko, linux-kernel, Jonathan Cameron

On Mon,  9 Nov 2026 04:28:50 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
> 
> Keep a pointer to the driver's trigger in struct vcnl4000_data and poll
> that from vcnl4010_irq_thread() on a data ready interrupt rather than
> indio_dev->trig.
> 
> With the driver's own trigger in use this is the same trigger. The
> driver does not restrict which trigger may be used and the data ready
> interrupt is enabled whenever the buffer is enabled, so with another
> trigger in use the data ready interrupt previously also polled that
> trigger, running its consumers in addition to when it fired itself.
> Now samples are only captured when the selected trigger fires, with the
> trigger handler clearing the data ready status as before.
> 
> This removes a dependency on the trig field of struct iio_dev, which
> is to become private to the IIO core.
> 
> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
> ---
>  drivers/iio/light/vcnl4000.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
> index 911f8d1c74d4..cab6e0af8c7e 100644
> --- a/drivers/iio/light/vcnl4000.c
> +++ b/drivers/iio/light/vcnl4000.c
> @@ -206,6 +206,7 @@ struct vcnl4000_data {
>  	struct vcnl4200_channel vcnl4200_al;
>  	struct vcnl4200_channel vcnl4200_ps;
>  	uint32_t near_level;
> +	struct iio_trigger *trig;

Just swap near_level and trig and you'll eliminate a 4 byte hole.

-- 
Kind regards,
Joshua Crofts

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

end of thread, other threads:[~2026-11-09  8:47 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09  4:28 [RESEND PATCH 00/14] IIO: Ensure iio_trigger_poll() is of the device owned trigger Jonathan Cameron
2026-11-09  4:28 ` [RESEND PATCH 01/14] iio: accel: mma8452: unregister own trigger rather than current one Jonathan Cameron
2026-11-09  4:28 ` [RESEND PATCH 02/14] iio: accel: mma8452: poll own trigger from interrupt handler Jonathan Cameron
2026-11-09  4:28 ` [RESEND PATCH 03/14] iio: adc: max1027: " Jonathan Cameron
2026-11-09  4:28 ` [RESEND PATCH 04/14] iio: adc: ti-ads1119: " Jonathan Cameron
2026-11-09  4:28 ` [RESEND PATCH 05/14] iio: adc: mxs-lradc-adc: " Jonathan Cameron
2026-11-09  4:28 ` [RESEND PATCH 06/14] iio: adc: at91-sama5d2: poll own trigger on data ready interrupt Jonathan Cameron
2026-11-09  4:28 ` [RESEND PATCH 07/14] iio: light: vl6180: poll own trigger from interrupt handler Jonathan Cameron
2026-11-09  4:28 ` [RESEND PATCH 08/14] iio: proximity: vl53l0x-i2c: " Jonathan Cameron
2026-11-09  4:28 ` [RESEND PATCH 09/14] iio: adc: ad4691: " Jonathan Cameron
2026-11-09  4:28 ` [RESEND PATCH 10/14] iio: chemical: scd30: " Jonathan Cameron
2026-11-09  4:28 ` [RESEND PATCH 11/14] iio: proximity: vl53l1x-i2c: " Jonathan Cameron
2026-11-09  8:42   ` Joshua Crofts
2026-11-09  4:28 ` [RESEND PATCH 12/14] iio: proximity: irsd200: " Jonathan Cameron
2026-11-09  4:28 ` [RESEND PATCH 13/14] iio: light: vcnl4000: " Jonathan Cameron
2026-11-09  8:46   ` Joshua Crofts
2026-11-09  4:28 ` [RESEND PATCH 14/14] iio: adc: at91_adc: poll the enabled " Jonathan Cameron

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

all inboxes | Powered by JetHome®