The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] iio: buffer: only set IRQF_ONESHOT when thread handler is provided
@ 2026-05-14 22:46 Дамјан Гео ргиевски
  0 siblings, 0 replies; only message in thread
From: Дамјан Гео ргиевски @ 2026-05-14 22:46 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
  Cc: linux-iio, linux-kernel,
	Дамјан Георгиевски

iio_triggered_buffer_setup_ext() unconditionally passes IRQF_ONESHOT to
iio_alloc_pollfunc(), even when the caller provides no thread function.
This causes a warning in __setup_irq() when the trigger is later
attached:

  WARNING: kernel/irq/manage.c:1502 at __setup_irq+0x4ee/0x700

IRQF_ONESHOT keeps the IRQ masked until the threaded handler completes,
but with no threaded handler this is semantically wrong. Only set the
flag when a thread function is actually provided.

Assisted-by: GitHub Copilot CLI:claude-opus-4-6
Signed-off-by: Дамјан Георгиевски <gdamjan@gmail.com>
---
This patch is a safety fix for how the Industrial I/O (IIO) subsystem handles
interrupts when setting up a triggered buffer.

It changes the flags passed to iio_alloc_pollfunc to ensure that the IRQF_ONESHOT
flag is only applied when a threaded interrupt handler actually exists.

Full disclosure, I got the warning on my laptop, and got Claude to debug
it. The explanation it gave sounds reasonable to me, but I'm not
personally familiar with the actual code.
---
 drivers/iio/buffer/industrialio-triggered-buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/buffer/industrialio-triggered-buffer.c b/drivers/iio/buffer/industrialio-triggered-buffer.c
index 9bf75dee7ff8..40eea3a44724 100644
--- a/drivers/iio/buffer/industrialio-triggered-buffer.c
+++ b/drivers/iio/buffer/industrialio-triggered-buffer.c
@@ -64,7 +64,7 @@ int iio_triggered_buffer_setup_ext(struct iio_dev *indio_dev,
 
 	indio_dev->pollfunc = iio_alloc_pollfunc(h,
 						 thread,
-						 IRQF_ONESHOT,
+						 thread ? IRQF_ONESHOT : 0,
 						 indio_dev,
 						 "%s_consumer%d",
 						 indio_dev->name,

---
base-commit: 1d5dcaa3bd65f2e8c9baa14a393d3a2dc5db7524
change-id: 20260513-patch-iio-buffer-395d8ca94768

Best regards,
--  
Дамјан Георгиевски <gdamjan@gmail.com>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-14 22:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14 22:46 [PATCH] iio: buffer: only set IRQF_ONESHOT when thread handler is provided Дамјан Гео ргиевски

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