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