[RESEND PATCH 13/14] iio: light: vcnl4000: poll own trigger from interrupt handler
From: Jonathan Cameron
Date: Sun Nov 08 2026 - 23:30:44 EST
From: Jonathan Cameron <jonathan.cameron@xxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxx>
---
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