diff options
author | Thierry Reding <thierry.reding@avionic-design.de> | 2013-01-21 11:09:25 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-25 12:21:48 -0800 |
commit | 4c271bb67c04253c1e99006eb48fb773a8fe8c0f (patch) | |
tree | 5a05de9c0bd07e0ddc29e9312fec52c3c741d041 | |
parent | ca36b1ba8c92cbab6f6568283071262592603d59 (diff) |
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>
-rw-r--r-- | drivers/watchdog/ar7_wdt.c | 8 | ||||
-rw-r--r-- | drivers/watchdog/dw_wdt.c | 6 | ||||
-rw-r--r-- | drivers/watchdog/imx2_wdt.c | 8 | ||||
-rw-r--r-- | drivers/watchdog/jz4740_wdt.c | 6 | ||||
-rw-r--r-- | drivers/watchdog/lantiq_wdt.c | 8 | ||||
-rw-r--r-- | drivers/watchdog/max63xx_wdt.c | 7 | ||||
-rw-r--r-- | drivers/watchdog/pnx4008_wdt.c | 6 | ||||
-rw-r--r-- | drivers/watchdog/txx9wdt.c | 6 |
8 files changed, 25 insertions, 30 deletions
diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c index 3003e2a9580b..2f3cc8fb471a 100644 --- a/drivers/watchdog/ar7_wdt.c +++ b/drivers/watchdog/ar7_wdt.c @@ -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)) { diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c index a0eba3c40e25..203766989382 100644 --- a/drivers/watchdog/dw_wdt.c +++ b/drivers/watchdog/dw_wdt.c @@ -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)) diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c index bc17decc8551..ff908823688c 100644 --- a/drivers/watchdog/imx2_wdt.c +++ b/drivers/watchdog/imx2_wdt.c @@ -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)) { diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c index a61408fa0c94..1cb25f69a96d 100644 --- a/drivers/watchdog/jz4740_wdt.c +++ b/drivers/watchdog/jz4740_wdt.c @@ -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; } diff --git a/drivers/watchdog/lantiq_wdt.c b/drivers/watchdog/lantiq_wdt.c index 79fe01b42339..088fd0c9d888 100644 --- a/drivers/watchdog/lantiq_wdt.c +++ b/drivers/watchdog/lantiq_wdt.c @@ -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(); diff --git a/drivers/watchdog/max63xx_wdt.c b/drivers/watchdog/max63xx_wdt.c index 773c661723ca..cc9d328086ed 100644 --- a/drivers/watchdog/max63xx_wdt.c +++ b/drivers/watchdog/max63xx_wdt.c @@ -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); diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c index dcba5dab6c29..de1f3fa1d787 100644 --- a/drivers/watchdog/pnx4008_wdt.c +++ b/drivers/watchdog/pnx4008_wdt.c @@ -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)) diff --git a/drivers/watchdog/txx9wdt.c b/drivers/watchdog/txx9wdt.c index b04c92b1d71a..88f23c5cfddb 100644 --- a/drivers/watchdog/txx9wdt.c +++ b/drivers/watchdog/txx9wdt.c @@ -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; } |