From: Julia Lawall <julia.lawall@lip6.fr>
To: zhong jiang <zhongjiang@huawei.com>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>,
nicolas.palix@imag.fr, michal.lkml@markovi.net,
himanshujha199640@gmail.com, yamada.masahiro@socionext.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Coccinelle: remove pci_alloc_consistent semantic to dectect in zalloc-simple.cocci
Date: Sat, 18 Aug 2018 14:19:46 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.1808181419230.2365@hadrien> (raw)
In-Reply-To: <1534593700-3036-1-git-send-email-zhongjiang@huawei.com>
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
>
>
next prev parent reply other threads:[~2018-08-18 12:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-18 12:01 zhong jiang
2018-08-18 12:19 ` Julia Lawall [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.21.1808181419230.2365@hadrien \
--to=julia.lawall@lip6.fr \
--cc=Gilles.Muller@lip6.fr \
--cc=himanshujha199640@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=nicolas.palix@imag.fr \
--cc=yamada.masahiro@socionext.com \
--cc=zhongjiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®