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: Moderate
9// Comments:
10// Options: --no-includes
11
12virtual patch
13virtual context
14virtual org
15virtual report
16
17@r1@
18expression dev, irq, thread_fn;
19position p;
20@@
21(
22request_threaded_irq@p(irq, NULL, thread_fn,
23(
24IRQF_ONESHOT | ...
25|
26IRQF_ONESHOT
27)
28, ...)
29|
30devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
31(
32IRQF_ONESHOT | ...
33|
34IRQF_ONESHOT
35)
36, ...)
37)
38
39@r2@
40expression dev, irq, thread_fn, flags, e;
41position p != r1.p;
42@@
43(
44flags = IRQF_ONESHOT | ...
45|
46flags |= IRQF_ONESHOT | ...
47)
48... when != flags = e
49(
50request_threaded_irq@p(irq, NULL, thread_fn, flags, ...);
51|
52devm_request_threaded_irq@p(dev, irq, NULL, thread_fn, flags, ...);
53)
54
55@depends on patch@
56expression dev, irq, thread_fn, flags;
57position p != {r1.p,r2.p};
58@@
59(
60request_threaded_irq@p(irq, NULL, thread_fn,
61(
62-0
63+IRQF_ONESHOT
64|
65-flags
66+flags | IRQF_ONESHOT
67)
68, ...)
69|
70devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
71(
72-0
73+IRQF_ONESHOT
74|
75-flags
76+flags | IRQF_ONESHOT
77)
78, ...)
79)
80
81@depends on context@
82expression dev, irq;
83position p != {r1.p,r2.p};
84@@
85(
86*request_threaded_irq@p(irq, NULL, ...)
87|
88*devm_request_threaded_irq@p(dev, irq, NULL, ...)
89)
90
91
92@match depends on report || org@
93expression dev, irq;
94position p != {r1.p,r2.p};
95@@
96(
97request_threaded_irq@p(irq, NULL, ...)
98|
99devm_request_threaded_irq@p(dev, irq, NULL, ...)
100)
101
102@script:python depends on org@
103p << match.p;
104@@
105msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
106coccilib.org.print_todo(p[0],msg)
107
108@script:python depends on report@
109p << match.p;
110@@
111msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
112coccilib.report.print_report(p[0],msg)
113