Various cleanups in platform_get_irq.cocci to give more useful
patches and to give a few more results.
From: Masahiro Yamada <[email protected]>
Treat separately the case where there is only one other
statement in the branch, to be able to remove the outer
{} as well.
Signed-off-by: Julia Lawall <[email protected]>
---
scripts/coccinelle/api/platform_get_irq.cocci | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/scripts/coccinelle/api/platform_get_irq.cocci b/scripts/coccinelle/api/platform_get_irq.cocci
index c6ac755..7ac32ee 100644
--- a/scripts/coccinelle/api/platform_get_irq.cocci
+++ b/scripts/coccinelle/api/platform_get_irq.cocci
@@ -31,6 +31,25 @@ if ( \( ret < 0 \| ret <= 0 \) )
@depends on patch@
expression ret;
struct platform_device *E;
+statement S;
+@@
+
+ret =
+(
+platform_get_irq
+|
+platform_get_irq_byname
+)(E, ...);
+
+if ( \( ret < 0 \| ret <= 0 \) )
+-{
+-dev_err(...);
+S
+-}
+
+@depends on patch@
+expression ret;
+struct platform_device *E;
@@
ret =
> From: Masahiro Yamada <[email protected]>
I wonder about this information.
Would you like to use the tag “Suggested-by” instead?
…
> +++ b/scripts/coccinelle/api/platform_get_irq.cocci
> @@ -31,6 +31,25 @@ if ( \( ret < 0 \| ret <= 0 \) )
…
> +ret =
> +(
> +platform_get_irq
> +|
> +platform_get_irq_byname
> +)(E, ...);
> +
> +if ( \( ret < 0 \| ret <= 0 \) )
> +-{
> +-dev_err(...);
> +S
> +-}
How do you think about to use the following SmPL code variant?
+ ret =
+(platform_get_irq
+|platform_get_irq_byname
+)(E, ...);
+
+ if ( \( ret < 0 \| ret <= 0 \) )
+-{
+-dev_err(...);
+ S
+-}
Regards,
Markus
> From: Masahiro Yamada <[email protected]>
I wonder about this information.
Would you like to use the tag “Suggested-by” instead?
…
> +++ b/scripts/coccinelle/api/platform_get_irq.cocci
> @@ -31,6 +31,25 @@ if ( \( ret < 0 \| ret <= 0 \) )
…
> +ret =
> +(
> +platform_get_irq
> +|
> +platform_get_irq_byname
> +)(E, ...);
> +
> +if ( \( ret < 0 \| ret <= 0 \) )
> +-{
> +-dev_err(...);
> +S
> +-}
How do you think about to use the following SmPL code variant?
+ ret =
+(platform_get_irq
+|platform_get_irq_byname
+)(E, ...);
+
+ if ( \( ret < 0 \| ret <= 0 \) )
+-{
+-dev_err(...);
+ S
+-}
Regards,
Markus
On Tue, 19 Nov 2019, Markus Elfring wrote:
> > From: Masahiro Yamada <[email protected]>
>
> I wonder about this information.
> Would you like to use the tag “Suggested-by” instead?
Sorry, I seem to have done something quite wrong on this patch. I will
fix it.
>
>
> …
> > +++ b/scripts/coccinelle/api/platform_get_irq.cocci
> > @@ -31,6 +31,25 @@ if ( \( ret < 0 \| ret <= 0 \) )
> …
> > +ret =
> > +(
> > +platform_get_irq
> > +|
> > +platform_get_irq_byname
> > +)(E, ...);
> > +
> > +if ( \( ret < 0 \| ret <= 0 \) )
> > +-{
> > +-dev_err(...);
> > +S
> > +-}
>
> How do you think about to use the following SmPL code variant?
And the benefit is what?
julia
> + ret =
> +(platform_get_irq
> +|platform_get_irq_byname
> +)(E, ...);
> +
> + if ( \( ret < 0 \| ret <= 0 \) )
> +-{
> +-dev_err(...);
> + S
> +-}
>
> Regards,
> Markus
>
> Sorry, I seem to have done something quite wrong on this patch.
Interesting …
> I will fix it.
Thanks.
Development will be continued:
https://lkml.org/lkml/2019/11/19/1681
https://lore.kernel.org/patchwork/patch/1156089/
https://lore.kernel.org/cocci/[email protected]/
>> How do you think about to use the following SmPL code variant?
>
> And the benefit is what?
…
>> + ret =
>> +(platform_get_irq
>> +|platform_get_irq_byname
>> +)(E, ...);
>> +
>> + if ( \( ret < 0 \| ret <= 0 \) )
>> +-{
>> +-dev_err(...);
>> + S
>> +-}
* I suggest to use a different coding style for the specification of
two function names in the SmPL disjunction.
* Would you like to avoid the mixing of code items in the first text column?
Regards,
Markus