irqf_oneshot.cocci 1.5 KB

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