Re: [PATCH] watchdog: Convert to use devm_platform_ioremap_resource

From: Linus Walleij
Date: Wed Apr 03 2019 - 00:18:34 EST


On Wed, Apr 3, 2019 at 2:02 AM Guenter Roeck <linux@xxxxxxxxxxxx> wrote:

> Use devm_platform_ioremap_resource to reduce source code size,
> improve readability, and reduce the likelyhood of bugs.
>
> The conversion was done automatically with coccinelle using the
> following semantic patch.
>
> @r@
> identifier res, pdev;
> expression a;
> expression index;
> expression e;
> @@
>
> <+...
> - res = platform_get_resource(pdev, IORESOURCE_MEM, index);
> - a = devm_ioremap_resource(e, res);
> + a = devm_platform_ioremap_resource(pdev, index);
> ...+>
>
> @depends on r@
> identifier r.res;
> @@
> - struct resource *res;
> ... when != res
>
> @@
> identifier res, pdev;
> expression index;
> expression a;
> @@
> - struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, index);
> - a = devm_ioremap_resource(&pdev->dev, res);
> + a = devm_platform_ioremap_resource(pdev, index);
>
> Cc: Joel Stanley <joel@xxxxxxxxx>
> Cc: Nicolas Ferre <nicolas.ferre@xxxxxxxxxxxxx>
> Cc: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
> Cc: Florian Fainelli <f.fainelli@xxxxxxxxx>
> Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
> Cc: Baruch Siach <baruch@xxxxxxxxxx>
> Cc: Keguang Zhang <keguang.zhang@xxxxxxxxx>
> Cc: Vladimir Zapolskiy <vz@xxxxxxxxx>
> Cc: Kevin Hilman <khilman@xxxxxxxxxxxx>
> Cc: Matthias Brugger <matthias.bgg@xxxxxxxxx>
> Cc: Avi Fishman <avifishman70@xxxxxxxxx>
> Cc: Nancy Yuen <yuenn@xxxxxxxxxx>
> Cc: Brendan Higgins <brendanhiggins@xxxxxxxxxx>
> Cc: Wan ZongShun <mcuos.com@xxxxxxxxx>
> Cc: Michal Simek <michal.simek@xxxxxxxxxx>
> Cc: Sylvain Lemieux <slemieux.tyco@xxxxxxxxx>
> Cc: Kukjin Kim <kgene@xxxxxxxxxx>
> Cc: Barry Song <baohua@xxxxxxxxxx>
> Cc: Orson Zhai <orsonzhai@xxxxxxxxx>
> Cc: Patrice Chotard <patrice.chotard@xxxxxx>
> Cc: Maxime Coquelin <mcoquelin.stm32@xxxxxxxxx>
> Cc: Maxime Ripard <maxime.ripard@xxxxxxxxxxx>
> Cc: Chen-Yu Tsai <wens@xxxxxxxx>
> Cc: Marc Gonzalez <marc.w.gonzalez@xxxxxxx>
> Cc: Thierry Reding <thierry.reding@xxxxxxxxx>
> Cc: Shawn Guo <shawnguo@xxxxxxxxxx>
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>

Nice Cocinelle work!!
Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

Yours,
Linus Walleij