cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] Checking the replacement of two specific function calls
@ 2020-04-15 15:21 Markus Elfring
  2020-04-15 17:52 ` Julia Lawall
  2020-09-07 11:43 ` [Cocci] [PATCH] Coccinelle: api: Add SmPL script “use_devm_platform_get_and_ioremap_resource.cocci” Markus Elfring
  0 siblings, 2 replies; 26+ messages in thread
From: Markus Elfring @ 2020-04-15 15:21 UTC (permalink / raw)
  To: Coccinelle; +Cc: Dejin Zheng

Hello,

I noticed the suggestion “i2c: busses: convert to devm_platform_get_and_ioremap_resource”.
https://lore.kernel.org/linux-i2c/20200414134827.18674-1-zhengdejin5@gmail.com/
https://lore.kernel.org/patchwork/patch/1223734/

I got into the mood to try another script out for the semantic patch language.


@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)
 ;


Source file example:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/i2c/busses/i2c-rcar.c?id=8632e9b5645bbc2331d21d892b0d6961c1a08429#n921
https://elixir.bootlin.com/linux/v5.7-rc1/source/drivers/i2c/busses/i2c-rcar.c#L921

// SPDX-License-Identifier: GPL-2.0
// deleted part
static int rcar_i2c_probe(struct platform_device *pdev)
{
	struct rcar_i2c_priv *priv;
	struct i2c_adapter *adap;
	struct device *dev = &pdev->dev;
// deleted part
	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);
// deleted part
}
// deleted part


Now I wonder why the expected patch is not generated by the software
“Coccinelle 1.0.8-00029-ga549b9f0” at the moment.
How should this situation be improved?

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

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

end of thread, other threads:[~2023-01-06 13:05 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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 13:05     ` Markus Elfring
2020-09-07 13:11       ` Julia Lawall
     [not found]         ` <46d314d5-822e-3d73-2d70-015794556e56@web.de>
2020-09-07 13:46           ` Julia Lawall
     [not found]             ` <8aaa799f-0ec4-cfd0-854a-e1006d0d200a@web.de>
2020-09-07 14:18               ` Julia Lawall
2020-09-07 16:54   ` [Cocci] [PATCH v2] " Markus Elfring
2020-09-07 17:03     ` Julia Lawall
     [not found]       ` <8fb7782c-538b-b657-af13-da71124e6afa@web.de>
2020-09-07 17:31         ` Julia Lawall
     [not found]     ` <01ea8faa-6fca-a91e-2b5d-378262dcc671@web.de>
2023-01-06 13:04       ` [cocci] [PATCH v3] " Markus Elfring

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).