Skip to contentSkip to conversation

iio: light: st_uvis25: notify the current trigger when done

PATCH In review Jonathan Cameron 3 participants 4 messages Nov 9 – Nov 14

Subsystems (2)
lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

PATCH 1/1 iio: light: st_uvis25: notify the current trigger when done

From: Jonathan Cameron <[email protected]>

The trigger handler calls iio_trigger_notify_done() on the driver's own trigger rather than on the trigger that is currently in use by the device. The driver does not restrict which trigger may be used, so if another trigger, for example an hrtimer trigger, is selected then that trigger's use_count is never decremented and it stops firing after the first sample. The driver's own trigger use_count also underflows, preventing it from firing later.

Use iio_dev->trig instead.

Fixes 3025c8688c1e ("iio: light: add support for UVIS25 sensor")

---
Another LLM found one as part of refactoring how all the code around triggers works. Definitely the wrong trigger. There are lots that access the right trigger via the wrong path (shortly to be cleaned up), this one manages to get the wrong one in many cases!

---
 drivers/iio/light/st_uvis25_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/st_uvis25_core.c +1 -1
index 94d5261b2663..5c63a68948d6 100644
@@ -248,7 +248,7 @@ static irqreturn_t st_uvis25_buffer_handler_thread(int irq, void *p)
 				    iio_get_time_ns(iio_dev));
 
 out:
-	iio_trigger_notify_done(hw->trig);
+	iio_trigger_notify_done(iio_dev->trig);
 
 	return IRQ_HANDLED;
 }
Signature · 1 line
2.56.0
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines

From: Jonathan Cameron <[email protected]>

The trigger handler calls iio_trigger_notify_done() on the driver's own trigger rather than on the trigger that is currently in use by the device. The driver does not restrict which trigger may be used, so if another trigger, for example an hrtimer trigger, is selected then that trigger's use_count is never decremented and it stops firing after the first sample. The driver's own trigger use_count also underflows, preventing it from firing later.

Quoted 5 lines

Use iio_dev->trig instead.

Fixes 3025c8688c1e ("iio: light: add support for UVIS25 sensor")
Quoted 25 lines

---
Another LLM found one as part of refactoring how all the code around triggers works. Definitely the wrong trigger. There are lots that access the right trigger via the wrong path (shortly to be cleaned up), this one manages to get the wrong one in many cases!

---
 drivers/iio/light/st_uvis25_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/st_uvis25_core.c +1 -1
index 94d5261b2663..5c63a68948d6 100644
@@ -248,7 +248,7 @@ static irqreturn_t st_uvis25_buffer_handler_thread(int irq, void *p)
 				    iio_get_time_ns(iio_dev));
 
 out:
-	iio_trigger_notify_done(hw->trig);
+	iio_trigger_notify_done(iio_dev->trig);
 
 	return IRQ_HANDLED;
 }
Signature · 1 line
2.56.0
#2 lore raw
Quoted 10 lines · On Mon, 9 Nov 2026 09:55:42 +0100 Lorenzo Bianconi <[email protected]> wrote:
Quoted 10 lines

From: Jonathan Cameron <[email protected]>

The trigger handler calls iio_trigger_notify_done() on the driver's own trigger rather than on the trigger that is currently in use by the device. The driver does not restrict which trigger may be used, so if another trigger, for example an hrtimer trigger, is selected then that trigger's use_count is never decremented and it stops firing after the first sample. The driver's own trigger use_count also underflows, preventing it from firing later.

Quoted 7 lines
Quoted 5 lines

Use iio_dev->trig instead.

Fixes 3025c8688c1e ("iio: light: add support for UVIS25 sensor")

Given content is all still here, rather than resend immediately to fix the linux-iio mailing list address, I've just fixed it in this reply.

Thanks Lorenzo.

Quoted 27 lines
Quoted 26 lines

---
Another LLM found one as part of refactoring how all the code around triggers works. Definitely the wrong trigger. There are lots that access the right trigger via the wrong path (shortly to be cleaned up), this one manages to get the wrong one in many cases!

---
 drivers/iio/light/st_uvis25_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/st_uvis25_core.c +1 -1
index 94d5261b2663..5c63a68948d6 100644
@@ -248,7 +248,7 @@ static irqreturn_t st_uvis25_buffer_handler_thread(int irq, void *p)
 				    iio_get_time_ns(iio_dev));
 
 out:
-	iio_trigger_notify_done(hw->trig);
+	iio_trigger_notify_done(iio_dev->trig);
 
 	return IRQ_HANDLED;
 }
Signature · 1 line
2.56.0
author maintainer
#3 lore raw
Quoted 15 lines · On Mon, 9 Nov 2026 08:55:23 -0800 Jonathan Cameron…
Quoted 12 lines · On Mon, 9 Nov 2026 09:55:42 +0100 Lorenzo Bianconi <[email protected]> wrote:
Quoted 12 lines

From: Jonathan Cameron <[email protected]>

The trigger handler calls iio_trigger_notify_done() on the driver's own trigger rather than on the trigger that is currently in use by the device. The driver does not restrict which trigger may be used, so if another trigger, for example an hrtimer trigger, is selected then that trigger's use_count is never decremented and it stops firing after the first sample. The driver's own trigger use_count also underflows, preventing it from firing later.

Use iio_dev->trig instead.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Fixes 3025c8688c1e ("iio: light: add support for UVIS25 sensor")

Given content is all still here, rather than resend immediately to fix the linux-iio mailing list address, I've just fixed it in this reply.

I decided to be a tiny bit naughty. So picked this up directly from lkml (Well I asked b4 to find it).

Thanks,

J

Quoted 31 lines

Thanks Lorenzo.

Quoted 27 lines
Quoted 26 lines

---
Another LLM found one as part of refactoring how all the code around triggers works. Definitely the wrong trigger. There are lots that access the right trigger via the wrong path (shortly to be cleaned up), this one manages to get the wrong one in many cases!

---
 drivers/iio/light/st_uvis25_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/st_uvis25_core.c +1 -1
index 94d5261b2663..5c63a68948d6 100644
@@ -248,7 +248,7 @@ static irqreturn_t st_uvis25_buffer_handler_thread(int irq, void *p)
 				    iio_get_time_ns(iio_dev));
 
 out:
-	iio_trigger_notify_done(hw->trig);
+	iio_trigger_notify_done(iio_dev->trig);
 
 	return IRQ_HANDLED;
 }
Signature · 1 line
2.56.0