public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Replace NULL thread handler with a dummy function.
@ 2026-02-28  2:36 junan
  2026-02-28 10:15 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: junan @ 2026-02-28  2:36 UTC (permalink / raw)
  To: jic23, dlechner, nuno.sa, andy, sakari.ailus
  Cc: linux-iio, linux-kernel, junan

Hi,

This is a similar problem as [1]:

[1] https://lore.kernel.org/linux-iio/20260227071409.aEG-iBFD@linutronix.de/T/#m15ab81856b42f72169fe51bd87fa399b5147441f

Since commit aef30c8d569c ("genirq: Warn about using IRQF_ONESHOT
without a threaded handler"), the IRQ core checks IRQF_ONESHOT flag
in IRQ request and gives a warning if there is no threaded handler.

There are two iio devices on my machine:

```
junan@fedora:~$ ls /sys/bus/iio/devices/
iio:device0  trigger0
junan@fedora:~$ cat /sys/bus/iio/devices/*/name
als
als-dev0
```

The function calling chain is as following:

hid_als_probe(hid-sensor-als.c)
	=> hid_sensor_setup_trigger(hid-sensor-trigger.c)
		=> iio_triggered_buffer_setup_ext(industrialio-triggered-buffer.c)

`iio_triggered_buffer_setup_ext` is called with a NULL thread handler, and the flag is set to `IRQF_ONESHOT` inside it.
I am not sure which flag to change, so I replace the NULL pointer with a dummy function or can we just change the flag?

Signed-off-by: junan <junan76@163.com>
---
 drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
index 5540e2d28f4a..ec251beeca92 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
@@ -202,6 +202,11 @@ static void hid_sensor_set_power_work(struct work_struct *work)
 		_hid_sensor_power_state(attrb, true);
 }
 
+static irqreturn_t hid_sensor_dummy_handler(int irq, void *p)
+{
+	return IRQ_HANDLED;
+}
+
 static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
 						bool state)
 {
@@ -240,7 +245,7 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name,
 		fifo_attrs = NULL;
 
 	ret = iio_triggered_buffer_setup_ext(indio_dev,
-					     &iio_pollfunc_store_time, NULL,
+					     &iio_pollfunc_store_time, &hid_sensor_dummy_handler,
 					     IIO_BUFFER_DIRECTION_IN,
 					     NULL, fifo_attrs);
 	if (ret) {
-- 
2.53.0


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

end of thread, other threads:[~2026-02-28 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-28  2:36 [PATCH] Replace NULL thread handler with a dummy function junan
2026-02-28 10:15 ` Andy Shevchenko
2026-02-28 11:21   ` Jonathan Cameron

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