All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: Dejin Zheng <zhengdejin5@gmail.com>, Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] Checking the replacement of two specific function calls
Date: Thu, 16 Apr 2020 09:12:38 +0200	[thread overview]
Message-ID: <5702b553-d054-33a4-8544-f68ed5457acc@web.de> (raw)
In-Reply-To: <alpine.DEB.2.21.2004151949230.2381@hadrien>

>> @replacement@
>> expression* base, device, resource;
>> @@
>> -resource = platform_get_resource(device, IORESOURCE_MEM, 0);
>>  base =
>> -       devm_ioremap_resource(&device->dev, resource)
>> +       devm_platform_get_and_ioremap_resource(device, 0, &resource)
>>  ;
>> static int rcar_i2c_probe(struct platform_device *pdev)
>> {
>> 	struct rcar_i2c_priv *priv;
>> 	struct device *dev = &pdev->dev;
>> 	priv->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>
>> 	priv->io = devm_ioremap_resource(dev, priv->res);
>> 	if (IS_ERR(priv->io))
>> 		return PTR_ERR(priv->io);
>> }
> Probably Coccinelle is not able to determine that priv->res and priv->io
> are pointers, if you have not given it enough encouragement to look for
> header files to find the defintion of the type of the priv structure.

Would you find the following test command encouraging enough?

elfring@Sonne:~/Projekte/Linux/next-patched> spatch --include-headers-for-types ~/Projekte/Coccinelle/janitor/use_devm_platform_get_and_ioremap_resource3.cocci drivers/i2c/busses/i2c-rcar.c


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

  parent reply	other threads:[~2020-04-16  7:13 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15 15:21 [Cocci] Checking the replacement of two specific function calls Markus Elfring
2020-04-15 17:52 ` Julia Lawall
2020-04-15 18:22   ` Markus Elfring
2020-04-16  7:12   ` Markus Elfring [this message]
2020-04-16  8:53     ` Julia Lawall
2020-04-16  9:11       ` Markus Elfring
2020-04-16 12:45         ` Julia Lawall
2020-04-16 14:15           ` Markus Elfring
2020-04-16 14:28             ` Julia Lawall
2020-04-17  6:08               ` Markus Elfring
2020-04-17 14:51               ` Markus Elfring
2020-04-17 18:56                 ` Markus Elfring
2020-04-20  6:30                   ` Markus Elfring
2020-04-16 14:30           ` Markus Elfring
2020-06-17 18:20           ` Markus Elfring
2020-04-16 12:26   ` Markus Elfring
2020-09-07 11:43 ` [Cocci] [PATCH] Coccinelle: api: Add SmPL script “use_devm_platform_get_and_ioremap_resource.cocci” Markus Elfring
2020-09-07 12:00   ` Julia Lawall
2020-09-07 12:00     ` Julia Lawall
2020-09-07 12:00     ` [Cocci] [PATCH] Coccinelle: api: Ad =?UTF-8?Q?d_SmPL_script_=E2=80=9Cu Julia Lawall
2020-09-07 13:05     ` [Cocci] [PATCH] Coccinelle: api: Add SmPL script “use_devm_platform_get_and_ioremap_resource.cocci” Markus Elfring
2020-09-07 13:11       ` Julia Lawall
2020-09-07 13:11         ` [Cocci] " Julia Lawall
2020-09-07 13:11         ` [PATCH] Coccinelle: api: Add SmPL scr =?UTF-8?Q?ipt_=E2=80=9Cuse=5Fdevm=5F Julia Lawall
     [not found]         ` <46d314d5-822e-3d73-2d70-015794556e56@web.de>
2020-09-07 13:46           ` [PATCH] Coccinelle: api: Add SmPL script “use_devm_platform_get_and_ioremap_resource.cocci” Julia Lawall
2020-09-07 13:46             ` [Cocci] " Julia Lawall
2020-09-07 13:46             ` [PATCH] Coccinelle: api: Add SmPL scr =?UTF-8?Q?ipt_=E2=80=9Cuse=5Fdevm=5F Julia Lawall
     [not found]             ` <8aaa799f-0ec4-cfd0-854a-e1006d0d200a@web.de>
2020-09-07 14:18               ` [PATCH] Coccinelle: api: Add SmPL script “use_devm_platform_get_and_ioremap_resource.cocci” Julia Lawall
2020-09-07 14:18                 ` [Cocci] " Julia Lawall
2020-09-07 14:18                 ` [PATCH] Coccinelle: api: Add SmPL scr =?UTF-8?Q?ipt_=E2=80=9Cuse=5Fdevm=5F Julia Lawall
2020-09-07 16:54   ` [Cocci] [PATCH v2] Coccinelle: api: Add SmPL script “use_devm_platform_get_and_ioremap_resource.cocci” Markus Elfring
2020-09-07 17:03     ` Julia Lawall
2020-09-07 17:03       ` Julia Lawall
2020-09-07 17:03       ` [Cocci] [PATCH v2] Coccinelle: api: =?UTF-8?Q?_Add_SmPL_script_=E2=80= Julia Lawall
     [not found]       ` <8fb7782c-538b-b657-af13-da71124e6afa@web.de>
2020-09-07 17:31         ` [PATCH v2] Coccinelle: api: Add SmPL script “use_devm_platform_get_and_ioremap_resource.cocci” Julia Lawall
2020-09-07 17:31           ` [Cocci] " Julia Lawall
2020-09-07 17:31           ` [PATCH v2] Coccinelle: api: Add SmPL =?UTF-8?Q?_script_=E2=80=9Cuse=5Fdevm Julia Lawall
     [not found]     ` <01ea8faa-6fca-a91e-2b5d-378262dcc671@web.de>
2023-01-06 13:04       ` [cocci] [PATCH v3] Coccinelle: api: Add SmPL script “use_devm_platform_get_and_ioremap_resource.cocci” Markus Elfring

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=5702b553-d054-33a4-8544-f68ed5457acc@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@inria.fr \
    --cc=zhengdejin5@gmail.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 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.