watchdog: Convert to devm_ioremap_resource()
Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling. devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Cc: Wim Van Sebroeck <wim@iguana.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ca36b1ba8c
commit
4c271bb67c
8 changed files with 25 additions and 30 deletions
|
@ -285,11 +285,9 @@ static int ar7_wdt_probe(struct platform_device *pdev)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
ar7_wdt = devm_request_and_ioremap(&pdev->dev, ar7_regs_wdt);
|
||||
if (!ar7_wdt) {
|
||||
pr_err("could not ioremap registers\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
ar7_wdt = devm_ioremap_resource(&pdev->dev, ar7_regs_wdt);
|
||||
if (IS_ERR(ar7_wdt))
|
||||
return PTR_ERR(ar7_wdt);
|
||||
|
||||
vbus_clk = clk_get(NULL, "vbus");
|
||||
if (IS_ERR(vbus_clk)) {
|
||||
|
|
|
@ -301,9 +301,9 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
|
|||
if (!mem)
|
||||
return -EINVAL;
|
||||
|
||||
dw_wdt.regs = devm_request_and_ioremap(&pdev->dev, mem);
|
||||
if (!dw_wdt.regs)
|
||||
return -ENOMEM;
|
||||
dw_wdt.regs = devm_ioremap_resource(&pdev->dev, mem);
|
||||
if (IS_ERR(dw_wdt.regs))
|
||||
return PTR_ERR(dw_wdt.regs);
|
||||
|
||||
dw_wdt.clk = clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(dw_wdt.clk))
|
||||
|
|
|
@ -262,11 +262,9 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
imx2_wdt.base = devm_request_and_ioremap(&pdev->dev, res);
|
||||
if (!imx2_wdt.base) {
|
||||
dev_err(&pdev->dev, "ioremap failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
imx2_wdt.base = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(imx2_wdt.base))
|
||||
return PTR_ERR(imx2_wdt.base);
|
||||
|
||||
imx2_wdt.clk = clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(imx2_wdt.clk)) {
|
||||
|
|
|
@ -171,9 +171,9 @@ static int jz4740_wdt_probe(struct platform_device *pdev)
|
|||
watchdog_set_drvdata(jz4740_wdt, drvdata);
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
drvdata->base = devm_request_and_ioremap(&pdev->dev, res);
|
||||
if (drvdata->base == NULL) {
|
||||
ret = -EBUSY;
|
||||
drvdata->base = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(drvdata->base)) {
|
||||
ret = PTR_ERR(drvdata->base);
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
|
|
|
@ -197,11 +197,9 @@ ltq_wdt_probe(struct platform_device *pdev)
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
ltq_wdt_membase = devm_request_and_ioremap(&pdev->dev, res);
|
||||
if (!ltq_wdt_membase) {
|
||||
dev_err(&pdev->dev, "cannot remap I/O memory region\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
ltq_wdt_membase = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(ltq_wdt_membase))
|
||||
return PTR_ERR(ltq_wdt_membase);
|
||||
|
||||
/* we do not need to enable the clock as it is always running */
|
||||
clk = clk_get_io();
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* another interface, some abstraction will have to be introduced.
|
||||
*/
|
||||
|
||||
#include <linux/err.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/types.h>
|
||||
|
@ -198,9 +199,9 @@ static int max63xx_wdt_probe(struct platform_device *pdev)
|
|||
heartbeat = current_timeout->twd;
|
||||
|
||||
wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
wdt_base = devm_request_and_ioremap(&pdev->dev, wdt_mem);
|
||||
if (!wdt_base)
|
||||
return -ENOMEM;
|
||||
wdt_base = devm_ioremap_resource(&pdev->dev, wdt_mem);
|
||||
if (IS_ERR(wdt_base))
|
||||
return PTR_ERR(wdt_base);
|
||||
|
||||
max63xx_wdt_dev.timeout = heartbeat;
|
||||
watchdog_set_nowayout(&max63xx_wdt_dev, nowayout);
|
||||
|
|
|
@ -155,9 +155,9 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
|
|||
heartbeat = DEFAULT_HEARTBEAT;
|
||||
|
||||
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
wdt_base = devm_request_and_ioremap(&pdev->dev, r);
|
||||
if (!wdt_base)
|
||||
return -EADDRINUSE;
|
||||
wdt_base = devm_ioremap_resource(&pdev->dev, r);
|
||||
if (IS_ERR(wdt_base))
|
||||
return PTR_ERR(wdt_base);
|
||||
|
||||
wdt_clk = clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(wdt_clk))
|
||||
|
|
|
@ -121,9 +121,9 @@ static int __init txx9wdt_probe(struct platform_device *dev)
|
|||
}
|
||||
|
||||
res = platform_get_resource(dev, IORESOURCE_MEM, 0);
|
||||
txx9wdt_reg = devm_request_and_ioremap(&dev->dev, res);
|
||||
if (!txx9wdt_reg) {
|
||||
ret = -EBUSY;
|
||||
txx9wdt_reg = devm_ioremap_resource(&dev->dev, res);
|
||||
if (IS_ERR(txx9wdt_reg)) {
|
||||
ret = PTR_ERR(txx9wdt_reg);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue