All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Coccinelle: Update and rename api/alloc/pci_free_consistent.cocci
@ 2021-06-16 19:24 ` Christophe JAILLET
  0 siblings, 0 replies; 9+ messages in thread
From: Christophe JAILLET @ 2021-06-16 19:24 UTC (permalink / raw)
  To: Julia.Lawall, Gilles.Muller, nicolas.palix, michal.lkml
  Cc: cocci, linux-kernel, kernel-janitors, Christophe JAILLET

'pci_alloc_consistent()' is about to be removed from the kernel.
It is now more useful to check for dma_alloc_coherent/dma_free_coherent.

So change the script accordingly and rename it.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Not sure that the script works.
There are 718 'dma_alloc_coherent' calls in 5.13-rc6. It is surprising
to have no match at all, not even a single false positive.
---
 ..._consistent.cocci => dma_free_coherent.cocci} | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
 rename scripts/coccinelle/free/{pci_free_consistent.cocci => dma_free_coherent.cocci} (52%)

diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/dma_free_coherent.cocci
similarity index 52%
rename from scripts/coccinelle/free/pci_free_consistent.cocci
rename to scripts/coccinelle/free/dma_free_coherent.cocci
index d51e92556b42..75f159e7b6d7 100644
--- a/scripts/coccinelle/free/pci_free_consistent.cocci
+++ b/scripts/coccinelle/free/dma_free_coherent.cocci
@@ -1,10 +1,10 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/// Find missing pci_free_consistent for every pci_alloc_consistent.
+/// Find missing dma_free_coherent for every dma_alloc_coherent.
 ///
 // Confidence: Moderate
 // Copyright: (C) 2013 Petr Strnad.
 // URL: http://coccinelle.lip6.fr/
-// Keywords: pci_free_consistent, pci_alloc_consistent
+// Keywords: dma_free_coherent, dma_alloc_coherent
 // Options: --no-includes --include-headers
 
 virtual report
@@ -17,12 +17,12 @@ position p1,p2;
 type T;
 @@
 
-id = pci_alloc_consistent@p1(x,y,&z)
+id = dma_alloc_coherent@p1(x,y,&z)
 ... when != e = id
 if (id == NULL || ...) { ... return ...; }
-... when != pci_free_consistent(x,y,id,z)
-    when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
-    when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
+... when != dma_free_coherent(x,y,id,z)
+    when != if (id) { ... dma_free_coherent(x,y,id,z) ... }
+    when != if (y) { ... dma_free_coherent(x,y,id,z) ... }
     when != e = (T)id
     when exists
 (
@@ -40,7 +40,7 @@ p1 << search.p1;
 p2 << search.p2;
 @@
 
-msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
+msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
 coccilib.report.print_report(p2[0],msg)
 
 @script:python depends on org@
@@ -48,6 +48,6 @@ p1 << search.p1;
 p2 << search.p2;
 @@
 
-msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
+msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
 cocci.print_main(msg,p1)
 cocci.print_secs("",p2)
-- 
2.30.2


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

* [Cocci] [PATCH] Coccinelle: Update and rename api/alloc/pci_free_consistent.cocci
@ 2021-06-16 19:24 ` Christophe JAILLET
  0 siblings, 0 replies; 9+ messages in thread
From: Christophe JAILLET @ 2021-06-16 19:24 UTC (permalink / raw)
  To: Julia.Lawall, Gilles.Muller, nicolas.palix, michal.lkml
  Cc: Christophe JAILLET, kernel-janitors, cocci, linux-kernel

'pci_alloc_consistent()' is about to be removed from the kernel.
It is now more useful to check for dma_alloc_coherent/dma_free_coherent.

So change the script accordingly and rename it.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Not sure that the script works.
There are 718 'dma_alloc_coherent' calls in 5.13-rc6. It is surprising
to have no match at all, not even a single false positive.
---
 ..._consistent.cocci => dma_free_coherent.cocci} | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
 rename scripts/coccinelle/free/{pci_free_consistent.cocci => dma_free_coherent.cocci} (52%)

diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/dma_free_coherent.cocci
similarity index 52%
rename from scripts/coccinelle/free/pci_free_consistent.cocci
rename to scripts/coccinelle/free/dma_free_coherent.cocci
index d51e92556b42..75f159e7b6d7 100644
--- a/scripts/coccinelle/free/pci_free_consistent.cocci
+++ b/scripts/coccinelle/free/dma_free_coherent.cocci
@@ -1,10 +1,10 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/// Find missing pci_free_consistent for every pci_alloc_consistent.
+/// Find missing dma_free_coherent for every dma_alloc_coherent.
 ///
 // Confidence: Moderate
 // Copyright: (C) 2013 Petr Strnad.
 // URL: http://coccinelle.lip6.fr/
-// Keywords: pci_free_consistent, pci_alloc_consistent
+// Keywords: dma_free_coherent, dma_alloc_coherent
 // Options: --no-includes --include-headers
 
 virtual report
@@ -17,12 +17,12 @@ position p1,p2;
 type T;
 @@
 
-id = pci_alloc_consistent@p1(x,y,&z)
+id = dma_alloc_coherent@p1(x,y,&z)
 ... when != e = id
 if (id == NULL || ...) { ... return ...; }
-... when != pci_free_consistent(x,y,id,z)
-    when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
-    when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
+... when != dma_free_coherent(x,y,id,z)
+    when != if (id) { ... dma_free_coherent(x,y,id,z) ... }
+    when != if (y) { ... dma_free_coherent(x,y,id,z) ... }
     when != e = (T)id
     when exists
 (
@@ -40,7 +40,7 @@ p1 << search.p1;
 p2 << search.p2;
 @@
 
-msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
+msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
 coccilib.report.print_report(p2[0],msg)
 
 @script:python depends on org@
@@ -48,6 +48,6 @@ p1 << search.p1;
 p2 << search.p2;
 @@
 
-msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
+msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
 cocci.print_main(msg,p1)
 cocci.print_secs("",p2)
-- 
2.30.2

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

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

* Re: [PATCH] Coccinelle: Update and rename api/alloc/pci_free_consistent.cocci
  2021-06-16 19:24 ` [Cocci] " Christophe JAILLET
@ 2021-06-26 19:55   ` Julia Lawall
  -1 siblings, 0 replies; 9+ messages in thread
From: Julia Lawall @ 2021-06-26 19:55 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Julia.Lawall, Gilles.Muller, nicolas.palix, michal.lkml, cocci,
	linux-kernel, kernel-janitors



On Wed, 16 Jun 2021, Christophe JAILLET wrote:

> 'pci_alloc_consistent()' is about to be removed from the kernel.
> It is now more useful to check for dma_alloc_coherent/dma_free_coherent.

dma_alloc_coherent has four arguments, and in the script there are only
three.  Is the number of arguments to dma_alloc_coherent going to change?

julia


>
> So change the script accordingly and rename it.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Not sure that the script works.
> There are 718 'dma_alloc_coherent' calls in 5.13-rc6. It is surprising
> to have no match at all, not even a single false positive.
> ---
>  ..._consistent.cocci => dma_free_coherent.cocci} | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>  rename scripts/coccinelle/free/{pci_free_consistent.cocci => dma_free_coherent.cocci} (52%)
>
> diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/dma_free_coherent.cocci
> similarity index 52%
> rename from scripts/coccinelle/free/pci_free_consistent.cocci
> rename to scripts/coccinelle/free/dma_free_coherent.cocci
> index d51e92556b42..75f159e7b6d7 100644
> --- a/scripts/coccinelle/free/pci_free_consistent.cocci
> +++ b/scripts/coccinelle/free/dma_free_coherent.cocci
> @@ -1,10 +1,10 @@
>  // SPDX-License-Identifier: GPL-2.0-only
> -/// Find missing pci_free_consistent for every pci_alloc_consistent.
> +/// Find missing dma_free_coherent for every dma_alloc_coherent.
>  ///
>  // Confidence: Moderate
>  // Copyright: (C) 2013 Petr Strnad.
>  // URL: http://coccinelle.lip6.fr/
> -// Keywords: pci_free_consistent, pci_alloc_consistent
> +// Keywords: dma_free_coherent, dma_alloc_coherent
>  // Options: --no-includes --include-headers
>
>  virtual report
> @@ -17,12 +17,12 @@ position p1,p2;
>  type T;
>  @@
>
> -id = pci_alloc_consistent@p1(x,y,&z)
> +id = dma_alloc_coherent@p1(x,y,&z)
>  ... when != e = id
>  if (id == NULL || ...) { ... return ...; }
> -... when != pci_free_consistent(x,y,id,z)
> -    when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
> -    when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
> +... when != dma_free_coherent(x,y,id,z)
> +    when != if (id) { ... dma_free_coherent(x,y,id,z) ... }
> +    when != if (y) { ... dma_free_coherent(x,y,id,z) ... }
>      when != e = (T)id
>      when exists
>  (
> @@ -40,7 +40,7 @@ p1 << search.p1;
>  p2 << search.p2;
>  @@
>
> -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
> +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>  coccilib.report.print_report(p2[0],msg)
>
>  @script:python depends on org@
> @@ -48,6 +48,6 @@ p1 << search.p1;
>  p2 << search.p2;
>  @@
>
> -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
> +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>  cocci.print_main(msg,p1)
>  cocci.print_secs("",p2)
> --
> 2.30.2
>
>

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

* Re: [Cocci] [PATCH] Coccinelle: Update and rename api/alloc/pci_free_consistent.cocci
@ 2021-06-26 19:55   ` Julia Lawall
  0 siblings, 0 replies; 9+ messages in thread
From: Julia Lawall @ 2021-06-26 19:55 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: michal.lkml, kernel-janitors, nicolas.palix, linux-kernel, cocci



On Wed, 16 Jun 2021, Christophe JAILLET wrote:

> 'pci_alloc_consistent()' is about to be removed from the kernel.
> It is now more useful to check for dma_alloc_coherent/dma_free_coherent.

dma_alloc_coherent has four arguments, and in the script there are only
three.  Is the number of arguments to dma_alloc_coherent going to change?

julia


>
> So change the script accordingly and rename it.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Not sure that the script works.
> There are 718 'dma_alloc_coherent' calls in 5.13-rc6. It is surprising
> to have no match at all, not even a single false positive.
> ---
>  ..._consistent.cocci => dma_free_coherent.cocci} | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>  rename scripts/coccinelle/free/{pci_free_consistent.cocci => dma_free_coherent.cocci} (52%)
>
> diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/dma_free_coherent.cocci
> similarity index 52%
> rename from scripts/coccinelle/free/pci_free_consistent.cocci
> rename to scripts/coccinelle/free/dma_free_coherent.cocci
> index d51e92556b42..75f159e7b6d7 100644
> --- a/scripts/coccinelle/free/pci_free_consistent.cocci
> +++ b/scripts/coccinelle/free/dma_free_coherent.cocci
> @@ -1,10 +1,10 @@
>  // SPDX-License-Identifier: GPL-2.0-only
> -/// Find missing pci_free_consistent for every pci_alloc_consistent.
> +/// Find missing dma_free_coherent for every dma_alloc_coherent.
>  ///
>  // Confidence: Moderate
>  // Copyright: (C) 2013 Petr Strnad.
>  // URL: http://coccinelle.lip6.fr/
> -// Keywords: pci_free_consistent, pci_alloc_consistent
> +// Keywords: dma_free_coherent, dma_alloc_coherent
>  // Options: --no-includes --include-headers
>
>  virtual report
> @@ -17,12 +17,12 @@ position p1,p2;
>  type T;
>  @@
>
> -id = pci_alloc_consistent@p1(x,y,&z)
> +id = dma_alloc_coherent@p1(x,y,&z)
>  ... when != e = id
>  if (id == NULL || ...) { ... return ...; }
> -... when != pci_free_consistent(x,y,id,z)
> -    when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
> -    when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
> +... when != dma_free_coherent(x,y,id,z)
> +    when != if (id) { ... dma_free_coherent(x,y,id,z) ... }
> +    when != if (y) { ... dma_free_coherent(x,y,id,z) ... }
>      when != e = (T)id
>      when exists
>  (
> @@ -40,7 +40,7 @@ p1 << search.p1;
>  p2 << search.p2;
>  @@
>
> -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
> +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>  coccilib.report.print_report(p2[0],msg)
>
>  @script:python depends on org@
> @@ -48,6 +48,6 @@ p1 << search.p1;
>  p2 << search.p2;
>  @@
>
> -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
> +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>  cocci.print_main(msg,p1)
>  cocci.print_secs("",p2)
> --
> 2.30.2
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [PATCH] Coccinelle: Update and rename api/alloc/pci_free_consistent.cocci
  2021-06-16 19:24 ` [Cocci] " Christophe JAILLET
@ 2021-06-26 20:15   ` Julia Lawall
  -1 siblings, 0 replies; 9+ messages in thread
From: Julia Lawall @ 2021-06-26 20:15 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Julia.Lawall, Gilles.Muller, nicolas.palix, michal.lkml, cocci,
	linux-kernel, kernel-janitors



On Wed, 16 Jun 2021, Christophe JAILLET wrote:

> 'pci_alloc_consistent()' is about to be removed from the kernel.
> It is now more useful to check for dma_alloc_coherent/dma_free_coherent.
>
> So change the script accordingly and rename it.

There also seem to be a lot of false positives, where the value is used in
unexpected ways, such as:

        for (i = 0; i < nr_pages; ++i) {
                cpu_addr = dma_alloc_coherent(dma_dev, PAGE_SIZE, &dma_addr,
                                              CIO_DMA_GFP);
                if (!cpu_addr)
                        return gp_dma;
                gen_pool_add_virt(gp_dma, (unsigned long) cpu_addr,
                                  dma_addr, PAGE_SIZE, -1);
        }

Maybe the rule should be dropped?

julia

>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Not sure that the script works.
> There are 718 'dma_alloc_coherent' calls in 5.13-rc6. It is surprising
> to have no match at all, not even a single false positive.
> ---
>  ..._consistent.cocci => dma_free_coherent.cocci} | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>  rename scripts/coccinelle/free/{pci_free_consistent.cocci => dma_free_coherent.cocci} (52%)
>
> diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/dma_free_coherent.cocci
> similarity index 52%
> rename from scripts/coccinelle/free/pci_free_consistent.cocci
> rename to scripts/coccinelle/free/dma_free_coherent.cocci
> index d51e92556b42..75f159e7b6d7 100644
> --- a/scripts/coccinelle/free/pci_free_consistent.cocci
> +++ b/scripts/coccinelle/free/dma_free_coherent.cocci
> @@ -1,10 +1,10 @@
>  // SPDX-License-Identifier: GPL-2.0-only
> -/// Find missing pci_free_consistent for every pci_alloc_consistent.
> +/// Find missing dma_free_coherent for every dma_alloc_coherent.
>  ///
>  // Confidence: Moderate
>  // Copyright: (C) 2013 Petr Strnad.
>  // URL: http://coccinelle.lip6.fr/
> -// Keywords: pci_free_consistent, pci_alloc_consistent
> +// Keywords: dma_free_coherent, dma_alloc_coherent
>  // Options: --no-includes --include-headers
>
>  virtual report
> @@ -17,12 +17,12 @@ position p1,p2;
>  type T;
>  @@
>
> -id = pci_alloc_consistent@p1(x,y,&z)
> +id = dma_alloc_coherent@p1(x,y,&z)
>  ... when != e = id
>  if (id == NULL || ...) { ... return ...; }
> -... when != pci_free_consistent(x,y,id,z)
> -    when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
> -    when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
> +... when != dma_free_coherent(x,y,id,z)
> +    when != if (id) { ... dma_free_coherent(x,y,id,z) ... }
> +    when != if (y) { ... dma_free_coherent(x,y,id,z) ... }
>      when != e = (T)id
>      when exists
>  (
> @@ -40,7 +40,7 @@ p1 << search.p1;
>  p2 << search.p2;
>  @@
>
> -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
> +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>  coccilib.report.print_report(p2[0],msg)
>
>  @script:python depends on org@
> @@ -48,6 +48,6 @@ p1 << search.p1;
>  p2 << search.p2;
>  @@
>
> -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
> +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>  cocci.print_main(msg,p1)
>  cocci.print_secs("",p2)
> --
> 2.30.2
>
>

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

* Re: [Cocci] [PATCH] Coccinelle: Update and rename api/alloc/pci_free_consistent.cocci
@ 2021-06-26 20:15   ` Julia Lawall
  0 siblings, 0 replies; 9+ messages in thread
From: Julia Lawall @ 2021-06-26 20:15 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: michal.lkml, kernel-janitors, nicolas.palix, linux-kernel, cocci



On Wed, 16 Jun 2021, Christophe JAILLET wrote:

> 'pci_alloc_consistent()' is about to be removed from the kernel.
> It is now more useful to check for dma_alloc_coherent/dma_free_coherent.
>
> So change the script accordingly and rename it.

There also seem to be a lot of false positives, where the value is used in
unexpected ways, such as:

        for (i = 0; i < nr_pages; ++i) {
                cpu_addr = dma_alloc_coherent(dma_dev, PAGE_SIZE, &dma_addr,
                                              CIO_DMA_GFP);
                if (!cpu_addr)
                        return gp_dma;
                gen_pool_add_virt(gp_dma, (unsigned long) cpu_addr,
                                  dma_addr, PAGE_SIZE, -1);
        }

Maybe the rule should be dropped?

julia

>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Not sure that the script works.
> There are 718 'dma_alloc_coherent' calls in 5.13-rc6. It is surprising
> to have no match at all, not even a single false positive.
> ---
>  ..._consistent.cocci => dma_free_coherent.cocci} | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>  rename scripts/coccinelle/free/{pci_free_consistent.cocci => dma_free_coherent.cocci} (52%)
>
> diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/dma_free_coherent.cocci
> similarity index 52%
> rename from scripts/coccinelle/free/pci_free_consistent.cocci
> rename to scripts/coccinelle/free/dma_free_coherent.cocci
> index d51e92556b42..75f159e7b6d7 100644
> --- a/scripts/coccinelle/free/pci_free_consistent.cocci
> +++ b/scripts/coccinelle/free/dma_free_coherent.cocci
> @@ -1,10 +1,10 @@
>  // SPDX-License-Identifier: GPL-2.0-only
> -/// Find missing pci_free_consistent for every pci_alloc_consistent.
> +/// Find missing dma_free_coherent for every dma_alloc_coherent.
>  ///
>  // Confidence: Moderate
>  // Copyright: (C) 2013 Petr Strnad.
>  // URL: http://coccinelle.lip6.fr/
> -// Keywords: pci_free_consistent, pci_alloc_consistent
> +// Keywords: dma_free_coherent, dma_alloc_coherent
>  // Options: --no-includes --include-headers
>
>  virtual report
> @@ -17,12 +17,12 @@ position p1,p2;
>  type T;
>  @@
>
> -id = pci_alloc_consistent@p1(x,y,&z)
> +id = dma_alloc_coherent@p1(x,y,&z)
>  ... when != e = id
>  if (id == NULL || ...) { ... return ...; }
> -... when != pci_free_consistent(x,y,id,z)
> -    when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
> -    when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
> +... when != dma_free_coherent(x,y,id,z)
> +    when != if (id) { ... dma_free_coherent(x,y,id,z) ... }
> +    when != if (y) { ... dma_free_coherent(x,y,id,z) ... }
>      when != e = (T)id
>      when exists
>  (
> @@ -40,7 +40,7 @@ p1 << search.p1;
>  p2 << search.p2;
>  @@
>
> -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
> +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>  coccilib.report.print_report(p2[0],msg)
>
>  @script:python depends on org@
> @@ -48,6 +48,6 @@ p1 << search.p1;
>  p2 << search.p2;
>  @@
>
> -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
> +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>  cocci.print_main(msg,p1)
>  cocci.print_secs("",p2)
> --
> 2.30.2
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [PATCH] Coccinelle: Update and rename api/alloc/pci_free_consistent.cocci
@ 2021-06-27  4:51     ` Christophe JAILLET
  0 siblings, 0 replies; 9+ messages in thread
From: Christophe JAILLET @ 2021-06-27  4:51 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Gilles.Muller, nicolas.palix, michal.lkml, cocci, linux-kernel,
	kernel-janitors

Le 26/06/2021 à 21:55, Julia Lawall a écrit :
> 
> 
> On Wed, 16 Jun 2021, Christophe JAILLET wrote:
> 
>> 'pci_alloc_consistent()' is about to be removed from the kernel.
>> It is now more useful to check for dma_alloc_coherent/dma_free_coherent.
> 
> dma_alloc_coherent has four arguments, and in the script there are only
> three.  Is the number of arguments to dma_alloc_coherent going to change?

I don't think so.

Just a stupid "typo" from my side.

CJ

> 
> julia
> 
> 
>>
>> So change the script accordingly and rename it.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> Not sure that the script works.
>> There are 718 'dma_alloc_coherent' calls in 5.13-rc6. It is surprising
>> to have no match at all, not even a single false positive.
>> ---
>>   ..._consistent.cocci => dma_free_coherent.cocci} | 16 ++++++++--------
>>   1 file changed, 8 insertions(+), 8 deletions(-)
>>   rename scripts/coccinelle/free/{pci_free_consistent.cocci => dma_free_coherent.cocci} (52%)
>>
>> diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/dma_free_coherent.cocci
>> similarity index 52%
>> rename from scripts/coccinelle/free/pci_free_consistent.cocci
>> rename to scripts/coccinelle/free/dma_free_coherent.cocci
>> index d51e92556b42..75f159e7b6d7 100644
>> --- a/scripts/coccinelle/free/pci_free_consistent.cocci
>> +++ b/scripts/coccinelle/free/dma_free_coherent.cocci
>> @@ -1,10 +1,10 @@
>>   // SPDX-License-Identifier: GPL-2.0-only
>> -/// Find missing pci_free_consistent for every pci_alloc_consistent.
>> +/// Find missing dma_free_coherent for every dma_alloc_coherent.
>>   ///
>>   // Confidence: Moderate
>>   // Copyright: (C) 2013 Petr Strnad.
>>   // URL: http://coccinelle.lip6.fr/
>> -// Keywords: pci_free_consistent, pci_alloc_consistent
>> +// Keywords: dma_free_coherent, dma_alloc_coherent
>>   // Options: --no-includes --include-headers
>>
>>   virtual report
>> @@ -17,12 +17,12 @@ position p1,p2;
>>   type T;
>>   @@
>>
>> -id = pci_alloc_consistent@p1(x,y,&z)
>> +id = dma_alloc_coherent@p1(x,y,&z)
>>   ... when != e = id
>>   if (id == NULL || ...) { ... return ...; }
>> -... when != pci_free_consistent(x,y,id,z)
>> -    when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
>> -    when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
>> +... when != dma_free_coherent(x,y,id,z)
>> +    when != if (id) { ... dma_free_coherent(x,y,id,z) ... }
>> +    when != if (y) { ... dma_free_coherent(x,y,id,z) ... }
>>       when != e = (T)id
>>       when exists
>>   (
>> @@ -40,7 +40,7 @@ p1 << search.p1;
>>   p2 << search.p2;
>>   @@
>>
>> -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>> +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>>   coccilib.report.print_report(p2[0],msg)
>>
>>   @script:python depends on org@
>> @@ -48,6 +48,6 @@ p1 << search.p1;
>>   p2 << search.p2;
>>   @@
>>
>> -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>> +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>>   cocci.print_main(msg,p1)
>>   cocci.print_secs("",p2)
>> --
>> 2.30.2
>>
>>
> 


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

* Re: [PATCH] Coccinelle: Update and rename api/alloc/pci_free_consistent.cocci
@ 2021-06-27  4:51     ` Christophe JAILLET
  0 siblings, 0 replies; 9+ messages in thread
From: Christophe JAILLET @ 2021-06-27  4:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: cocci, kernel-janitors

Le 26/06/2021 à 21:55, Julia Lawall a écrit :
> 
> 
> On Wed, 16 Jun 2021, Christophe JAILLET wrote:
> 
>> 'pci_alloc_consistent()' is about to be removed from the kernel.
>> It is now more useful to check for dma_alloc_coherent/dma_free_coherent.
> 
> dma_alloc_coherent has four arguments, and in the script there are only
> three.  Is the number of arguments to dma_alloc_coherent going to change?

I don't think so.

Just a stupid "typo" from my side.

CJ

> 
> julia
> 
> 
>>
>> So change the script accordingly and rename it.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> Not sure that the script works.
>> There are 718 'dma_alloc_coherent' calls in 5.13-rc6. It is surprising
>> to have no match at all, not even a single false positive.
>> ---
>>   ..._consistent.cocci => dma_free_coherent.cocci} | 16 ++++++++--------
>>   1 file changed, 8 insertions(+), 8 deletions(-)
>>   rename scripts/coccinelle/free/{pci_free_consistent.cocci => dma_free_coherent.cocci} (52%)
>>
>> diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/dma_free_coherent.cocci
>> similarity index 52%
>> rename from scripts/coccinelle/free/pci_free_consistent.cocci
>> rename to scripts/coccinelle/free/dma_free_coherent.cocci
>> index d51e92556b42..75f159e7b6d7 100644
>> --- a/scripts/coccinelle/free/pci_free_consistent.cocci
>> +++ b/scripts/coccinelle/free/dma_free_coherent.cocci
>> @@ -1,10 +1,10 @@
>>   // SPDX-License-Identifier: GPL-2.0-only
>> -/// Find missing pci_free_consistent for every pci_alloc_consistent.
>> +/// Find missing dma_free_coherent for every dma_alloc_coherent.
>>   ///
>>   // Confidence: Moderate
>>   // Copyright: (C) 2013 Petr Strnad.
>>   // URL: http://coccinelle.lip6.fr/
>> -// Keywords: pci_free_consistent, pci_alloc_consistent
>> +// Keywords: dma_free_coherent, dma_alloc_coherent
>>   // Options: --no-includes --include-headers
>>
>>   virtual report
>> @@ -17,12 +17,12 @@ position p1,p2;
>>   type T;
>>   @@
>>
>> -id = pci_alloc_consistent@p1(x,y,&z)
>> +id = dma_alloc_coherent@p1(x,y,&z)
>>   ... when != e = id
>>   if (id == NULL || ...) { ... return ...; }
>> -... when != pci_free_consistent(x,y,id,z)
>> -    when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
>> -    when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
>> +... when != dma_free_coherent(x,y,id,z)
>> +    when != if (id) { ... dma_free_coherent(x,y,id,z) ... }
>> +    when != if (y) { ... dma_free_coherent(x,y,id,z) ... }
>>       when != e = (T)id
>>       when exists
>>   (
>> @@ -40,7 +40,7 @@ p1 << search.p1;
>>   p2 << search.p2;
>>   @@
>>
>> -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>> +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>>   coccilib.report.print_report(p2[0],msg)
>>
>>   @script:python depends on org@
>> @@ -48,6 +48,6 @@ p1 << search.p1;
>>   p2 << search.p2;
>>   @@
>>
>> -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>> +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>>   cocci.print_main(msg,p1)
>>   cocci.print_secs("",p2)
>> --
>> 2.30.2
>>
>>
> 



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

* Re: [Cocci] [PATCH] Coccinelle: Update and rename api/alloc/pci_free_consistent.cocci
@ 2021-06-27  4:51     ` Christophe JAILLET
  0 siblings, 0 replies; 9+ messages in thread
From: Christophe JAILLET @ 2021-06-27  4:51 UTC (permalink / raw)
  To: Julia Lawall
  Cc: michal.lkml, nicolas.palix, kernel-janitors, linux-kernel, cocci

Le 26/06/2021 à 21:55, Julia Lawall a écrit :
> 
> 
> On Wed, 16 Jun 2021, Christophe JAILLET wrote:
> 
>> 'pci_alloc_consistent()' is about to be removed from the kernel.
>> It is now more useful to check for dma_alloc_coherent/dma_free_coherent.
> 
> dma_alloc_coherent has four arguments, and in the script there are only
> three.  Is the number of arguments to dma_alloc_coherent going to change?

I don't think so.

Just a stupid "typo" from my side.

CJ

> 
> julia
> 
> 
>>
>> So change the script accordingly and rename it.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> Not sure that the script works.
>> There are 718 'dma_alloc_coherent' calls in 5.13-rc6. It is surprising
>> to have no match at all, not even a single false positive.
>> ---
>>   ..._consistent.cocci => dma_free_coherent.cocci} | 16 ++++++++--------
>>   1 file changed, 8 insertions(+), 8 deletions(-)
>>   rename scripts/coccinelle/free/{pci_free_consistent.cocci => dma_free_coherent.cocci} (52%)
>>
>> diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/dma_free_coherent.cocci
>> similarity index 52%
>> rename from scripts/coccinelle/free/pci_free_consistent.cocci
>> rename to scripts/coccinelle/free/dma_free_coherent.cocci
>> index d51e92556b42..75f159e7b6d7 100644
>> --- a/scripts/coccinelle/free/pci_free_consistent.cocci
>> +++ b/scripts/coccinelle/free/dma_free_coherent.cocci
>> @@ -1,10 +1,10 @@
>>   // SPDX-License-Identifier: GPL-2.0-only
>> -/// Find missing pci_free_consistent for every pci_alloc_consistent.
>> +/// Find missing dma_free_coherent for every dma_alloc_coherent.
>>   ///
>>   // Confidence: Moderate
>>   // Copyright: (C) 2013 Petr Strnad.
>>   // URL: http://coccinelle.lip6.fr/
>> -// Keywords: pci_free_consistent, pci_alloc_consistent
>> +// Keywords: dma_free_coherent, dma_alloc_coherent
>>   // Options: --no-includes --include-headers
>>
>>   virtual report
>> @@ -17,12 +17,12 @@ position p1,p2;
>>   type T;
>>   @@
>>
>> -id = pci_alloc_consistent@p1(x,y,&z)
>> +id = dma_alloc_coherent@p1(x,y,&z)
>>   ... when != e = id
>>   if (id == NULL || ...) { ... return ...; }
>> -... when != pci_free_consistent(x,y,id,z)
>> -    when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
>> -    when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
>> +... when != dma_free_coherent(x,y,id,z)
>> +    when != if (id) { ... dma_free_coherent(x,y,id,z) ... }
>> +    when != if (y) { ... dma_free_coherent(x,y,id,z) ... }
>>       when != e = (T)id
>>       when exists
>>   (
>> @@ -40,7 +40,7 @@ p1 << search.p1;
>>   p2 << search.p2;
>>   @@
>>
>> -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>> +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>>   coccilib.report.print_report(p2[0],msg)
>>
>>   @script:python depends on org@
>> @@ -48,6 +48,6 @@ p1 << search.p1;
>>   p2 << search.p2;
>>   @@
>>
>> -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>> +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
>>   cocci.print_main(msg,p1)
>>   cocci.print_secs("",p2)
>> --
>> 2.30.2
>>
>>
> 

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

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

end of thread, other threads:[~2021-06-27  8:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16 19:24 [PATCH] Coccinelle: Update and rename api/alloc/pci_free_consistent.cocci Christophe JAILLET
2021-06-16 19:24 ` [Cocci] " Christophe JAILLET
2021-06-26 19:55 ` Julia Lawall
2021-06-26 19:55   ` [Cocci] " Julia Lawall
2021-06-27  4:51   ` Christophe JAILLET
2021-06-27  4:51     ` [Cocci] " Christophe JAILLET
2021-06-27  4:51     ` Christophe JAILLET
2021-06-26 20:15 ` Julia Lawall
2021-06-26 20:15   ` [Cocci] " Julia Lawall

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.