All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Coccinelle: zalloc_simple: Fix patch mode for dma_alloc_coherent()
@ 2020-04-03 17:30 ` Alex Dewar
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Dewar @ 2020-04-03 17:30 UTC (permalink / raw)
  To: alex.dewar
  Cc: Luis Chamberlain, Julia Lawall, Gilles Muller, Nicolas Palix,
	Michal Marek, Thomas Gleixner, Kate Stewart, Allison Randal,
	Greg Kroah-Hartman, cocci, linux-kernel

Commit dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()"), in
removing dma_zalloc_coherent() treewide, inadvertently removed the patch
rule for dma_alloc_coherent(), leaving Coccinelle unable to auto-generate
patches for this case. Fix this.

Fixes: dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()")
CC: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
---
 scripts/coccinelle/api/alloc/zalloc-simple.cocci | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
index 26cda3f48f01..c53aab7fe096 100644
--- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
+++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
@@ -70,6 +70,15 @@ statement S;
 - x = (T)vmalloc(E1);
 + x = (T)vzalloc(E1);
 |
+- x = dma_alloc_coherent(E2,E1,E3,E4);
++ x = dma_alloc_coherent(E2,E1,E3,E4);
+|
+- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
++ x = dma_alloc_coherent(E2,E1,E3,E4);
+|
+- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
++ x = (T)dma_alloc_coherent(E2,E1,E3,E4);
+|
 - x = kmalloc_node(E1,E2,E3);
 + x = kzalloc_node(E1,E2,E3);
 |
--
2.26.0


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

* [Cocci] [PATCH] Coccinelle: zalloc_simple: Fix patch mode for dma_alloc_coherent()
@ 2020-04-03 17:30 ` Alex Dewar
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Dewar @ 2020-04-03 17:30 UTC (permalink / raw)
  To: alex.dewar
  Cc: Kate Stewart, Michal Marek, Gilles Muller, Greg Kroah-Hartman,
	Nicolas Palix, linux-kernel, Julia Lawall, Thomas Gleixner,
	cocci, Allison Randal

Commit dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()"), in
removing dma_zalloc_coherent() treewide, inadvertently removed the patch
rule for dma_alloc_coherent(), leaving Coccinelle unable to auto-generate
patches for this case. Fix this.

Fixes: dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()")
CC: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
---
 scripts/coccinelle/api/alloc/zalloc-simple.cocci | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
index 26cda3f48f01..c53aab7fe096 100644
--- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
+++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
@@ -70,6 +70,15 @@ statement S;
 - x = (T)vmalloc(E1);
 + x = (T)vzalloc(E1);
 |
+- x = dma_alloc_coherent(E2,E1,E3,E4);
++ x = dma_alloc_coherent(E2,E1,E3,E4);
+|
+- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
++ x = dma_alloc_coherent(E2,E1,E3,E4);
+|
+- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
++ x = (T)dma_alloc_coherent(E2,E1,E3,E4);
+|
 - x = kmalloc_node(E1,E2,E3);
 + x = kzalloc_node(E1,E2,E3);
 |
--
2.26.0

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [PATCH] Coccinelle: zalloc_simple: Fix patch mode for dma_alloc_coherent()
  2020-04-03 17:30 ` [Cocci] " Alex Dewar
@ 2020-04-06 19:15   ` Julia Lawall
  -1 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2020-04-06 19:15 UTC (permalink / raw)
  To: Alex Dewar
  Cc: Luis Chamberlain, Gilles Muller, Nicolas Palix, Michal Marek,
	Thomas Gleixner, Kate Stewart, Allison Randal,
	Greg Kroah-Hartman, cocci, linux-kernel



On Fri, 3 Apr 2020, Alex Dewar wrote:

> Commit dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()"), in
> removing dma_zalloc_coherent() treewide, inadvertently removed the patch
> rule for dma_alloc_coherent(), leaving Coccinelle unable to auto-generate
> patches for this case. Fix this.
>
> Fixes: dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()")
> CC: Luis Chamberlain <mcgrof@kernel.org>
> Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
> ---
>  scripts/coccinelle/api/alloc/zalloc-simple.cocci | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> index 26cda3f48f01..c53aab7fe096 100644
> --- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> +++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> @@ -70,6 +70,15 @@ statement S;
>  - x = (T)vmalloc(E1);
>  + x = (T)vzalloc(E1);
>  |
> +- x = dma_alloc_coherent(E2,E1,E3,E4);
> ++ x = dma_alloc_coherent(E2,E1,E3,E4);

Hi,

I don't understand the above case.  The before and after code seem to be
the same?

julia


> +|
> +- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
> ++ x = dma_alloc_coherent(E2,E1,E3,E4);
> +|
> +- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
> ++ x = (T)dma_alloc_coherent(E2,E1,E3,E4);
> +|
>  - x = kmalloc_node(E1,E2,E3);
>  + x = kzalloc_node(E1,E2,E3);
>  |
> --
> 2.26.0
>
>

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

* Re: [Cocci] [PATCH] Coccinelle: zalloc_simple: Fix patch mode for dma_alloc_coherent()
@ 2020-04-06 19:15   ` Julia Lawall
  0 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2020-04-06 19:15 UTC (permalink / raw)
  To: Alex Dewar
  Cc: Kate Stewart, Michal Marek, Gilles Muller, Greg Kroah-Hartman,
	Nicolas Palix, linux-kernel, Thomas Gleixner, cocci,
	Allison Randal



On Fri, 3 Apr 2020, Alex Dewar wrote:

> Commit dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()"), in
> removing dma_zalloc_coherent() treewide, inadvertently removed the patch
> rule for dma_alloc_coherent(), leaving Coccinelle unable to auto-generate
> patches for this case. Fix this.
>
> Fixes: dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()")
> CC: Luis Chamberlain <mcgrof@kernel.org>
> Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
> ---
>  scripts/coccinelle/api/alloc/zalloc-simple.cocci | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> index 26cda3f48f01..c53aab7fe096 100644
> --- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> +++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> @@ -70,6 +70,15 @@ statement S;
>  - x = (T)vmalloc(E1);
>  + x = (T)vzalloc(E1);
>  |
> +- x = dma_alloc_coherent(E2,E1,E3,E4);
> ++ x = dma_alloc_coherent(E2,E1,E3,E4);

Hi,

I don't understand the above case.  The before and after code seem to be
the same?

julia


> +|
> +- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
> ++ x = dma_alloc_coherent(E2,E1,E3,E4);
> +|
> +- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
> ++ x = (T)dma_alloc_coherent(E2,E1,E3,E4);
> +|
>  - x = kmalloc_node(E1,E2,E3);
>  + x = kzalloc_node(E1,E2,E3);
>  |
> --
> 2.26.0
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [PATCH] Coccinelle: zalloc_simple: Fix patch mode for dma_alloc_coherent()
  2020-04-06 19:15   ` [Cocci] " Julia Lawall
@ 2020-04-07 15:37     ` Alex Dewar
  -1 siblings, 0 replies; 8+ messages in thread
From: Alex Dewar @ 2020-04-07 15:37 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Luis Chamberlain, Gilles Muller, Nicolas Palix, Michal Marek,
	Thomas Gleixner, Kate Stewart, Allison Randal,
	Greg Kroah-Hartman, cocci, linux-kernel

On Mon Apr 6, 2020 at 9:15 PM, Julia Lawall wrote:
>
> 
>
> 
> On Fri, 3 Apr 2020, Alex Dewar wrote:
>
> 
> > Commit dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()"), in
> > removing dma_zalloc_coherent() treewide, inadvertently removed the patch
> > rule for dma_alloc_coherent(), leaving Coccinelle unable to auto-generate
> > patches for this case. Fix this.
> >
> > Fixes: dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()")
> > CC: Luis Chamberlain <mcgrof@kernel.org>
> > Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
> > ---
> >  scripts/coccinelle/api/alloc/zalloc-simple.cocci | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> > index 26cda3f48f01..c53aab7fe096 100644
> > --- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> > +++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> > @@ -70,6 +70,15 @@ statement S;
> >  - x = (T)vmalloc(E1);
> >  + x = (T)vzalloc(E1);
> >  |
> > +- x = dma_alloc_coherent(E2,E1,E3,E4);
> > ++ x = dma_alloc_coherent(E2,E1,E3,E4);
>
> 
> Hi,
>
> 
> I don't understand the above case. The before and after code seem to be
> the same?
>
> 
> julia
>
> 
>
> 
> > +|
> > +- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
> > ++ x = dma_alloc_coherent(E2,E1,E3,E4);
> > +|
> > +- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
> > ++ x = (T)dma_alloc_coherent(E2,E1,E3,E4);
> > +|
> >  - x = kmalloc_node(E1,E2,E3);
> >  + x = kzalloc_node(E1,E2,E3);
> >  |
> > --
> > 2.26.0
> >
> >
>
> 
>
> 


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

* Re: [Cocci] [PATCH] Coccinelle: zalloc_simple: Fix patch mode for dma_alloc_coherent()
@ 2020-04-07 15:37     ` Alex Dewar
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Dewar @ 2020-04-07 15:37 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Kate Stewart, Michal Marek, Gilles Muller, Greg Kroah-Hartman,
	Nicolas Palix, linux-kernel, Thomas Gleixner, cocci,
	Allison Randal

