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

Reply via email to