mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] irqf_oneshot.cocci: add check of devm_request_threaded_irq()
@ 2015-03-04  8:32 Valentin Rothberg
  2015-03-22 10:29 ` Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Valentin Rothberg @ 2015-03-04  8:32 UTC (permalink / raw)
  Cc: Valentin Rothberg, Peter Senna Tschudin, Julia Lawall,
	Gilles Muller, Nicolas Palix, Michal Marek, cocci, linux-kernel

Since commit 1c6c69525b40eb76de8adf039409722015927dc3 ("genirq: Reject
bogus threaded irq requests") threaded IRQs without a primary handler
need to be requested with IRQF_ONESHOT, otherwise the request will fail.

Until now, this coccinelle script only checked request_threaded_irq().
However, the counterpart devm function (see kernel/irq/devres.c) is also
affected by the missing flag which can be detected with this patch.

Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
 scripts/coccinelle/misc/irqf_oneshot.cocci | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
index 6cfde94..a24a754 100644
--- a/scripts/coccinelle/misc/irqf_oneshot.cocci
+++ b/scripts/coccinelle/misc/irqf_oneshot.cocci
@@ -12,11 +12,13 @@ virtual org
 virtual report
 
 @r1@
+expression dev;
 expression irq;
 expression thread_fn;
 expression flags;
 position p;
 @@
+(
 request_threaded_irq@p(irq, NULL, thread_fn,
 (
 flags | IRQF_ONESHOT
@@ -24,13 +26,24 @@ flags | IRQF_ONESHOT
 IRQF_ONESHOT
 )
 , ...)
+|
+devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
+(
+flags | IRQF_ONESHOT
+|
+IRQF_ONESHOT
+)
+, ...)
+)
 
 @depends on patch@
+expression dev;
 expression irq;
 expression thread_fn;
 expression flags;
 position p != r1.p;
 @@
+(
 request_threaded_irq@p(irq, NULL, thread_fn,
 (
 -0
@@ -40,6 +53,17 @@ request_threaded_irq@p(irq, NULL, thread_fn,
 +flags | IRQF_ONESHOT
 )
 , ...)
+|
+devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
+(
+-0
++IRQF_ONESHOT
+|
+-flags
++flags | IRQF_ONESHOT
+)
+, ...)
+)
 
 @depends on context@
 position p != r1.p;
-- 
1.9.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] irqf_oneshot.cocci: add check of devm_request_threaded_irq()
  2015-03-04  8:32 [PATCH] irqf_oneshot.cocci: add check of devm_request_threaded_irq() Valentin Rothberg
@ 2015-03-22 10:29 ` Julia Lawall
  2015-03-25 10:58   ` Michal Marek
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2015-03-22 10:29 UTC (permalink / raw)
  To: Valentin Rothberg
  Cc: Peter Senna Tschudin, Julia Lawall, Gilles Muller, Nicolas Palix,
	Michal Marek, cocci, linux-kernel

Acked-by: Julia Lawall <julia.lawall@lip6.fr>

Good fix, thanks!

On Wed, 4 Mar 2015, Valentin Rothberg wrote:

> Since commit 1c6c69525b40eb76de8adf039409722015927dc3 ("genirq: Reject
> bogus threaded irq requests") threaded IRQs without a primary handler
> need to be requested with IRQF_ONESHOT, otherwise the request will fail.
>
> Until now, this coccinelle script only checked request_threaded_irq().
> However, the counterpart devm function (see kernel/irq/devres.c) is also
> affected by the missing flag which can be detected with this patch.
>
> Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
> ---
>  scripts/coccinelle/misc/irqf_oneshot.cocci | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
> index 6cfde94..a24a754 100644
> --- a/scripts/coccinelle/misc/irqf_oneshot.cocci
> +++ b/scripts/coccinelle/misc/irqf_oneshot.cocci
> @@ -12,11 +12,13 @@ virtual org
>  virtual report
>
>  @r1@
> +expression dev;
>  expression irq;
>  expression thread_fn;
>  expression flags;
>  position p;
>  @@
> +(
>  request_threaded_irq@p(irq, NULL, thread_fn,
>  (
>  flags | IRQF_ONESHOT
> @@ -24,13 +26,24 @@ flags | IRQF_ONESHOT
>  IRQF_ONESHOT
>  )
>  , ...)
> +|
> +devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
> +(
> +flags | IRQF_ONESHOT
> +|
> +IRQF_ONESHOT
> +)
> +, ...)
> +)
>
>  @depends on patch@
> +expression dev;
>  expression irq;
>  expression thread_fn;
>  expression flags;
>  position p != r1.p;
>  @@
> +(
>  request_threaded_irq@p(irq, NULL, thread_fn,
>  (
>  -0
> @@ -40,6 +53,17 @@ request_threaded_irq@p(irq, NULL, thread_fn,
>  +flags | IRQF_ONESHOT
>  )
>  , ...)
> +|
> +devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
> +(
> +-0
> ++IRQF_ONESHOT
> +|
> +-flags
> ++flags | IRQF_ONESHOT
> +)
> +, ...)
> +)
>
>  @depends on context@
>  position p != r1.p;
> --
> 1.9.1
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] irqf_oneshot.cocci: add check of devm_request_threaded_irq()
  2015-03-22 10:29 ` Julia Lawall
@ 2015-03-25 10:58   ` Michal Marek
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Marek @ 2015-03-25 10:58 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Valentin Rothberg, Peter Senna Tschudin, Gilles Muller,
	Nicolas Palix, cocci, linux-kernel

On Sun, Mar 22, 2015 at 11:29:13AM +0100, Julia Lawall wrote:
> Acked-by: Julia Lawall <julia.lawall@lip6.fr>
> 
> Good fix, thanks!

Applied to kbuild.git#misc.

Michal

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-25 10:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04  8:32 [PATCH] irqf_oneshot.cocci: add check of devm_request_threaded_irq() Valentin Rothberg
2015-03-22 10:29 ` Julia Lawall
2015-03-25 10:58   ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®