linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Coccinelle: remove pci_alloc_consistent semantic to dectect in zalloc-simple.cocci
@ 2018-08-18 12:01 zhong jiang
  2018-08-18 12:19 ` Julia Lawall
  2018-08-18 12:52 ` Himanshu Jha
  0 siblings, 2 replies; 7+ messages in thread
From: zhong jiang @ 2018-08-18 12:01 UTC (permalink / raw)
  To: Julia.Lawall
  Cc: Gilles.Muller, nicolas.palix, michal.lkml, himanshujha199640,
	yamada.masahiro, linux-kernel

Because pci_alloc_consistent has been deprecated. We prefer to use
dam_alloc_coherent directly. Therefore, we should remove pci_alloc_consistent
to increase the confidence.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 scripts/coccinelle/api/alloc/zalloc-simple.cocci | 41 +-----------------------
 1 file changed, 1 insertion(+), 40 deletions(-)

diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
index 92b2091..d819275 100644
--- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
+++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
@@ -35,8 +35,7 @@ statement S;
 
 * x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
   kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
-  devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\|
-  kvmalloc_node(E1,...)\);
+  devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|kvmalloc_node(E1,...)\);
   if ((x==NULL) || ...) S
 * memset((T2)x,0,E1);
 
@@ -124,15 +123,6 @@ statement S;
 - x = (T)kvmalloc(E1,E2);
 + x = (T)kvzalloc(E1,E2);
 |
-- x = pci_alloc_consistent(E2,E1,E3);
-+ x = pci_zalloc_consistent(E2,E1,E3);
-|
-- x = (T *)pci_alloc_consistent(E2,E1,E3);
-+ x = pci_zalloc_consistent(E2,E1,E3);
-|
-- x = (T)pci_alloc_consistent(E2,E1,E3);
-+ x = (T)pci_zalloc_consistent(E2,E1,E3);
-|
 - x = kvmalloc_node(E1,E2,E3);
 + x = kvzalloc_node(E1,E2,E3);
 |
@@ -389,35 +379,6 @@ msg="WARNING: kvzalloc should be used for %s, instead of kvmalloc/memset" % (x)
 coccilib.report.print_report(p[0], msg)
 
 //-----------------------------------------------------------------
-@r8 depends on org || report@
-type T, T2;
-expression x;
-expression E1,E2,E3;
-statement S;
-position p;
-@@
-
- x = (T)pci_alloc_consistent@p(E2,E1,E3);
- if ((x==NULL) || ...) S
- memset((T2)x,0,E1);
-
-@script:python depends on org@
-p << r8.p;
-x << r8.x;
-@@
-
-msg="%s" % (x)
-msg_safe=msg.replace("[","@(").replace("]",")")
-coccilib.org.print_todo(p[0], msg_safe)
-
-@script:python depends on report@
-p << r8.p;
-x << r8.x;
-@@
-
-msg="WARNING: pci_zalloc_consistent should be used for %s, instead of pci_alloc_consistent/memset" % (x)
-coccilib.report.print_report(p[0], msg)
-//-----------------------------------------------------------------
 @r9 depends on org || report@
 type T, T2;
 expression x;
-- 
1.7.12.4


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

* Re: [PATCH] Coccinelle: remove pci_alloc_consistent semantic to dectect in zalloc-simple.cocci
  2018-08-18 12:01 [PATCH] Coccinelle: remove pci_alloc_consistent semantic to dectect in zalloc-simple.cocci zhong jiang
@ 2018-08-18 12:19 ` Julia Lawall
  2018-08-18 12:52 ` Himanshu Jha
  1 sibling, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2018-08-18 12:19 UTC (permalink / raw)
  To: zhong jiang
  Cc: Gilles Muller, nicolas.palix, michal.lkml, himanshujha199640,
	yamada.masahiro, linux-kernel



On Sat, 18 Aug 2018, zhong jiang wrote:

> Because pci_alloc_consistent has been deprecated. We prefer to use
> dam_alloc_coherent directly. Therefore, we should remove pci_alloc_consistent
> to increase the confidence.
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>

Thanks for the suggestion.

Acked-by: Julia Lawall <julia.lawall@lip6.fr>

> ---
>  scripts/coccinelle/api/alloc/zalloc-simple.cocci | 41 +-----------------------
>  1 file changed, 1 insertion(+), 40 deletions(-)
>
> diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> index 92b2091..d819275 100644
> --- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> +++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> @@ -35,8 +35,7 @@ statement S;
>
>  * x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
>    kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
> -  devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\|
> -  kvmalloc_node(E1,...)\);
> +  devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|kvmalloc_node(E1,...)\);
>    if ((x==NULL) || ...) S
>  * memset((T2)x,0,E1);
>
> @@ -124,15 +123,6 @@ statement S;
>  - x = (T)kvmalloc(E1,E2);
>  + x = (T)kvzalloc(E1,E2);
>  |
> -- x = pci_alloc_consistent(E2,E1,E3);
> -+ x = pci_zalloc_consistent(E2,E1,E3);
> -|
> -- x = (T *)pci_alloc_consistent(E2,E1,E3);
> -+ x = pci_zalloc_consistent(E2,E1,E3);
> -|
> -- x = (T)pci_alloc_consistent(E2,E1,E3);
> -+ x = (T)pci_zalloc_consistent(E2,E1,E3);
> -|
>  - x = kvmalloc_node(E1,E2,E3);
>  + x = kvzalloc_node(E1,E2,E3);
>  |
> @@ -389,35 +379,6 @@ msg="WARNING: kvzalloc should be used for %s, instead of kvmalloc/memset" % (x)
>  coccilib.report.print_report(p[0], msg)
>
>  //-----------------------------------------------------------------
> -@r8 depends on org || report@
> -type T, T2;
> -expression x;
> -expression E1,E2,E3;
> -statement S;
> -position p;
> -@@
> -
> - x = (T)pci_alloc_consistent@p(E2,E1,E3);
> - if ((x==NULL) || ...) S
> - memset((T2)x,0,E1);
> -
> -@script:python depends on org@
> -p << r8.p;
> -x << r8.x;
> -@@
> -
> -msg="%s" % (x)
> -msg_safe=msg.replace("[","@(").replace("]",")")
> -coccilib.org.print_todo(p[0], msg_safe)
> -
> -@script:python depends on report@
> -p << r8.p;
> -x << r8.x;
> -@@
> -
> -msg="WARNING: pci_zalloc_consistent should be used for %s, instead of pci_alloc_consistent/memset" % (x)
> -coccilib.report.print_report(p[0], msg)
> -//-----------------------------------------------------------------
>  @r9 depends on org || report@
>  type T, T2;
>  expression x;
> --
> 1.7.12.4
>
>

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

* Re: [PATCH] Coccinelle: remove pci_alloc_consistent semantic to dectect in zalloc-simple.cocci
  2018-08-18 12:01 [PATCH] Coccinelle: remove pci_alloc_consistent semantic to dectect in zalloc-simple.cocci zhong jiang
  2018-08-18 12:19 ` Julia Lawall
@ 2018-08-18 12:52 ` Himanshu Jha
  2018-08-18 13:56   ` zhong jiang
  1 sibling, 1 reply; 7+ messages in thread
From: Himanshu Jha @ 2018-08-18 12:52 UTC (permalink / raw)
  To: zhong jiang
  Cc: Julia.Lawall, Gilles.Muller, nicolas.palix, michal.lkml,
	yamada.masahiro, linux-kernel

On Sat, Aug 18, 2018 at 08:01:40PM +0800, zhong jiang wrote:
> Because pci_alloc_consistent has been deprecated. We prefer to use
> dam_alloc_coherent directly. Therefore, we should remove pci_alloc_consistent
  ^^^ typo "dma"

Also, typo in the patch subject "dectect" -> "detect"

Otherwise,

Acked-by: Himanshu Jha <himanshujha199640@gmail.com>

Thanks for cleaning up, we still have few more *_alloc/memset
in the mainline, especially in the scsi subsystem, even after
I cleaned up with two long patch series in the past.

-- 
Himanshu Jha
Undergraduate Student
Department of Electronics & Communication
Guru Tegh Bahadur Institute of Technology

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

* Re: [PATCH] Coccinelle: remove pci_alloc_consistent semantic to dectect in zalloc-simple.cocci
  2018-08-18 12:52 ` Himanshu Jha
@ 2018-08-18 13:56   ` zhong jiang
  2018-08-18 14:01     ` Julia Lawall
  0 siblings, 1 reply; 7+ messages in thread
From: zhong jiang @ 2018-08-18 13:56 UTC (permalink / raw)
  To: Himanshu Jha
  Cc: Julia.Lawall, Gilles.Muller, nicolas.palix, michal.lkml,
	yamada.masahiro, linux-kernel

On 2018/8/18 20:52, Himanshu Jha wrote:
> On Sat, Aug 18, 2018 at 08:01:40PM +0800, zhong jiang wrote:
>> Because pci_alloc_consistent has been deprecated. We prefer to use
>> dam_alloc_coherent directly. Therefore, we should remove pci_alloc_consistent
>   ^^^ typo "dma"
>
> Also, typo in the patch subject "dectect" -> "detect"
 Thanks,  will fix it in v2.
> Otherwise,
>
> Acked-by: Himanshu Jha <himanshujha199640@gmail.com>
>
> Thanks for cleaning up, we still have few more *_alloc/memset
> in the mainline, especially in the scsi subsystem, even after
> I cleaned up with two long patch series in the past.
>
   I post same patches like *_alloc/memset in the scsi subsystem. Unfortunately,
   Maintainer maybe do not care about the change.  therefore,  None of my patches
  are received and rarely feedback.

 Thanks,
 zhong jiang


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

* Re: [PATCH] Coccinelle: remove pci_alloc_consistent semantic to dectect in zalloc-simple.cocci
  2018-08-18 13:56   ` zhong jiang
@ 2018-08-18 14:01     ` Julia Lawall
  2018-08-18 14:10       ` zhong jiang
  0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2018-08-18 14:01 UTC (permalink / raw)
  To: zhong jiang
  Cc: Himanshu Jha, Gilles Muller, nicolas.palix, michal.lkml,
	yamada.masahiro, linux-kernel



On Sat, 18 Aug 2018, zhong jiang wrote:

> On 2018/8/18 20:52, Himanshu Jha wrote:
> > On Sat, Aug 18, 2018 at 08:01:40PM +0800, zhong jiang wrote:
> >> Because pci_alloc_consistent has been deprecated. We prefer to use
> >> dam_alloc_coherent directly. Therefore, we should remove pci_alloc_consistent
> >   ^^^ typo "dma"
> >
> > Also, typo in the patch subject "dectect" -> "detect"
>  Thanks,  will fix it in v2.
> > Otherwise,
> >
> > Acked-by: Himanshu Jha <himanshujha199640@gmail.com>
> >
> > Thanks for cleaning up, we still have few more *_alloc/memset
> > in the mainline, especially in the scsi subsystem, even after
> > I cleaned up with two long patch series in the past.
> >
>    I post same patches like *_alloc/memset in the scsi subsystem. Unfortunately,
>    Maintainer maybe do not care about the change.  therefore,  None of my patches
>   are received and rarely feedback.

Maybe they will be picked up later.

julia

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

* Re: [PATCH] Coccinelle: remove pci_alloc_consistent semantic to dectect in zalloc-simple.cocci
  2018-08-18 14:01     ` Julia Lawall
@ 2018-08-18 14:10       ` zhong jiang
  2018-08-18 14:52         ` Himanshu Jha
  0 siblings, 1 reply; 7+ messages in thread
From: zhong jiang @ 2018-08-18 14:10 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Himanshu Jha, Gilles Muller, nicolas.palix, michal.lkml,
	yamada.masahiro, linux-kernel

