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

2020-04-16 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 https://git.kernel.org/pub/scm/li

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 structur

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 spe

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 d

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

2020-04-16 Thread Markus Elfring
if (IS_ERR(priv->io)) return PTR_ERR(priv->io); } Command example: elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch use_devm_platform_get_and_ioremap_resource3.cocci ../Probe/i2c-rcar-variant-20200416.c Implementation details from the original source fi

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 inclu

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(&device->dev, resource) > >> + devm_platform_get_and_ioremap_res

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(&device->dev, resource) >> + devm_platform_get_and_ioremap_resource(device, 0, &resource) >> ; … >> static int rcar_i2c_p