Linux IIO development
 help / color / mirror / Atom feed
From: "Дамјан Гео ргиевски" <gdamjan@gmail.com>
To: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Дамјан Георгиевски" <gdamjan@gmail.com>
Subject: [PATCH] iio: buffer: only set IRQF_ONESHOT when thread handler is provided
Date: Fri, 15 May 2026 00:46:00 +0200	[thread overview]
Message-ID: <20260515-patch-iio-buffer-v1-1-667dac4e55e5@gmail.com> (raw)

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>


                 reply	other threads:[~2026-05-14 22:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260515-patch-iio-buffer-v1-1-667dac4e55e5@gmail.com \
    --to=gdamjan@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox