irqf_oneshot.cocci 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. virtual patch
  9. virtual context
  10. virtual org
  11. virtual report
  12. @r1@
  13. expression irq;
  14. expression thread_fn;
  15. expression flags;
  16. position p;
  17. @@
  18. request_threaded_irq@p(irq, NULL, thread_fn,
  19. (
  20. flags | IRQF_ONESHOT
  21. |
  22. IRQF_ONESHOT
  23. )
  24. , ...)
  25. @depends on patch@
  26. expression irq;
  27. expression thread_fn;
  28. expression flags;
  29. position p != r1.p;
  30. @@
  31. request_threaded_irq@p(irq, NULL, thread_fn,
  32. (
  33. -0
  34. +IRQF_ONESHOT
  35. |
  36. -flags
  37. +flags | IRQF_ONESHOT
  38. )
  39. , ...)
  40. @depends on context@
  41. position p != r1.p;
  42. @@
  43. *request_threaded_irq@p(...)
  44. @match depends on report || org@
  45. expression irq;
  46. position p != r1.p;
  47. @@
  48. request_threaded_irq@p(irq, NULL, ...)
  49. @script:python depends on org@
  50. p << match.p;
  51. @@
  52. msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
  53. coccilib.org.print_todo(p[0],msg)
  54. @script:python depends on report@
  55. p << match.p;
  56. @@
  57. msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
  58. coccilib.report.print_report(p[0],msg)