irqf_oneshot.cocci 1.3 KB

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