Skip to contentSkip to conversation

lis3lv02d: Omit IRQF_ONESHOT if no threaded handler is provided

PATCH New Ard Biesheuvel 1 participant 1 message Mar 26

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lis3lv02d: Omit IRQF_ONESHOT if no threaded handler is provided

The lis3lv02d started triggering a WARN in the IRQ code because it passes IRQF_ONESHOT to request_threaded_irq() even when thread_fn is NULL, which is an invalid combination.

So set the flag only if thread_fn is non-NULL.

Cc Eric Piel <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/misc/lis3lv02d/lis3lv02d.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/misc/lis3lv02d/lis3lv02d.c +4 -2
index 9c68f8b1d5d6..21e8ad0a7444 100644
@@ -1230,10 +1230,12 @@ int lis3lv02d_init_device(struct lis3lv02d *lis3)
 	else
 		thread_fn = NULL;
 
+	if (thread_fn)
+		irq_flags |= IRQF_ONESHOT;
+
 	err = request_threaded_irq(lis3->irq, lis302dl_interrupt,
 				thread_fn,
-				IRQF_TRIGGER_RISING | IRQF_ONESHOT |
-				irq_flags,
+				irq_flags | IRQF_TRIGGER_RISING,
 				DRIVER_NAME, lis3);
 
 	if (err < 0) {
Signature · 1 line
2.53.0