Skip to contentSkip to conversation

Coccinelle: misc: Improve the script for more accurate results

PATCH Superseded Vaishali Thakkar 3 participants 19 messages Oct 16, 2016 – Nov 1, 2016 1 message not in the archive

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Coccinelle: misc: Improve the script for more accurate results

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(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH v2 1/3 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.

---
 scripts/coccinelle/misc/irqf_oneshot.cocci | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)
scripts/coccinelle/misc/irqf_oneshot.cocci +24 -6
index b421150..b538d08 100644
@@ -18,13 +18,12 @@ virtual report
 expression dev;
 expression irq;
 expression thread_fn;
-expression flags;
 position p;
 @@
 (
 request_threaded_irq at p(irq, NULL, thread_fn,
 (
-flags | IRQF_ONESHOT
+IRQF_ONESHOT | ...
 |
 IRQF_ONESHOT
 )
@@ -32,20 +31,39 @@ IRQF_ONESHOT
 |
 devm_request_threaded_irq at p(dev, irq, NULL, thread_fn,
 (
-flags | IRQF_ONESHOT
+IRQF_ONESHOT | ...
 |
 IRQF_ONESHOT
 )
 , ...)
 )
 
- at depends on patch@
+ at r2@
 expression dev;
 expression irq;
 expression thread_fn;
 expression flags;
+expression ret;
 position p != r1.p;
 @@
+flags = IRQF_ONESHOT | ...;
+(
+ret = request_threaded_irq at p(irq, NULL, thread_fn, flags, ...);
+|
+ret = devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...);
+|
+return request_threaded_irq at p(irq, NULL, thread_fn, flags, ...);
+|
+return devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...);
+)
+
+ at depends on patch@
+expression dev;
+expression irq;
+expression thread_fn;
+expression flags;
+position p != {r1.p,r2.p};
+@@
 (
 request_threaded_irq at p(irq, NULL, thread_fn,
 (
@@ -69,13 +87,13 @@ devm_request_threaded_irq at p(dev, irq, NULL, thread_fn,
 )
 
 @depends on context@
-position p != r1.p;
+position p != {r1.p,r2.p};
 @@
 *request_threaded_irq at p(...)
 
 @match depends on report || org@
 expression irq;
-position p != r1.p;
+position p != {r1.p,r2.p};
 @@
 request_threaded_irq at p(irq, NULL, ...)
 
Signature · 1 line
2.1.4
#2 lore raw

PATCH v2 1/3 Coccinelle: misc: Improve the matching of rules

Dear Vaishali,

You sent an update suggestion for the source file ?scripts/coccinelle/misc/irqf_oneshot.cocci? on 2016-10-16.

It contained a patch hunk like the following.

@@ -32,20 +31,39 @@ IRQF_ONESHOT
|
devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, (
-flags | IRQF_ONESHOT
+IRQF_ONESHOT | ...
|
IRQF_ONESHOT
)
, ...)
)

- at depends on patch@
+ at r2@
expression dev;
expression irq;
expression thread_fn;
expression flags;
+expression ret;
position p != r1.p;
@@
+flags = IRQF_ONESHOT | ...;
+(
+ret = request_threaded_irq at p(irq, NULL, thread_fn, flags, ...); +|
+ret = devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...); +|
+return request_threaded_irq at p(irq, NULL, thread_fn, flags, ...); +|
+return devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...); +)
+
+ at depends on patch@
+expression dev;
+expression irq;
+expression thread_fn;
+expression flags;
+position p != {r1.p,r2.p};
+@@
(
request_threaded_irq at p(irq, NULL, thread_fn,
(

I have got a few ideas here.

1. Would you like to reduce the repetition of the SmPL key word ?expression??

2. How do you think about a bit more fine-tuning for the shown SmPL disjunction as follows?

+(
+ ret =
+(
+ request_threaded_irq at p(irq, NULL, thread_fn, flags, ...)
+|
+ devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...)
+)
+ ;
+|
+ return
+(
+ request_threaded_irq at p(irq, NULL, thread_fn, flags, ...)
+|
+ devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...)
+)
+ ;
+)

Regards,
Markus

#3 lore raw

PATCH v2 1/3 Coccinelle: misc: Improve the matching of rules

Quoted 52 lines · SF Markus Elfring

Dear Vaishali,

You sent an update suggestion for the source file ?scripts/coccinelle/misc/irqf_oneshot.cocci? on 2016-10-16.

It contained a patch hunk like the following.

scripts/coccinelle/misc/irqf_oneshot.cocci +21 -2
@@ -32,20 +31,39 @@ IRQF_ONESHOT
 |
 devm_request_threaded_irq at p(dev, irq, NULL, thread_fn,
 (
-flags | IRQF_ONESHOT
+IRQF_ONESHOT | ...
 |
 IRQF_ONESHOT
 )
 , ...)
 )
 
