summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorVaishali Thakkar <vaishali.thakkar@oracle.com>2016-11-23 14:16:39 +0530
committerHuang, Tao <huangtao@rock-chips.com>2017-07-12 21:17:10 +0800
commitfd779ebca75af56883af58c1cc5439b68587f9f9 (patch)
tree98c95c5b6c39ffd886cb91d4f846cb83087c8dd8 /scripts
parentd274d003e309cc7c948356c53a030a9966931a94 (diff)
UPSTREAM: Coccinelle: misc: Improve the matching of rules
Currently because of the left associativity of the operators, pattern IRQF_ONESHOT | flags does not match with the pattern when we have more than one flag after the disjunction. This eventually results in giving false positives by the script. This patch eliminates these FPs by improving the rule. Change-Id: I1043d1e6fca848997982305cd8fb3ac2706e7f1f Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com> Signed-off-by: Michal Marek <mmarek@suse.com> Signed-off-by: Huang, Tao <huangtao@rock-chips.com> (cherry picked from commit dca24c4544d96989f521b5aa49fd44ae0ae5a5b6)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/coccinelle/misc/irqf_oneshot.cocci36
1 files changed, 23 insertions, 13 deletions
diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
index b421150a2eff..cbe4ba8f293a 100644
--- a/scripts/coccinelle/misc/irqf_oneshot.cocci
+++ b/scripts/coccinelle/misc/irqf_oneshot.cocci
@@ -15,16 +15,13 @@ virtual org
virtual report
@r1@
-expression dev;
-expression irq;
-expression thread_fn;
-expression flags;
+expression dev, irq, thread_fn;
position p;
@@
(
request_threaded_irq@p(irq, NULL, thread_fn,
(
-flags | IRQF_ONESHOT
+IRQF_ONESHOT | ...
|
IRQF_ONESHOT
)
@@ -32,21 +29,34 @@ IRQF_ONESHOT
|
devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
(
-flags | IRQF_ONESHOT
+IRQF_ONESHOT | ...
|
IRQF_ONESHOT
)
, ...)
)
-@depends on patch@
-expression dev;
-expression irq;
-expression thread_fn;
-expression flags;
+@r2@
+expression dev, irq, thread_fn, flags, e;
position p != r1.p;
@@
(
+flags = IRQF_ONESHOT | ...
+|
+flags |= IRQF_ONESHOT | ...
+)
+... when != flags = e
+(
+request_threaded_irq@p(irq, NULL, thread_fn, flags, ...);
+|
+devm_request_threaded_irq@p(dev, irq, NULL, thread_fn, flags, ...);
+)
+
+@depends on patch@
+expression dev, irq, thread_fn, flags;
+position p != {r1.p,r2.p};
+@@
+(
request_threaded_irq@p(irq, NULL, thread_fn,
(
-0
@@ -69,13 +79,13 @@ devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
)
@depends on context@
-position p != r1.p;
+position p != {r1.p,r2.p};
@@
*request_threaded_irq@p(...)
@match depends on report || org@
expression irq;
-position p != r1.p;
+position p != {r1.p,r2.p};
@@
request_threaded_irq@p(irq, NULL, ...)