]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - scripts/coccinelle/misc/irqf_oneshot.cocci
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-bionic-kernel.git] / scripts / coccinelle / misc / irqf_oneshot.cocci
CommitLineData
b2441318 1// SPDX-License-Identifier: GPL-2.0
9473a62f
FE
2/// Since commit 1c6c69525b40 ("genirq: Reject bogus threaded irq requests")
3/// threaded IRQs without a primary handler need to be requested with
4/// IRQF_ONESHOT, otherwise the request will fail.
5///
6/// So pass the IRQF_ONESHOT flag in this case.
f1f45504
LPC
7///
8//
d1e774f4 9// Confidence: Moderate
f1f45504
LPC
10// Comments:
11// Options: --no-includes
12
13virtual patch
14virtual context
15virtual org
16virtual report
17
18@r1@
dca24c45 19expression dev, irq, thread_fn;
f1f45504
LPC
20position p;
21@@
2c2b913d 22(
f1f45504
LPC
23request_threaded_irq@p(irq, NULL, thread_fn,
24(
dca24c45 25IRQF_ONESHOT | ...
f1f45504
LPC
26|
27IRQF_ONESHOT
28)
29, ...)
2c2b913d
VR
30|
31devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
32(
dca24c45 33IRQF_ONESHOT | ...
2c2b913d
VR
34|
35IRQF_ONESHOT
36)
37, ...)
38)
f1f45504 39
dca24c45
VT
40@r2@
41expression dev, irq, thread_fn, flags, e;
f1f45504
LPC
42position p != r1.p;
43@@
2c2b913d 44(
dca24c45
VT
45flags = IRQF_ONESHOT | ...
46|
47flags |= IRQF_ONESHOT | ...
48)
49... when != flags = e
50(
51request_threaded_irq@p(irq, NULL, thread_fn, flags, ...);
52|
53devm_request_threaded_irq@p(dev, irq, NULL, thread_fn, flags, ...);
54)
55
56@depends on patch@
57expression dev, irq, thread_fn, flags;
58position p != {r1.p,r2.p};
59@@
60(
f1f45504
LPC
61request_threaded_irq@p(irq, NULL, thread_fn,
62(
63-0
64+IRQF_ONESHOT
65|
66-flags
67+flags | IRQF_ONESHOT
68)
69, ...)
2c2b913d
VR
70|
71devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
72(
73-0
74+IRQF_ONESHOT
75|
76-flags
77+flags | IRQF_ONESHOT
78)
79, ...)
80)
f1f45504
LPC
81
82@depends on context@
d1e774f4 83expression dev, irq;
dca24c45 84position p != {r1.p,r2.p};
f1f45504 85@@
d1e774f4 86(
35b303ae 87*request_threaded_irq@p(irq, NULL, ...)
d1e774f4
VT
88|
89*devm_request_threaded_irq@p(dev, irq, NULL, ...)
90)
91
f1f45504
LPC
92
93@match depends on report || org@
d1e774f4 94expression dev, irq;
dca24c45 95position p != {r1.p,r2.p};
f1f45504 96@@
d1e774f4 97(
f1f45504 98request_threaded_irq@p(irq, NULL, ...)
d1e774f4
VT
99|
100devm_request_threaded_irq@p(dev, irq, NULL, ...)
101)
f1f45504
LPC
102
103@script:python depends on org@
104p << match.p;
105@@
106msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
107coccilib.org.print_todo(p[0],msg)
108
109@script:python depends on report@
110p << match.p;
111@@
112msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
113coccilib.report.print_report(p[0],msg)