Commit 6bdbc1f7 authored by Paul Cercueil's avatar Paul Cercueil Committed by James Hogan

watchdog: JZ4740: Use devm_* functions

- Use devm_clk_get instead of clk_get
- Use devm_watchdog_register_device instead of watchdog_register_device
Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: Mathieu Malaterre <malat@debian.org>
Cc: linux-watchdog@vger.kernel.org
Cc: linux-mips@linux-mips.org
Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
parent 212c1054
...@@ -179,40 +179,29 @@ static int jz4740_wdt_probe(struct platform_device *pdev) ...@@ -179,40 +179,29 @@ static int jz4740_wdt_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
drvdata->base = devm_ioremap_resource(&pdev->dev, res); drvdata->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(drvdata->base)) { if (IS_ERR(drvdata->base))
ret = PTR_ERR(drvdata->base); return PTR_ERR(drvdata->base);
goto err_out;
}
drvdata->rtc_clk = clk_get(&pdev->dev, "rtc"); drvdata->rtc_clk = devm_clk_get(&pdev->dev, "rtc");
if (IS_ERR(drvdata->rtc_clk)) { if (IS_ERR(drvdata->rtc_clk)) {
dev_err(&pdev->dev, "cannot find RTC clock\n"); dev_err(&pdev->dev, "cannot find RTC clock\n");
ret = PTR_ERR(drvdata->rtc_clk); return PTR_ERR(drvdata->rtc_clk);
goto err_out;
} }
ret = watchdog_register_device(&drvdata->wdt); ret = devm_watchdog_register_device(&pdev->dev, &drvdata->wdt);
if (ret < 0) if (ret < 0)
goto err_disable_clk; return ret;
platform_set_drvdata(pdev, drvdata); platform_set_drvdata(pdev, drvdata);
return 0;
err_disable_clk: return 0;
clk_put(drvdata->rtc_clk);
err_out:
return ret;
} }
static int jz4740_wdt_remove(struct platform_device *pdev) static int jz4740_wdt_remove(struct platform_device *pdev)
{ {
struct jz4740_wdt_drvdata *drvdata = platform_get_drvdata(pdev); struct jz4740_wdt_drvdata *drvdata = platform_get_drvdata(pdev);
jz4740_wdt_stop(&drvdata->wdt); return jz4740_wdt_stop(&drvdata->wdt);
watchdog_unregister_device(&drvdata->wdt);
clk_put(drvdata->rtc_clk);
return 0;
} }
static struct platform_driver jz4740_wdt_driver = { static struct platform_driver jz4740_wdt_driver = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment