Re: [Cocci] [PATCH] Coccinelle: zalloc-simple: Fix patch mode for dma_alloc_coherent()

2020-04-07 Thread Alex Dewar
On Sat, Apr 04, 2020 at 09:06:46AM +0200, Markus Elfring 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.
>
> I suggest to reconsider also the distribution of recipients for your patch
> according to the fields “Cc” and “To”.

Good point.

>
> Will the software development attention grow in a way so that further
> implementation details can be adjusted also for the mentioned SmPL script?

I'm not sure I understand what you mean. Would you mind clarifying?

Best,
Alex

>
> Regards,
> Markus
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] [PATCH] Coccinelle: zalloc_simple: Fix patch mode for dma_alloc_coherent()

2020-04-07 Thread Alex Dewar
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 
> > Signed-off-by: Alex Dewar 
> > ---
> >  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


Re: [Cocci] [PATCH] Coccinelle: zalloc_simple: Fix patch mode for dma_alloc_coherent()

2020-04-07 Thread Alex Dewar
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 
> > Signed-off-by: Alex Dewar 
> > ---
> >  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


Re: [Cocci] Coccinelle: zalloc-simple: Fix patch mode for dma_alloc_coherent()

2020-04-07 Thread Markus Elfring
>> Will the software development attention grow in a way so that further
>> implementation details can be adjusted also for the mentioned SmPL script?
>
> I'm not sure I understand what you mean. Would you mind clarifying?

You would like to a change a file for which some software development
discussions happened a while ago.
Do you get any further ideas from available information in message archives?

Julia Lawall (and me) pointed special development concerns out.

Example:
Code duplications in SmPL disjunctions
https://lore.kernel.org/cocci/alpine.DEB.2.21.2004062115000.10239@hadrien/
https://systeme.lip6.fr/pipermail/cocci/2020-April/007099.html

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