On Mon Apr 6, 2020 at 9:15 PM, Julia Lawall wrote:
>
> 
>
> 
> On Fri, 3 Apr 2020, Alex Dewar wrote:
>
> 
> > Commit dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()"), in
> > removing dma_zalloc_coherent() treewide, inadvertently removed the patch
> > rule for dma_alloc_coherent(), leaving Coccinelle unable to auto-generate
> > patches for this case. Fix this.
> >
> > Fixes: dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()")
> > CC: Luis Chamberlain <mcgrof@kernel.org>
> > Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
> > ---
> >  scripts/coccinelle/api/alloc/zalloc-simple.cocci | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> > index 26cda3f48f01..c53aab7fe096 100644
> > --- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> > +++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> > @@ -70,6 +70,15 @@ statement S;
> >  - x = (T)vmalloc(E1);
> >  + x = (T)vzalloc(E1);
> >  |
> > +- x = dma_alloc_coherent(E2,E1,E3,E4);
> > ++ x = dma_alloc_coherent(E2,E1,E3,E4);
>
> 
> Hi,
>
> 
> I don't understand the above case. The before and after code seem to be
> the same?
>
> 
> julia
>
> 
>
> 
> > +|
> > +- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
> > ++ x = dma_alloc_coherent(E2,E1,E3,E4);
> > +|
> > +- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
> > ++ x = (T)dma_alloc_coherent(E2,E1,E3,E4);
> > +|
> >  - x = kmalloc_node(E1,E2,E3);
> >  + x = kzalloc_node(E1,E2,E3);
> >  |
> > --
> > 2.26.0
> >
> >
>
> 
>
> 

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [PATCH] Coccinelle: zalloc_simple: Fix patch mode for dma_alloc_coherent()
  2020-04-06 19:15   ` [Cocci] " Julia Lawall
@ 2020-04-07 15:50     ` Alex Dewar
  -1 siblings, 0 replies; 8+ messages in thread
From: Alex Dewar @ 2020-04-07 15:50 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Luis Chamberlain, Gilles Muller, Nicolas Palix, Michal Marek,
	Thomas Gleixner, Kate Stewart, Allison Randal,
	Greg Kroah-Hartman, cocci, linux-kernel

On Mon, Apr 06, 2020 at 09:15:29PM +0200, Julia Lawall wrote:
>
>
> On Fri, 3 Apr 2020, Alex Dewar wrote:
>
> > Commit dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()"), in
> > removing dma_zalloc_coherent() treewide, inadvertently removed the patch
> > rule for dma_alloc_coherent(), leaving Coccinelle unable to auto-generate
> > patches for this case. Fix this.
> >
> > Fixes: dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()")
> > CC: Luis Chamberlain <mcgrof@kernel.org>
> > Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
> > ---
> >  scripts/coccinelle/api/alloc/zalloc-simple.cocci | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> > index 26cda3f48f01..c53aab7fe096 100644
> > --- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> > +++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> > @@ -70,6 +70,15 @@ statement S;
> >  - x = (T)vmalloc(E1);
> >  + x = (T)vzalloc(E1);
> >  |
> > +- x = dma_alloc_coherent(E2,E1,E3,E4);
> > ++ x = dma_alloc_coherent(E2,E1,E3,E4);
>
> Hi,
>
> I don't understand the above case.  The before and after code seem to be
> the same?
>
> julia

