These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / scripts / coccinelle / misc / irqf_oneshot.cocci
1 /// Since commit 1c6c69525b40 ("genirq: Reject bogus threaded irq requests")
2 /// threaded IRQs without a primary handler need to be requested with
3 /// IRQF_ONESHOT, otherwise the request will fail.
4 ///
5 /// So pass the IRQF_ONESHOT flag in this case.
6 ///
7 //
8 // Confidence: Good
9 // Comments:
10 // Options: --no-includes
11
12 virtual patch
13 virtual context
14 virtual org
15 virtual report
16
17 @r1@
18 expression dev;
19 expression irq;
20 expression thread_fn;
21 expression flags;
22 position p;
23 @@
24 (
25 request_threaded_irq@p(irq, NULL, thread_fn,
26 (
27 flags | IRQF_ONESHOT
28 |
29 IRQF_ONESHOT
30 )
31 , ...)
32 |
33 devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
34 (
35 flags | IRQF_ONESHOT
36 |
37 IRQF_ONESHOT
38 )
39 , ...)
40 )
41
42 @depends on patch@
43 expression dev;
44 expression irq;
45 expression thread_fn;
46 expression flags;
47 position p != r1.p;
48 @@
49 (
50 request_threaded_irq@p(irq, NULL, thread_fn,
51 (
52 -0
53 +IRQF_ONESHOT
54 |
55 -flags
56 +flags | IRQF_ONESHOT
57 )
58 , ...)
59 |
60 devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
61 (
62 -0
63 +IRQF_ONESHOT
64 |
65 -flags
66 +flags | IRQF_ONESHOT
67 )
68 , ...)
69 )
70
71 @depends on context@
72 position p != r1.p;
73 @@
74 *request_threaded_irq@p(...)
75
76 @match depends on report || org@
77 expression irq;
78 position p != r1.p;
79 @@
80 request_threaded_irq@p(irq, NULL, ...)
81
82 @script:python depends on org@
83 p << match.p;
84 @@
85 msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
86 coccilib.org.print_todo(p[0],msg)
87
88 @script:python depends on report@
89 p << match.p;
90 @@
91 msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
92 coccilib.report.print_report(p[0],msg)