Skip to content

Commit

Permalink
scripts/coccinelle: Find threaded IRQs requests which are missing IRQ…
Browse files Browse the repository at this point in the history
…F_ONESHOT

Since commit 1c6c695 ("genirq: Reject bogus threaded irq requests") threaded
IRQs without a primary handler need to be requested with IRQF_ONESHOT, otherwise
the request will fail. This semantic patch will help to statically identify
(and fix) such cases.

Signed-off-by: Lars-Peter Clausen <[email protected]>
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
  • Loading branch information
larsclausen authored and michal42 committed Jul 13, 2012
1 parent 5f011d7 commit f1f4550
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions scripts/coccinelle/misc/irqf_oneshot.cocci
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/// Make sure threaded IRQs without a primary handler are always request with
/// IRQF_ONESHOT
///
//
// Confidence: Good
// Comments:
// Options: --no-includes

virtual patch
virtual context
virtual org
virtual report

@r1@
expression irq;
expression thread_fn;
expression flags;
position p;
@@
request_threaded_irq@p(irq, NULL, thread_fn,
(
flags | IRQF_ONESHOT
|
IRQF_ONESHOT
)
, ...)

@depends on patch@
expression irq;
expression thread_fn;
expression flags;
position p != r1.p;
@@
request_threaded_irq@p(irq, NULL, thread_fn,
(
-0
+IRQF_ONESHOT
|
-flags
+flags | IRQF_ONESHOT
)
, ...)

@depends on context@
position p != r1.p;
@@
*request_threaded_irq@p(...)

@match depends on report || org@
expression irq;
position p != r1.p;
@@
request_threaded_irq@p(irq, NULL, ...)

@script:python depends on org@
p << match.p;
@@
msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
coccilib.org.print_todo(p[0],msg)
@script:python depends on report@
p << match.p;
@@
msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
coccilib.report.print_report(p[0],msg)

0 comments on commit f1f4550

Please sign in to comment.