Hi,

I just wanted to flag up unnecessary calls to memset() after
dma_alloc_coherent() and I wasn't sure how to best express that, though
I'm sure there's a much cleaner way. At the moment the cocci file only
gives warnings for this case, but it would be nice to be able to
autogenerate patches too.

Best,
Alex

>
>
> > +|
> > +- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
> > ++ x = dma_alloc_coherent(E2,E1,E3,E4);
> > +|
> > +- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
> > ++ x = (T)dma_alloc_coherent(E2,E1,E3,E4);
> > +|
> >  - x = kmalloc_node(E1,E2,E3);
> >  + x = kzalloc_node(E1,E2,E3);
> >  |
> > --
> > 2.26.0
> >
> >

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

* Re: [Cocci] [PATCH] Coccinelle: zalloc_simple: Fix patch mode for dma_alloc_coherent()
@ 2020-04-07 15:50     ` Alex Dewar
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Dewar @ 2020-04-07 15:50 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Kate Stewart, Michal Marek, Gilles Muller, Greg Kroah-Hartman,
	Nicolas Palix, linux-kernel, Thomas Gleixner, cocci,
	Allison Randal

On Mon, Apr 06, 2020 at 09:15:29PM +0200, Julia Lawall wrote:
>
>
> On Fri, 3 Apr 2020, Alex Dewar wrote:
>
> > Commit dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()"), in
> > removing dma_zalloc_coherent() treewide, inadvertently removed the patch
> > rule for dma_alloc_coherent(), leaving Coccinelle unable to auto-generate
> > patches for this case. Fix this.
> >
> > Fixes: dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()")
> > CC: Luis Chamberlain <mcgrof@kernel.org>
> > Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
> > ---
> >  scripts/coccinelle/api/alloc/zalloc-simple.cocci | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> > index 26cda3f48f01..c53aab7fe096 100644
> > --- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> > +++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> > @@ -70,6 +70,15 @@ statement S;
> >  - x = (T)vmalloc(E1);
> >  + x = (T)vzalloc(E1);
> >  |
> > +- x = dma_alloc_coherent(E2,E1,E3,E4);
> > ++ x = dma_alloc_coherent(E2,E1,E3,E4);
>
> Hi,
>
> I don't understand the above case.  The before and after code seem to be
> the same?
>
> julia

Hi,

I just wanted to flag up unnecessary calls to memset() after
dma_alloc_coherent() and I wasn't sure how to best express that, though
I'm sure there's a much cleaner way. At the moment the cocci file only
gives warnings for this case, but it would be nice to be able to
autogenerate patches too.

Best,
Alex

>
>
> > +|
> > +- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
> > ++ x = dma_alloc_coherent(E2,E1,E3,E4);
> > +|
> > +- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
> > ++ x = (T)dma_alloc_coherent(E2,E1,E3,E4);
> > +|
> >  - x = kmalloc_node(E1,E2,E3);
> >  + x = kzalloc_node(E1,E2,E3);
> >  |
> > --
> > 2.26.0
> >
> >
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

end of thread, other threads:[~2020-04-07 17:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03 17:30 [PATCH] Coccinelle: zalloc_simple: Fix patch mode for dma_alloc_coherent() Alex Dewar
2020-04-03 17:30 ` [Cocci] " Alex Dewar
2020-04-06 19:15 ` Julia Lawall
2020-04-06 19:15   ` [Cocci] " Julia Lawall
2020-04-07 15:37   ` Alex Dewar
2020-04-07 15:37     ` [Cocci] " Alex Dewar
2020-04-07 15:50   ` Alex Dewar
2020-04-07 15:50     ` [Cocci] " Alex Dewar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.