On 2018/8/18 22:01, Julia Lawall wrote:
>
> On Sat, 18 Aug 2018, zhong jiang wrote:
>
>> On 2018/8/18 20:52, Himanshu Jha wrote:
>>> On Sat, Aug 18, 2018 at 08:01:40PM +0800, zhong jiang wrote:
>>>> Because pci_alloc_consistent has been deprecated. We prefer to use
>>>> dam_alloc_coherent directly. Therefore, we should remove pci_alloc_consistent
>>>   ^^^ typo "dma"
>>>
>>> Also, typo in the patch subject "dectect" -> "detect"
>>  Thanks,  will fix it in v2.
>>> Otherwise,
>>>
>>> Acked-by: Himanshu Jha <himanshujha199640@gmail.com>
>>>
>>> Thanks for cleaning up, we still have few more *_alloc/memset
>>> in the mainline, especially in the scsi subsystem, even after
>>> I cleaned up with two long patch series in the past.
>>>
>>    I post same patches like *_alloc/memset in the scsi subsystem. Unfortunately,
>>    Maintainer maybe do not care about the change.  therefore,  None of my patches
>>   are received and rarely feedback.
> Maybe they will be picked up later.
 Hope so.  It's been more than a month since I post the patches. Maybe I should give a kindly ping. :-)

 Thanks,
 zhong jiang 
> julia
>
> .
>



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

* Re: [PATCH] Coccinelle: remove pci_alloc_consistent semantic to dectect in zalloc-simple.cocci
  2018-08-18 14:10       ` zhong jiang
@ 2018-08-18 14:52         ` Himanshu Jha
  0 siblings, 0 replies; 7+ messages in thread
From: Himanshu Jha @ 2018-08-18 14:52 UTC (permalink / raw)
  To: zhong jiang
  Cc: Julia Lawall, Gilles Muller, nicolas.palix, michal.lkml,
	yamada.masahiro, linux-kernel

On Sat, Aug 18, 2018 at 10:10:26PM +0800, zhong jiang wrote:
> On 2018/8/18 22:01, Julia Lawall wrote:
> >
> > On Sat, 18 Aug 2018, zhong jiang wrote:
> >
> >> On 2018/8/18 20:52, Himanshu Jha wrote:
> >>> On Sat, Aug 18, 2018 at 08:01:40PM +0800, zhong jiang wrote:
> >>>> Because pci_alloc_consistent has been deprecated. We prefer to use
> >>>> dam_alloc_coherent directly. Therefore, we should remove pci_alloc_consistent
> >>>   ^^^ typo "dma"
> >>>
> >>> Also, typo in the patch subject "dectect" -> "detect"
> >>  Thanks,  will fix it in v2.
> >>> Otherwise,
> >>>
> >>> Acked-by: Himanshu Jha <himanshujha199640@gmail.com>
> >>>
> >>> Thanks for cleaning up, we still have few more *_alloc/memset
> >>> in the mainline, especially in the scsi subsystem, even after
> >>> I cleaned up with two long patch series in the past.
> >>>
> >>    I post same patches like *_alloc/memset in the scsi subsystem. Unfortunately,
> >>    Maintainer maybe do not care about the change.  therefore,  None of my patches
> >>   are received and rarely feedback.
> > Maybe they will be picked up later.
>  Hope so.  It's been more than a month since I post the patches. Maybe I should give a kindly ping. :-)

Heh! The problem is Martin only when picks up patches if the driver
maintainer Acks them, and it happens very rarely until you have
a *real* bugfix.

But since these patches are simple, so Martin should pick it up
even if the patch doesn't receive any feedback.

If you ping, then certainly Martin will give you the same feedback.

Maybe you can make them happy by sending a syzbot bugfix ;)

-- 
Himanshu Jha
Undergraduate Student
Department of Electronics & Communication
Guru Tegh Bahadur Institute of Technology

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

end of thread, other threads:[~2018-08-18 14:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-18 12:01 [PATCH] Coccinelle: remove pci_alloc_consistent semantic to dectect in zalloc-simple.cocci zhong jiang
2018-08-18 12:19 ` Julia Lawall
2018-08-18 12:52 ` Himanshu Jha
2018-08-18 13:56   ` zhong jiang
2018-08-18 14:01     ` Julia Lawall
2018-08-18 14:10       ` zhong jiang
2018-08-18 14:52         ` Himanshu Jha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).