- at depends on patch@
+ at r2@
 expression dev;
 expression irq;
 expression thread_fn;
 expression flags;
+expression ret;
 position p != r1.p;
 @@
+flags = IRQF_ONESHOT | ...;
+(
+ret = request_threaded_irq at p(irq, NULL, thread_fn, flags, ...);
+|
+ret = devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...);
+|
+return request_threaded_irq at p(irq, NULL, thread_fn, flags, ...);
+|
+return devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...);
+)
+
+ at depends on patch@
+expression dev;
+expression irq;
+expression thread_fn;
+expression flags;
+position p != {r1.p,r2.p};
+@@
 (
 request_threaded_irq at p(irq, NULL, thread_fn,
 (
Quoted 6 lines

I have got a few ideas here.

1. Would you like to reduce the repetition of the SmPL key word ?expression??

2. How do you think about a bit more fine-tuning for the shown SmPL disjunction as follows?

What do you mean by "a bit more fine-tuning"? If you have a concrete suggestion, then make it. But don't make work for other people to guess what you might mean.

julia

Quoted 28 lines
(quoted diff) +17 -0
+(
+ ret =
+(
+       request_threaded_irq at p(irq, NULL, thread_fn, flags, ...)
+|
+       devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...)
+)
+ ;
+|
+ return
+(
+        request_threaded_irq at p(irq, NULL, thread_fn, flags, ...)
+|
+        devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...)
+)
+ ;
+)

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci at systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

#4 lore raw

PATCH v2 1/3 Coccinelle: misc: Improve the matching of rules

Quoted 3 lines

What do you mean by "a bit more fine-tuning"? If you have a concrete suggestion, then make it. But don't make work for other people to guess what you might mean.

I hoped that the SmPL source code below would explain my update suggestion in a sufficient way to use two smaller SmPL disjunctions.

Quoted 9 lines
Quoted 9 lines
(quoted diff) +9 -0
+(
+ ret =
+(
+       request_threaded_irq at p(irq, NULL, thread_fn, flags, ...)
+|
+       devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...)
+)
+ ;
+|
Quoted 8 lines

Review

Quoted 8 lines

+ return

(quoted diff) +7 -0
+(
+        request_threaded_irq at p(irq, NULL, thread_fn, flags, ...)
+|
+        devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...)
+)
+ ;
+)

Regards,
Markus

#5 lore raw

PATCH v2 1/3 Coccinelle: misc: Improve the matching of rules

Quoted 6 lines · SF Markus Elfring
Quoted 3 lines

What do you mean by "a bit more fine-tuning"? If you have a concrete suggestion, then make it. But don't make work for other people to guess what you might mean.

I hoped that the SmPL source code below would explain my update suggestion in a sufficient way to use two smaller SmPL disjunctions.

Sorry, I thought it was the original code, and didn't realize that it was the suggestion..

But I don't think that the suggestion improves readability in any way. Coccinelle disjunctions also float up to the statement level anyway, so the semantic patch that is actually applied to the code is the same in either case.

julia

