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

Reply via email to