Re: [Cocci] Checking the replacement of two specific function calls

2020-06-17 Thread Markus Elfring
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 >>> >>> No, include headers for types doesn't have any impact on how many header >>>

Re: [Cocci] Checking the replacement of two specific function calls

2020-04-20 Thread Markus Elfring
> Another possibility should be taken into account for source code variations. > > SmPL script example: > @replacement@ > expression base, device1, device2, index, private; > @@ > -private->res = platform_get_resource(device1, IORESOURCE_MEM, index); > base = > - devm_ioremap_resource > +

Re: [Cocci] Checking the replacement of two specific function calls

2020-04-17 Thread Markus Elfring
>> But I have now lost track of what the semantic patch actually is, >> so I don't know what is the problem. Another possibility should be taken into account for source code variations. SmPL script example: @replacement@ expression base, device1, device2, index, private; @@ -private->res =

Re: [Cocci] Checking the replacement of two specific function calls

2020-04-17 Thread Markus Elfring
> But I have now lost track of what the semantic patch actually is, > so I don't know what is the problem. Do you find the following transformation approach easier to clarify? SmPL script: @replacement@ expression base, device, index, private; @@ -private->res = platform_get_resource(device,

Re: [Cocci] Checking the replacement of two specific function calls

2020-04-17 Thread Markus Elfring
> OK, it seems that the structure is defined in the same file so no include > options should be needed. But I have now lost track of what the > semantic patch actually is, so I don't know what is the problem. 1. Unfortunately, I needed a bit longer to become more aware of relevant differences

Re: [Cocci] Checking the replacement of two specific function calls

2020-04-16 Thread Markus Elfring
>> Would I need any extra parameters here? > > Perhaps -I options to help it find the relevant .h file. The dependencies for the data structure “device” can become also more interesting. https://elixir.bootlin.com/linux/v5.7-rc1/source/include/linux/device.h#L451

Re: [Cocci] Checking the replacement of two specific function calls

2020-04-16 Thread Julia Lawall
On Thu, 16 Apr 2020, Markus Elfring wrote: > >> Would I need any extra parameters here? > > > > Perhaps -I options to help it find the relevant .h file. > > I wonder why the relevant header files would not be found directly > from the corresponding Git repository. OK, it seems that the

Re: [Cocci] Checking the replacement of two specific function calls

2020-04-16 Thread Markus Elfring
>> Would I need any extra parameters here? > > Perhaps -I options to help it find the relevant .h file. I wonder why the relevant header files would not be found directly from the corresponding Git repository. Can a file inclusion failure become an immediate SmPL script execution error when a

Re: [Cocci] Checking the replacement of two specific function calls

2020-04-16 Thread Julia Lawall
On Thu, 16 Apr 2020, Markus Elfring wrote: > >> 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 > > > > No, include headers for types

Re: [Cocci] Checking the replacement of two specific function calls

2020-04-16 Thread Markus Elfring
> I don't think that there is any need for the * in the metavariable > declaration. I can try another SmPL script variant out also without the specification of an extra asterisk. If I test with the following source file example, a patch is generated by the Coccinelle software in the expected

Re: [Cocci] Checking the replacement of two specific function calls

2020-04-16 Thread Markus Elfring
>> 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 > > No, include headers for types doesn't have any impact on how many header > files are

Re: [Cocci] Checking the replacement of two specific function calls

2020-04-16 Thread Julia Lawall
On Thu, 16 Apr 2020, Markus Elfring wrote: > >> @replacement@ > >> expression* base, device, resource; > >> @@ > >> -resource = platform_get_resource(device, IORESOURCE_MEM, 0); > >> base = > >> - devm_ioremap_resource(>dev, resource) > >> +

Re: [Cocci] Checking the replacement of two specific function calls

2020-04-16 Thread Markus Elfring
>> @replacement@ >> expression* base, device, resource; >> @@ >> -resource = platform_get_resource(device, IORESOURCE_MEM, 0); >> base = >> - devm_ioremap_resource(>dev, resource) >> + devm_platform_get_and_ioremap_resource(device, 0, ) >> ; … >> static int rcar_i2c_probe(struct

Re: [Cocci] Checking the replacement of two specific function calls

2020-04-15 Thread Markus Elfring
>> static int rcar_i2c_probe(struct platform_device *pdev) >> { >> struct rcar_i2c_priv *priv; … >> struct device *dev = >dev; >> // deleted part >> priv->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >> >> priv->io = devm_ioremap_resource(dev, priv->res); … >> } … >

Re: [Cocci] Checking the replacement of two specific function calls

2020-04-15 Thread Julia Lawall
On Wed, 15 Apr 2020, Markus Elfring wrote: > Hello, > > I noticed the suggestion “i2c: busses: convert to > devm_platform_get_and_ioremap_resource”. > https://lore.kernel.org/linux-i2c/20200414134827.18674-1-zhengdej...@gmail.com/ > https://lore.kernel.org/patchwork/patch/1223734/ > > I got

[Cocci] Checking the replacement of two specific function calls

2020-04-15 Thread Markus Elfring
Hello, I noticed the suggestion “i2c: busses: convert to devm_platform_get_and_ioremap_resource”. https://lore.kernel.org/linux-i2c/20200414134827.18674-1-zhengdej...@gmail.com/ https://lore.kernel.org/patchwork/patch/1223734/ I got into the mood to try another script out for the semantic patch