From 0f0a6a285ec0c7b0ac0b532f87a784605322f9ce Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Tue, 2 Apr 2019 12:01:53 -0700 Subject: watchdog: Convert to use devm_platform_ioremap_resource 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 Cc: Nicolas Ferre Cc: Alexandre Belloni Cc: Florian Fainelli Cc: Linus Walleij Cc: Baruch Siach Cc: Keguang Zhang Cc: Vladimir Zapolskiy Cc: Kevin Hilman Cc: Matthias Brugger Cc: Avi Fishman Cc: Nancy Yuen Cc: Brendan Higgins Cc: Wan ZongShun Cc: Michal Simek Cc: Sylvain Lemieux Cc: Kukjin Kim Cc: Barry Song Cc: Orson Zhai Cc: Patrice Chotard Cc: Maxime Coquelin Cc: Maxime Ripard Cc: Chen-Yu Tsai Cc: Marc Gonzalez Cc: Thierry Reding Cc: Shawn Guo Signed-off-by: Guenter Roeck Acked-by: Alexandre Belloni Tested-by: Alexandre Belloni Acked-by: Joel Stanley Reviewed-by: Linus Walleij Acked-by: Maxime Ripard Acked-by: Michal Simek (cadence/xilinx wdts) Acked-by: Thierry Reding Reviewed-by: Florian Fainelli Acked-by: Patrice Chotard Acked-by: Vladimir Zapolskiy Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/moxart_wdt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/watchdog/moxart_wdt.c') diff --git a/drivers/watchdog/moxart_wdt.c b/drivers/watchdog/moxart_wdt.c index 430c3ab84c07..740215a247fc 100644 --- a/drivers/watchdog/moxart_wdt.c +++ b/drivers/watchdog/moxart_wdt.c @@ -92,7 +92,6 @@ static int moxart_wdt_probe(struct platform_device *pdev) struct moxart_wdt_dev *moxart_wdt; struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; - struct resource *res; struct clk *clk; int err; unsigned int max_timeout; @@ -104,8 +103,7 @@ static int moxart_wdt_probe(struct platform_device *pdev) platform_set_drvdata(pdev, moxart_wdt); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - moxart_wdt->base = devm_ioremap_resource(dev, res); + moxart_wdt->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(moxart_wdt->base)) return PTR_ERR(moxart_wdt->base); -- cgit