diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-07-01 07:17:07 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2012-07-13 09:57:31 -0400 |
commit | f1f455047940e59b3aea102e17ae4c0f9286aa76 (patch) | |
tree | ccb569ee413f5e0d0c010d7c501984d47402c0cd | |
parent | 5f011d715984543f47ca5bf1967857a9f36f7264 (diff) |
scripts/coccinelle: Find threaded IRQs requests which are missing IRQF_ONESHOT
Since commit 1c6c69525b ("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 <lars@metafoo.de>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
-rw-r--r-- | scripts/coccinelle/misc/irqf_oneshot.cocci | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci new file mode 100644 index 000000000000..6cfde94be0ef --- /dev/null +++ b/scripts/coccinelle/misc/irqf_oneshot.cocci | |||
@@ -0,0 +1,65 @@ | |||
1 | /// Make sure threaded IRQs without a primary handler are always request with | ||
2 | /// IRQF_ONESHOT | ||
3 | /// | ||
4 | // | ||
5 | // Confidence: Good | ||
6 | // Comments: | ||
7 | // Options: --no-includes | ||
8 | |||
9 | virtual patch | ||
10 | virtual context | ||
11 | virtual org | ||
12 | virtual report | ||
13 | |||
14 | @r1@ | ||
15 | expression irq; | ||
16 | expression thread_fn; | ||
17 | expression flags; | ||
18 | position p; | ||
19 | @@ | ||
20 | request_threaded_irq@p(irq, NULL, thread_fn, | ||
21 | ( | ||
22 | flags | IRQF_ONESHOT | ||
23 | | | ||
24 | IRQF_ONESHOT | ||
25 | ) | ||
26 | , ...) | ||
27 | |||
28 | @depends on patch@ | ||
29 | expression irq; | ||
30 | expression thread_fn; | ||
31 | expression flags; | ||
32 | position p != r1.p; | ||
33 | @@ | ||
34 | request_threaded_irq@p(irq, NULL, thread_fn, | ||
35 | ( | ||
36 | -0 | ||
37 | +IRQF_ONESHOT | ||
38 | | | ||
39 | -flags | ||
40 | +flags | IRQF_ONESHOT | ||
41 | ) | ||
42 | , ...) | ||
43 | |||
44 | @depends on context@ | ||
45 | position p != r1.p; | ||
46 | @@ | ||
47 | *request_threaded_irq@p(...) | ||
48 | |||
49 | @match depends on report || org@ | ||
50 | expression irq; | ||
51 | position p != r1.p; | ||
52 | @@ | ||
53 | request_threaded_irq@p(irq, NULL, ...) | ||
54 | |||
55 | @script:python depends on org@ | ||
56 | p << match.p; | ||
57 | @@ | ||
58 | msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT" | ||
59 | coccilib.org.print_todo(p[0],msg) | ||
60 | |||
61 | @script:python depends on report@ | ||
62 | p << match.p; | ||
63 | @@ | ||
64 | msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT" | ||
65 | coccilib.report.print_report(p[0],msg) | ||