* [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results
@ 2016-10-16 17:06 Vaishali Thakkar
2016-10-16 17:07 ` [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes Vaishali Thakkar
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Vaishali Thakkar @ 2016-10-16 17:06 UTC (permalink / raw)
To: mmarek
Cc: Julia.Lawall, Gilles.Muller, nicolas.palix, cocci, linux-kernel,
lars, Vaishali Thakkar
Few changes to improve the results given by the irqf_oneshot.cocci:
- Change in the matching rules to eliminate false postives in the
patch mode
- Change in the context mode to eliminate false postives in the
context mode
- Support for the missing devm_request_threaded_irq in context, report
and org mode
Vaishali Thakkar (3):
Coccinelle: misc: Improve the matching of rules
Coccinelle: misc: Improve the result given by context mode
Coccinelle: misc: Add support for devm variant in all modes
scripts/coccinelle/misc/irqf_oneshot.cocci | 42 ++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 8 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes
2016-10-16 17:06 [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results Vaishali Thakkar
@ 2016-10-16 17:07 ` Vaishali Thakkar
2016-10-18 17:01 ` Vaishali Thakkar
2016-10-18 17:05 ` Vaishali Thakkar
2016-10-16 17:09 ` [PATCH v2 1/3] Coccinelle: misc: Improve the matching of rules Vaishali Thakkar
` (2 subsequent siblings)
3 siblings, 2 replies; 13+ messages in thread
From: Vaishali Thakkar @ 2016-10-16 17:07 UTC (permalink / raw)
To: mmarek
Cc: Julia.Lawall, Gilles.Muller, nicolas.palix, cocci, linux-kernel,
lars, Vaishali Thakkar
Add missing support for the devm_request_threaded_irq in
the rules of context, report and org modes.
Misc:
----
To be consistent with other scripts, change confidence level
of the script to 'Moderate'.
Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
---
scripts/coccinelle/misc/irqf_oneshot.cocci | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
index 03b748d..f6c93fd 100644
--- a/scripts/coccinelle/misc/irqf_oneshot.cocci
+++ b/scripts/coccinelle/misc/irqf_oneshot.cocci
@@ -5,7 +5,7 @@
/// So pass the IRQF_ONESHOT flag in this case.
///
//
-// Confidence: Good
+// Confidence: Moderate
// Comments:
// Options: --no-includes
@@ -89,13 +89,21 @@ devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
@depends on context@
position p != {r1.p,r2.p};
@@
+(
*request_threaded_irq@p(irq, NULL, ...)
+|
+*devm_request_threaded_irq@p(dev, irq, NULL, ...)
+)
@match depends on report || org@
expression irq;
position p != {r1.p,r2.p};
@@
+(
request_threaded_irq@p(irq, NULL, ...)
+|
+devm_request_threaded_irq@p(dev, irq, NULL, ...)
+)
@script:python depends on org@
p << match.p;
--
2.1.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 1/3] Coccinelle: misc: Improve the matching of rules
2016-10-16 17:06 [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results Vaishali Thakkar
2016-10-16 17:07 ` [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes Vaishali Thakkar
@ 2016-10-16 17:09 ` Vaishali Thakkar
2016-10-16 17:10 ` [PATCH v2 2/3] Coccinelle: misc: Improve the result given by context mode Vaishali Thakkar
2016-10-18 16:34 ` [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results Julia Lawall
3 siblings, 0 replies; 13+ messages in thread
From: Vaishali Thakkar @ 2016-10-16 17:09 UTC (permalink / raw)
To: mmarek
Cc: Julia.Lawall, Gilles.Muller, nicolas.palix, cocci, linux-kernel,
lars, Vaishali Thakkar
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.
Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
---
scripts/coccinelle/misc/irqf_oneshot.cocci | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
index b421150..b538d08 100644
--- a/scripts/coccinelle/misc/irqf_oneshot.cocci
+++ b/scripts/coccinelle/misc/irqf_oneshot.cocci
@@ -18,13 +18,12 @@ virtual report
expression dev;
expression irq;
expression thread_fn;
-expression flags;
position p;
@@
(
request_threaded_irq@p(irq, NULL, thread_fn,
(
-flags | IRQF_ONESHOT
+IRQF_ONESHOT | ...
|
IRQF_ONESHOT
)
@@ -32,20 +31,39 @@ IRQF_ONESHOT
|
devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
(
-flags | IRQF_ONESHOT
+IRQF_ONESHOT | ...
|
IRQF_ONESHOT
)
, ...)
)
-@depends on patch@
+@r2@
expression dev;
expression irq;
expression thread_fn;
expression flags;
+expression ret;
position p != r1.p;
@@
+flags = IRQF_ONESHOT | ...;
+(
+ret = request_threaded_irq@p(irq, NULL, thread_fn, flags, ...);
+|
+ret = devm_request_threaded_irq@p(dev, irq, NULL, thread_fn, flags, ...);
+|
+return request_threaded_irq@p(irq, NULL, thread_fn, flags, ...);
+|
+return devm_request_threaded_irq@p(dev, irq, NULL, thread_fn, flags, ...);
+)
+
+@depends on patch@
+expression dev;
+expression irq;
+expression thread_fn;
+expression flags;
+position p != {r1.p,r2.p};
+@@
(
request_threaded_irq@p(irq, NULL, thread_fn,
(
@@ -69,13 +87,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, ...)
--
2.1.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 2/3] Coccinelle: misc: Improve the result given by context mode
2016-10-16 17:06 [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results Vaishali Thakkar
2016-10-16 17:07 ` [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes Vaishali Thakkar
2016-10-16 17:09 ` [PATCH v2 1/3] Coccinelle: misc: Improve the matching of rules Vaishali Thakkar
@ 2016-10-16 17:10 ` Vaishali Thakkar
2016-10-18 16:34 ` [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results Julia Lawall
3 siblings, 0 replies; 13+ messages in thread
From: Vaishali Thakkar @ 2016-10-16 17:10 UTC (permalink / raw)
To: mmarek
Cc: Julia.Lawall, Gilles.Muller, nicolas.palix, cocci, linux-kernel,
lars, Vaishali Thakkar
To eliminate false positives given by the context mode, add
necessary arguments for the function request_threaded_irq.
Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
---
scripts/coccinelle/misc/irqf_oneshot.cocci | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
index b538d08..03b748d 100644
--- a/scripts/coccinelle/misc/irqf_oneshot.cocci
+++ b/scripts/coccinelle/misc/irqf_oneshot.cocci
@@ -89,7 +89,7 @@ devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
@depends on context@
position p != {r1.p,r2.p};
@@
-*request_threaded_irq@p(...)
+*request_threaded_irq@p(irq, NULL, ...)
@match depends on report || org@
expression irq;
--
2.1.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results
2016-10-16 17:06 [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results Vaishali Thakkar
` (2 preceding siblings ...)
2016-10-16 17:10 ` [PATCH v2 2/3] Coccinelle: misc: Improve the result given by context mode Vaishali Thakkar
@ 2016-10-18 16:34 ` Julia Lawall
2016-10-18 16:53 ` Vaishali Thakkar
3 siblings, 1 reply; 13+ messages in thread
From: Julia Lawall @ 2016-10-18 16:34 UTC (permalink / raw)
To: Vaishali Thakkar
Cc: mmarek, Julia.Lawall, Gilles.Muller, nicolas.palix, cocci,
linux-kernel, lars
I get the following in patch mode that I don't get in context mode:
diff -u -p a/drivers/power/supply/tps65090-charger.c
b/drivers/power/supply/tps\
65090-charger.c
--- a/drivers/power/supply/tps65090-charger.c
+++ b/drivers/power/supply/tps65090-charger.c
@@ -311,7 +311,8 @@ static int tps65090_charger_probe(struct
if (irq != -ENXIO) {
ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
- tps65090_charger_isr, 0, "tps65090-charger", cdata);
+ tps65090_charger_isr, IRQF_ONESHOT,
+ "tps65090-charger", cdata);
if (ret) {
dev_err(cdata->dev,
"Unable to register irq %d err %d\n", irq,
julia
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results
2016-10-18 16:34 ` [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results Julia Lawall
@ 2016-10-18 16:53 ` Vaishali Thakkar
2016-10-18 17:01 ` Julia Lawall
0 siblings, 1 reply; 13+ messages in thread
From: Vaishali Thakkar @ 2016-10-18 16:53 UTC (permalink / raw)
To: Julia Lawall
Cc: mmarek, Gilles.Muller, nicolas.palix, cocci, linux-kernel, lars
On Tuesday 18 October 2016 10:04 PM, Julia Lawall wrote:
> I get the following in patch mode that I don't get in context mode:
Hi,
Are you getting same number of devm cases in your report for the context
and patch mode? [except this case]
> diff -u -p a/drivers/power/supply/tps65090-charger.c
> b/drivers/power/supply/tps\
> 65090-charger.c
> --- a/drivers/power/supply/tps65090-charger.c
> +++ b/drivers/power/supply/tps65090-charger.c
> @@ -311,7 +311,8 @@ static int tps65090_charger_probe(struct
>
> if (irq != -ENXIO) {
> ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
> - tps65090_charger_isr, 0, "tps65090-charger", cdata);
> + tps65090_charger_isr, IRQF_ONESHOT,
> + "tps65090-charger", cdata);
> if (ret) {
> dev_err(cdata->dev,
> "Unable to register irq %d err %d\n", irq,
>
>
> julia
>
--
Vaishali
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results
2016-10-18 16:53 ` Vaishali Thakkar
@ 2016-10-18 17:01 ` Julia Lawall
2016-10-18 17:11 ` Vaishali Thakkar
0 siblings, 1 reply; 13+ messages in thread
From: Julia Lawall @ 2016-10-18 17:01 UTC (permalink / raw)
To: Vaishali Thakkar
Cc: Julia Lawall, mmarek, Gilles.Muller, nicolas.palix, cocci,
linux-kernel, lars
On Tue, 18 Oct 2016, Vaishali Thakkar wrote:
>
>
> On Tuesday 18 October 2016 10:04 PM, Julia Lawall wrote:
> > I get the following in patch mode that I don't get in context mode:
>
> Hi,
>
> Are you getting same number of devm cases in your report for the context
> and patch mode? [except this case]
The only devm case I get in context mode is:
diff -u -p /var/linuxes/linux-next/drivers/acpi/evged.c
/tmp/nothing/drivers/ac\
pi/evged.c
--- /var/linuxes/linux-next/drivers/acpi/evged.c
+++ /tmp/nothing/drivers/acpi/evged.c
@@ -116,8 +116,6 @@ static acpi_status acpi_ged_request_inte
if (r.flags & IORESOURCE_IRQ_SHAREABLE)
irqflags |= IRQF_SHARED;
- if (devm_request_threaded_irq(dev, irq, NULL, acpi_ged_irq_handler,
- irqflags, "ACPI:Ged", event)) {
dev_err(dev, "failed to setup event handler for irq %u\n", irq);
return AE_ERROR;
}
This one has the property that the first argument is an identifier. The
other cases seem to have a & expression. There are around 20 of them.
julia
>
>
> > diff -u -p a/drivers/power/supply/tps65090-charger.c
> > b/drivers/power/supply/tps\
> > 65090-charger.c
> > --- a/drivers/power/supply/tps65090-charger.c
> > +++ b/drivers/power/supply/tps65090-charger.c
> > @@ -311,7 +311,8 @@ static int tps65090_charger_probe(struct
> >
> > if (irq != -ENXIO) {
> > ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
> > - tps65090_charger_isr, 0, "tps65090-charger", cdata);
> > + tps65090_charger_isr, IRQF_ONESHOT,
> > + "tps65090-charger", cdata);
> > if (ret) {
> > dev_err(cdata->dev,
> > "Unable to register irq %d err %d\n", irq,
> >
> >
> > julia
> >
>
> --
> Vaishali
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes
2016-10-16 17:07 ` [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes Vaishali Thakkar
@ 2016-10-18 17:01 ` Vaishali Thakkar
2016-10-18 17:05 ` Vaishali Thakkar
1 sibling, 0 replies; 13+ messages in thread
From: Vaishali Thakkar @ 2016-10-18 17:01 UTC (permalink / raw)
To: mmarek
Cc: Julia.Lawall, Gilles.Muller, nicolas.palix, cocci, linux-kernel,
lars
On Sunday 16 October 2016 10:37 PM, Vaishali Thakkar wrote:
> Add missing support for the devm_request_threaded_irq in
> the rules of context, report and org modes.
>
> Misc:
> ----
> To be consistent with other scripts, change confidence level
> of the script to 'Moderate'.
>
> Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
> ---
> scripts/coccinelle/misc/irqf_oneshot.cocci | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
> index 03b748d..f6c93fd 100644
> --- a/scripts/coccinelle/misc/irqf_oneshot.cocci
> +++ b/scripts/coccinelle/misc/irqf_oneshot.cocci
> @@ -5,7 +5,7 @@
> /// So pass the IRQF_ONESHOT flag in this case.
> ///
> //
> -// Confidence: Good
> +// Confidence: Moderate
> // Comments:
> // Options: --no-includes
>
> @@ -89,13 +89,21 @@ devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
> @depends on context@
> position p != {r1.p,r2.p};
> @@
> +(
> *request_threaded_irq@p(irq, NULL, ...)
> +|
> +*devm_request_threaded_irq@p(dev, irq, NULL, ...)
> +)
>
> @match depends on report || org@
> expression irq;
> position p != {r1.p,r2.p};
> @@
> +(
> request_threaded_irq@p(irq, NULL, ...)
> +|
> +devm_request_threaded_irq@p(dev, irq, NULL, ...)
> +)
Oh, my bad here. :(
Forgot the initialization of meta variables for the
arguments.
But I am wondering why coccicheck didn't fail here.
Isn't it suppose to give parsing errors? Or it doesn't
do that?
In any case, I am sorry for this. I'll send the revised
version of the patches.
> @script:python depends on org@
> p << match.p;
>
--
Vaishali
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes
2016-10-16 17:07 ` [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes Vaishali Thakkar
2016-10-18 17:01 ` Vaishali Thakkar
@ 2016-10-18 17:05 ` Vaishali Thakkar
2016-10-18 17:10 ` Julia Lawall
1 sibling, 1 reply; 13+ messages in thread
From: Vaishali Thakkar @ 2016-10-18 17:05 UTC (permalink / raw)
To: mmarek
Cc: Julia.Lawall, Gilles.Muller, nicolas.palix, cocci, linux-kernel,
lars
On Sunday 16 October 2016 10:37 PM, Vaishali Thakkar wrote:
> Add missing support for the devm_request_threaded_irq in
> the rules of context, report and org modes.
>
> Misc:
> ----
> To be consistent with other scripts, change confidence level
> of the script to 'Moderate'.
>
> Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
> ---
> scripts/coccinelle/misc/irqf_oneshot.cocci | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
> index 03b748d..f6c93fd 100644
> --- a/scripts/coccinelle/misc/irqf_oneshot.cocci
> +++ b/scripts/coccinelle/misc/irqf_oneshot.cocci
> @@ -5,7 +5,7 @@
> /// So pass the IRQF_ONESHOT flag in this case.
> ///
> //
> -// Confidence: Good
> +// Confidence: Moderate
> // Comments:
> // Options: --no-includes
>
> @@ -89,13 +89,21 @@ devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
> @depends on context@
> position p != {r1.p,r2.p};
> @@
> +(
> *request_threaded_irq@p(irq, NULL, ...)
> +|
> +*devm_request_threaded_irq@p(dev, irq, NULL, ...)
> +)
>
> @match depends on report || org@
> expression irq;
> position p != {r1.p,r2.p};
> @@
> +(
> request_threaded_irq@p(irq, NULL, ...)
> +|
> +devm_request_threaded_irq@p(dev, irq, NULL, ...)
> +)
Oh, my bad here. :(
Forgot the initialization of meta variables for the
arguments.
But I am wondering why coccicheck didn't fail here.
Isn't it suppose to give parsing errors? Or it doesn't
do that?
In any case, I am sorry for this. I'll send the revised
version of the patches.
> @script:python depends on org@
> p << match.p;
>
--
Vaishali
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes
2016-10-18 17:05 ` Vaishali Thakkar
@ 2016-10-18 17:10 ` Julia Lawall
2016-10-18 17:35 ` Vaishali Thakkar
0 siblings, 1 reply; 13+ messages in thread
From: Julia Lawall @ 2016-10-18 17:10 UTC (permalink / raw)
To: Vaishali Thakkar
Cc: mmarek, Julia.Lawall, Gilles.Muller, nicolas.palix, cocci,
linux-kernel, lars
On Tue, 18 Oct 2016, Vaishali Thakkar wrote:
>
>
> On Sunday 16 October 2016 10:37 PM, Vaishali Thakkar wrote:
> > Add missing support for the devm_request_threaded_irq in
> > the rules of context, report and org modes.
> >
> > Misc:
> > ----
> > To be consistent with other scripts, change confidence level
> > of the script to 'Moderate'.
> >
> > Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
> > ---
> > scripts/coccinelle/misc/irqf_oneshot.cocci | 10 +++++++++-
> > 1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
> > index 03b748d..f6c93fd 100644
> > --- a/scripts/coccinelle/misc/irqf_oneshot.cocci
> > +++ b/scripts/coccinelle/misc/irqf_oneshot.cocci
> > @@ -5,7 +5,7 @@
> > /// So pass the IRQF_ONESHOT flag in this case.
> > ///
> > //
> > -// Confidence: Good
> > +// Confidence: Moderate
> > // Comments:
> > // Options: --no-includes
> >
> > @@ -89,13 +89,21 @@ devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
> > @depends on context@
> > position p != {r1.p,r2.p};
> > @@
> > +(
> > *request_threaded_irq@p(irq, NULL, ...)
> > +|
> > +*devm_request_threaded_irq@p(dev, irq, NULL, ...)
> > +)
> >
> > @match depends on report || org@
> > expression irq;
> > position p != {r1.p,r2.p};
> > @@
> > +(
> > request_threaded_irq@p(irq, NULL, ...)
> > +|
> > +devm_request_threaded_irq@p(dev, irq, NULL, ...)
> > +)
>
> Oh, my bad here. :(
>
> Forgot the initialization of meta variables for the
> arguments.
>
> But I am wondering why coccicheck didn't fail here.
> Isn't it suppose to give parsing errors? Or it doesn't
> do that?
It just give a warning, which I guess make coccicheck hides. It is
allowed to require an argument to be named dev, although it is nicer if
one declares it with symbol in that case.
julia
>
> In any case, I am sorry for this. I'll send the revised
> version of the patches.
>
> > @script:python depends on org@
> > p << match.p;
> >
>
> --
> Vaishali
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results
2016-10-18 17:01 ` Julia Lawall
@ 2016-10-18 17:11 ` Vaishali Thakkar
2016-10-18 18:05 ` Julia Lawall
0 siblings, 1 reply; 13+ messages in thread
From: Vaishali Thakkar @ 2016-10-18 17:11 UTC (permalink / raw)
To: Julia Lawall
Cc: mmarek, Gilles.Muller, nicolas.palix, cocci, linux-kernel, lars
On Tuesday 18 October 2016 10:31 PM, Julia Lawall wrote:
>
>
> On Tue, 18 Oct 2016, Vaishali Thakkar wrote:
>
>>
>>
>> On Tuesday 18 October 2016 10:04 PM, Julia Lawall wrote:
>>> I get the following in patch mode that I don't get in context mode:
>>
>> Hi,
>>
>> Are you getting same number of devm cases in your report for the context
>> and patch mode? [except this case]
>
> The only devm case I get in context mode is:
>
> diff -u -p /var/linuxes/linux-next/drivers/acpi/evged.c
> /tmp/nothing/drivers/ac\
> pi/evged.c
> --- /var/linuxes/linux-next/drivers/acpi/evged.c
> +++ /tmp/nothing/drivers/acpi/evged.c
> @@ -116,8 +116,6 @@ static acpi_status acpi_ged_request_inte
> if (r.flags & IORESOURCE_IRQ_SHAREABLE)
> irqflags |= IRQF_SHARED;
>
> - if (devm_request_threaded_irq(dev, irq, NULL, acpi_ged_irq_handler,
> - irqflags, "ACPI:Ged", event)) {
> dev_err(dev, "failed to setup event handler for irq %u\n", irq);
> return AE_ERROR;
> }
>
> This one has the property that the first argument is an identifier. The
> other cases seem to have a & expression. There are around 20 of them.
Although I got the issue with the patches, I am wondering why even context mode
gave result for the identifiers even though they are not initialized? Does that
mean it automatically assumes the type of meta variables even though they are not
initialized? I think spatch gives warnings for such cases. But I am not sure about
the coccicheck.
> julia
>
>
>
>>
>>
>>> diff -u -p a/drivers/power/supply/tps65090-charger.c
>>> b/drivers/power/supply/tps\
>>> 65090-charger.c
>>> --- a/drivers/power/supply/tps65090-charger.c
>>> +++ b/drivers/power/supply/tps65090-charger.c
>>> @@ -311,7 +311,8 @@ static int tps65090_charger_probe(struct
>>>
>>> if (irq != -ENXIO) {
>>> ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
>>> - tps65090_charger_isr, 0, "tps65090-charger", cdata);
>>> + tps65090_charger_isr, IRQF_ONESHOT,
>>> + "tps65090-charger", cdata);
>>> if (ret) {
>>> dev_err(cdata->dev,
>>> "Unable to register irq %d err %d\n", irq,
>>>
>>>
>>> julia
>>>
>>
>> --
>> Vaishali
>>
--
Vaishali
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes
2016-10-18 17:10 ` Julia Lawall
@ 2016-10-18 17:35 ` Vaishali Thakkar
0 siblings, 0 replies; 13+ messages in thread
From: Vaishali Thakkar @ 2016-10-18 17:35 UTC (permalink / raw)
To: Julia Lawall
Cc: mmarek, Gilles.Muller, nicolas.palix, cocci, linux-kernel, lars
On Tuesday 18 October 2016 10:40 PM, Julia Lawall wrote:
>
>
> On Tue, 18 Oct 2016, Vaishali Thakkar wrote:
>
>>
>>
>> On Sunday 16 October 2016 10:37 PM, Vaishali Thakkar wrote:
>>> Add missing support for the devm_request_threaded_irq in
>>> the rules of context, report and org modes.
>>>
>>> Misc:
>>> ----
>>> To be consistent with other scripts, change confidence level
>>> of the script to 'Moderate'.
>>>
>>> Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
>>> ---
>>> scripts/coccinelle/misc/irqf_oneshot.cocci | 10 +++++++++-
>>> 1 file changed, 9 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
>>> index 03b748d..f6c93fd 100644
>>> --- a/scripts/coccinelle/misc/irqf_oneshot.cocci
>>> +++ b/scripts/coccinelle/misc/irqf_oneshot.cocci
>>> @@ -5,7 +5,7 @@
>>> /// So pass the IRQF_ONESHOT flag in this case.
>>> ///
>>> //
>>> -// Confidence: Good
>>> +// Confidence: Moderate
>>> // Comments:
>>> // Options: --no-includes
>>>
>>> @@ -89,13 +89,21 @@ devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
>>> @depends on context@
>>> position p != {r1.p,r2.p};
>>> @@
>>> +(
>>> *request_threaded_irq@p(irq, NULL, ...)
>>> +|
>>> +*devm_request_threaded_irq@p(dev, irq, NULL, ...)
>>> +)
>>>
>>> @match depends on report || org@
>>> expression irq;
>>> position p != {r1.p,r2.p};
>>> @@
>>> +(
>>> request_threaded_irq@p(irq, NULL, ...)
>>> +|
>>> +devm_request_threaded_irq@p(dev, irq, NULL, ...)
>>> +)
>>
>> Oh, my bad here. :(
>>
>> Forgot the initialization of meta variables for the
>> arguments.
>>
>> But I am wondering why coccicheck didn't fail here.
>> Isn't it suppose to give parsing errors? Or it doesn't
>> do that?
>
> It just give a warning, which I guess make coccicheck hides. It is
> allowed to require an argument to be named dev, although it is nicer if
> one declares it with symbol in that case.
Ah, ok. The results were based on the names 'irq, dev etc', not on the
assumption for metavariables.
> julia
>
>>
>> In any case, I am sorry for this. I'll send the revised
>> version of the patches.
>>
>>> @script:python depends on org@
>>> p << match.p;
>>>
>>
>> --
>> Vaishali
>>
--
Vaishali
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results
2016-10-18 17:11 ` Vaishali Thakkar
@ 2016-10-18 18:05 ` Julia Lawall
0 siblings, 0 replies; 13+ messages in thread
From: Julia Lawall @ 2016-10-18 18:05 UTC (permalink / raw)
To: Vaishali Thakkar
Cc: Julia Lawall, mmarek, Gilles.Muller, nicolas.palix, cocci,
linux-kernel, lars
On Tue, 18 Oct 2016, Vaishali Thakkar wrote:
>
>
> On Tuesday 18 October 2016 10:31 PM, Julia Lawall wrote:
> >
> >
> > On Tue, 18 Oct 2016, Vaishali Thakkar wrote:
> >
> >>
> >>
> >> On Tuesday 18 October 2016 10:04 PM, Julia Lawall wrote:
> >>> I get the following in patch mode that I don't get in context mode:
> >>
> >> Hi,
> >>
> >> Are you getting same number of devm cases in your report for the context
> >> and patch mode? [except this case]
> >
> > The only devm case I get in context mode is:
> >
> > diff -u -p /var/linuxes/linux-next/drivers/acpi/evged.c
> > /tmp/nothing/drivers/ac\
> > pi/evged.c
> > --- /var/linuxes/linux-next/drivers/acpi/evged.c
> > +++ /tmp/nothing/drivers/acpi/evged.c
> > @@ -116,8 +116,6 @@ static acpi_status acpi_ged_request_inte
> > if (r.flags & IORESOURCE_IRQ_SHAREABLE)
> > irqflags |= IRQF_SHARED;
> >
> > - if (devm_request_threaded_irq(dev, irq, NULL, acpi_ged_irq_handler,
> > - irqflags, "ACPI:Ged", event)) {
> > dev_err(dev, "failed to setup event handler for irq %u\n", irq);
> > return AE_ERROR;
> > }
> >
> > This one has the property that the first argument is an identifier. The
> > other cases seem to have a & expression. There are around 20 of them.
>
> Although I got the issue with the patches, I am wondering why even context mode
> gave result for the identifiers even though they are not initialized? Does that
> mean it automatically assumes the type of meta variables even though they are not
> initialized? I think spatch gives warnings for such cases. But I am not sure about
> the coccicheck.
I think that there are a few cases where the names are the ones you chose.
julia
>
> > julia
> >
> >
> >
> >>
> >>
> >>> diff -u -p a/drivers/power/supply/tps65090-charger.c
> >>> b/drivers/power/supply/tps\
> >>> 65090-charger.c
> >>> --- a/drivers/power/supply/tps65090-charger.c
> >>> +++ b/drivers/power/supply/tps65090-charger.c
> >>> @@ -311,7 +311,8 @@ static int tps65090_charger_probe(struct
> >>>
> >>> if (irq != -ENXIO) {
> >>> ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
> >>> - tps65090_charger_isr, 0, "tps65090-charger", cdata);
> >>> + tps65090_charger_isr, IRQF_ONESHOT,
> >>> + "tps65090-charger", cdata);
> >>> if (ret) {
> >>> dev_err(cdata->dev,
> >>> "Unable to register irq %d err %d\n", irq,
> >>>
> >>>
> >>> julia
> >>>
> >>
> >> --
> >> Vaishali
> >>
>
> --
> Vaishali
>
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2016-10-18 18:05 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-16 17:06 [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results Vaishali Thakkar
2016-10-16 17:07 ` [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes Vaishali Thakkar
2016-10-18 17:01 ` Vaishali Thakkar
2016-10-18 17:05 ` Vaishali Thakkar
2016-10-18 17:10 ` Julia Lawall
2016-10-18 17:35 ` Vaishali Thakkar
2016-10-16 17:09 ` [PATCH v2 1/3] Coccinelle: misc: Improve the matching of rules Vaishali Thakkar
2016-10-16 17:10 ` [PATCH v2 2/3] Coccinelle: misc: Improve the result given by context mode Vaishali Thakkar
2016-10-18 16:34 ` [PATCH v2 0/3] Coccinelle: misc: Improve the script for more accurate results Julia Lawall
2016-10-18 16:53 ` Vaishali Thakkar
2016-10-18 17:01 ` Julia Lawall
2016-10-18 17:11 ` Vaishali Thakkar
2016-10-18 18:05 ` Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).