Skip to contentSkip to conversation

irqf_oneshot.cocci: add check of devm_request_threaded_irq()

PATCH New Valentin Rothberg 1 participant 1 message Mar 3, 2015 Coccinelle/Semantic Patches (SmPL)

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 irqf_oneshot.cocci: add check of devm_request_threaded_irq()

Since commit 1c6c69525b40eb76de8adf039409722015927dc3 ("genirq: Reject bogus threaded irq requests") threaded IRQs without a primary handler need to be requested with IRQF_ONESHOT, otherwise the request will fail.

Until now, this coccinelle script only checked request_threaded_irq(). However, the counterpart devm function (see kernel/irq/devres.c) is also affected by the missing flag which can be detected with this patch.

---
 scripts/coccinelle/misc/irqf_oneshot.cocci | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
scripts/coccinelle/misc/irqf_oneshot.cocci +24 -0
index 6cfde94..a24a754 100644
@@ -12,11 +12,13 @@ virtual org
 virtual report
 
 @r1@
+expression dev;
 expression irq;
 expression thread_fn;
 expression flags;
 position p;
 @@
+(
 request_threaded_irq at p(irq, NULL, thread_fn,
 (
 flags | IRQF_ONESHOT
@@ -24,13 +26,24 @@ flags | IRQF_ONESHOT
 IRQF_ONESHOT
 )
 , ...)
+|
+devm_request_threaded_irq at p(dev, irq, NULL, thread_fn,
+(
+flags | IRQF_ONESHOT
+|
+IRQF_ONESHOT
+)
+, ...)
+)
 
 @depends on patch@
+expression dev;
 expression irq;
 expression thread_fn;
 expression flags;
 position p != r1.p;
 @@
+(
 request_threaded_irq at p(irq, NULL, thread_fn,
 (
 -0
@@ -40,6 +53,17 @@ request_threaded_irq at p(irq, NULL, thread_fn,
 +flags | IRQF_ONESHOT
 )
 , ...)
+|
+devm_request_threaded_irq at p(dev, irq, NULL, thread_fn,
+(
+-0
++IRQF_ONESHOT
+|
+-flags
++flags | IRQF_ONESHOT
+)
+, ...)
+)
 
 @depends on context@
 position p != r1.p;
Signature · 1 line
1.9.1