Quoted 23 lines
Quoted 11 lines
Quoted 11 lines
(quoted diff) +9 -0
+(
+ ret =
+(
+       request_threaded_irq at p(irq, NULL, thread_fn, flags, ...)
+|
+       devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...)
+)
+ ;
+|
Quoted 8 lines

Review

Quoted 8 lines

+ return

(quoted diff) +7 -0
+(
+        request_threaded_irq at p(irq, NULL, thread_fn, flags, ...)
+|
+        devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...)
+)
+ ;
+)

Regards,
Markus

#6 lore raw

PATCH v2 1/3 Coccinelle: misc: Improve the matching of rules

Quoted 4 lines

Sorry, I thought it was the original code, and didn't realize that it was the suggestion..

But I don't think that the suggestion improves readability in any way.

I hoped that my SmPL script variant could influence the execution characteristics in positive ways.

Quoted 1 line

Coccinelle disjunctions also float up to the statement level anyway,

I do not really understand this information at the moment.

Quoted 2 lines

so the semantic patch that is actually applied to the code is the same in either case.

I assumed that the reduced code repetition could result in a desired effect.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
(quoted diff) +9 -0
+(
+ ret =
+(
+       request_threaded_irq at p(irq, NULL, thread_fn, flags, ...)
+|
+       devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...)
+)
+ ;
+|
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Review

Quoted 8 lines

+ return

(quoted diff) +7 -0
+(
+        request_threaded_irq at p(irq, NULL, thread_fn, flags, ...)
+|
+        devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, flags, ...)
+)
+ ;
+)

Regards,
Markus

A message that is not in the archive (sent off-list or not yet received): alpine.DEB.2.10.1611012206200.6300@hadrien

#8 lore raw

[Cocci] Coccinelle: misc: Improve the matching of rules

Quoted 3 lines
Quoted 1 line

I assumed that the reduced code repetition could result in a desired effect.

Incorrect on all points.

I wonder then why the Coccinelle software would not benefit from the specification of common parts in two similar SmPL disjunctions.

Regards,
Markus

#9 lore raw

PATCH v2 2/3 Coccinelle: misc: Improve the result given by context mode

In reply to Vaishali Thakkar

To eliminate false positives given by the context mode, add necessary arguments for the function request_threaded_irq.

---
 scripts/coccinelle/misc/irqf_oneshot.cocci | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/coccinelle/misc/irqf_oneshot.cocci +1 -1
index b538d08..03b748d 100644
@@ -89,7 +89,7 @@ devm_request_threaded_irq at p(dev, irq, NULL, thread_fn,
 @depends on context@
 position p != {r1.p,r2.p};
 @@
-*request_threaded_irq at p(...)
+*request_threaded_irq at p(irq, NULL, ...)
 
 @match depends on report || org@
 expression irq;
Signature · 1 line
2.1.4
#10 lore raw

PATCH v2 3/3 Coccinelle: misc: Add support for devm variant in all modes

In reply to 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'.

---
 scripts/coccinelle/misc/irqf_oneshot.cocci | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
scripts/coccinelle/misc/irqf_oneshot.cocci +9 -1
index 03b748d..f6c93fd 100644
@@ -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 at p(dev, irq, NULL, thread_fn,
 @depends on context@
 position p != {r1.p,r2.p};
 @@
+(
 *request_threaded_irq at p(irq, NULL, ...)
+|
+*devm_request_threaded_irq at p(dev, irq, NULL, ...)
+)
 
 @match depends on report || org@
 expression irq;
 position p != {r1.p,r2.p};
 @@
+(
 request_threaded_irq at p(irq, NULL, ...)
+|
+devm_request_threaded_irq at p(dev, irq, NULL, ...)
+)
 
 @script:python depends on org@
 p << match.p;
Signature · 1 line
2.1.4
#11 lore raw

Re: [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes

Quoted 35 lines · 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'.

---
 scripts/coccinelle/misc/irqf_oneshot.cocci | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
scripts/coccinelle/misc/irqf_oneshot.cocci +5 -1
index 03b748d..f6c93fd 100644
@@ -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 at p(dev, irq, NULL, thread_fn,
 @depends on context@
 position p != {r1.p,r2.p};
 @@
+(
 *request_threaded_irq at p(irq, NULL, ...)
+|
+*devm_request_threaded_irq at p(dev, irq, NULL, ...)
+)

scripts/coccinelle/misc/irqf_oneshot.cocci devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, · line 106

Quoted 10 lines
scripts/coccinelle/misc/irqf_oneshot.cocci +4 -0
 
 @match depends on report || org@
 expression irq;
 position p != {r1.p,r2.p};
 @@
+(
 request_threaded_irq at p(irq, NULL, ...)
+|
+devm_request_threaded_irq at 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.

Quoted 3 lines
scripts/coccinelle/misc/irqf_oneshot.cocci +0 -0
 @script:python depends on org@
 p << match.p;
 
Signature · 1 line
Vaishali
#12 lore raw

Re: [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes

In reply to Vaishali Thakkar
Quoted 35 lines · 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'.

---
 scripts/coccinelle/misc/irqf_oneshot.cocci | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
scripts/coccinelle/misc/irqf_oneshot.cocci +5 -1
index 03b748d..f6c93fd 100644
@@ -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 at p(dev, irq, NULL, thread_fn,
 @depends on context@
 position p != {r1.p,r2.p};
 @@
+(
 *request_threaded_irq at p(irq, NULL, ...)
+|
+*devm_request_threaded_irq at p(dev, irq, NULL, ...)
+)

scripts/coccinelle/misc/irqf_oneshot.cocci devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, · line 106

Quoted 10 lines
scripts/coccinelle/misc/irqf_oneshot.cocci +4 -0
 
 @match depends on report || org@
 expression irq;
 position p != {r1.p,r2.p};
 @@
+(
 request_threaded_irq at p(irq, NULL, ...)
+|
+devm_request_threaded_irq at 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.

Quoted 3 lines
scripts/coccinelle/misc/irqf_oneshot.cocci +0 -0
 @script:python depends on org@
 p << match.p;
 
Signature · 1 line
Vaishali
#13 lore raw

Re: [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes

Quoted 51 lines · Vaishali Thakkar
Quoted 35 lines · 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'.

---
 scripts/coccinelle/misc/irqf_oneshot.cocci | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
scripts/coccinelle/misc/irqf_oneshot.cocci +5 -1
index 03b748d..f6c93fd 100644
@@ -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 at p(dev, irq, NULL, thread_fn,
 @depends on context@
 position p != {r1.p,r2.p};
 @@
+(
 *request_threaded_irq at p(irq, NULL, ...)
+|
+*devm_request_threaded_irq at p(dev, irq, NULL, ...)
+)

scripts/coccinelle/misc/irqf_oneshot.cocci devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, · line 106

Quoted 10 lines
scripts/coccinelle/misc/irqf_oneshot.cocci +4 -0
 
 @match depends on report || org@
 expression irq;
 position p != {r1.p,r2.p};
 @@
+(
 request_threaded_irq at p(irq, NULL, ...)
+|
+devm_request_threaded_irq at p(dev, irq, NULL, ...)
+)

Oh, my bad here. :(

Quoted 6 lines

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

Quoted 11 lines

In any case, I am sorry for this. I'll send the revised version of the patches.

scripts/coccinelle/misc/irqf_oneshot.cocci devm_request_threaded_irq at p(dev, irq, NULL, thread_fn,

Quoted 3 lines
scripts/coccinelle/misc/irqf_oneshot.cocci +0 -0
 @script:python depends on org@
 p << match.p;
 

--
Vaishali

#14 lore raw

Re: [PATCH v2 3/3] Coccinelle: misc: Add support for devm variant in all modes

Quoted 58 lines · Julia Lawall
Quoted 54 lines · Vaishali Thakkar
Quoted 35 lines · 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'.

---
 scripts/coccinelle/misc/irqf_oneshot.cocci | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
scripts/coccinelle/misc/irqf_oneshot.cocci +5 -1
index 03b748d..f6c93fd 100644
@@ -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 at p(dev, irq, NULL, thread_fn,
 @depends on context@
 position p != {r1.p,r2.p};
 @@
+(
 *request_threaded_irq at p(irq, NULL, ...)
+|
+*devm_request_threaded_irq at p(dev, irq, NULL, ...)
+)

scripts/coccinelle/misc/irqf_oneshot.cocci devm_request_threaded_irq at p(dev, irq, NULL, thread_fn, · line 106

Quoted 10 lines
scripts/coccinelle/misc/irqf_oneshot.cocci +4 -0
 
 @match depends on report || org@
 expression irq;
 position p != {r1.p,r2.p};
 @@
+(
 request_threaded_irq at p(irq, NULL, ...)
+|
+devm_request_threaded_irq at p(dev, irq, NULL, ...)
+)

Oh, my bad here. :(

Forgot the initialization of meta variables for the arguments.

Quoted 7 lines
Quoted 3 lines

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.

Quoted 13 lines

julia

Quoted 11 lines

In any case, I am sorry for this. I'll send the revised version of the patches.

scripts/coccinelle/misc/irqf_oneshot.cocci devm_request_threaded_irq at p(dev, irq, NULL, thread_fn,

Quoted 3 lines
scripts/coccinelle/misc/irqf_oneshot.cocci +0 -0
 @script:python depends on org@
 p << match.p;
 

--
Vaishali

Signature · 1 line
Vaishali
#15 lore raw
In reply to Vaishali Thakkar

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

drivers/power/supply/tps65090-charger.c +0 -0
@@ -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

#16 lore raw
Quoted 1 line · Julia Lawall

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]

Quoted 19 lines

diff -u -p a/drivers/power/supply/tps65090-charger.c b/drivers/power/supply/tps\
65090-charger.c

drivers/power/supply/tps65090-charger.c +2 -1
@@ -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

Signature · 1 line
Vaishali
#17 lore raw
Quoted 9 lines · Vaishali Thakkar
Quoted 1 line · Julia Lawall

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

tmp/nothing/drivers/acpi/evged.c renamed from var/linuxes/linux-next/drivers/acpi/evged.c +0 -2
@@ -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

Quoted 25 lines
Quoted 19 lines

diff -u -p a/drivers/power/supply/tps65090-charger.c b/drivers/power/supply/tps\
65090-charger.c

drivers/power/supply/tps65090-charger.c +2 -1
@@ -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,
Quoted 2 lines

julia

--
Vaishali

#18 lore raw
Quoted 31 lines · Julia Lawall
Quoted 9 lines · Vaishali Thakkar
Quoted 1 line · Julia Lawall

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

tmp/nothing/drivers/acpi/evged.c renamed from var/linuxes/linux-next/drivers/acpi/evged.c +0 -2
@@ -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;
        }
Quoted 2 lines

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.

Quoted 29 lines

julia

Quoted 25 lines
Quoted 19 lines

diff -u -p a/drivers/power/supply/tps65090-charger.c b/drivers/power/supply/tps\
65090-charger.c

drivers/power/supply/tps65090-charger.c +2 -1
@@ -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,
Quoted 2 lines

julia

--
Vaishali

Signature · 1 line
Vaishali
#19 lore raw
Quoted 34 lines · Vaishali Thakkar
Quoted 31 lines · Julia Lawall
Quoted 9 lines · Vaishali Thakkar
Quoted 1 line · Julia Lawall

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

tmp/nothing/drivers/acpi/evged.c renamed from var/linuxes/linux-next/drivers/acpi/evged.c +0 -2
@@ -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;
        }
Quoted 8 lines
Quoted 2 lines

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

Quoted 34 lines
Quoted 30 lines

julia

Quoted 25 lines
Quoted 19 lines

diff -u -p a/drivers/power/supply/tps65090-charger.c b/drivers/power/supply/tps\
65090-charger.c

drivers/power/supply/tps65090-charger.c +2 -1
@@ -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,
Quoted 2 lines

julia

--
Vaishali

--
Vaishali