aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2013-03-04 00:06:41 -0500
committerWim Van Sebroeck <wim@iguana.be>2013-05-09 02:12:00 -0400
commit6330c7070be6783b82025d2bc259db8413c00182 (patch)
tree32ef8ae643db47f6c8176b15ae22094b58fefa8c
parente0fd9affeb64088eff407dfc98bbd3a5c17ea479 (diff)
watchdog: Convert to devm_ioremap_resource()
Use the newly introduced devm_ioremap_resource() instead of devm_request_and_ioremap() 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: Sachin Kamat <sachin.kamat@linaro.org> Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de> Cc: Gabor Juhos <juhosg@openwrt.org> Cc: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r--drivers/watchdog/ath79_wdt.c8
-rw-r--r--drivers/watchdog/davinci_wdt.c9
-rw-r--r--drivers/watchdog/s3c2410_wdt.c7
-rw-r--r--drivers/watchdog/shwdt.c7
4 files changed, 14 insertions, 17 deletions
diff --git a/drivers/watchdog/ath79_wdt.c b/drivers/watchdog/ath79_wdt.c
index 898799074a13..d184c48a0482 100644
--- a/drivers/watchdog/ath79_wdt.c
+++ b/drivers/watchdog/ath79_wdt.c
@@ -253,11 +253,9 @@ static int ath79_wdt_probe(struct platform_device *pdev)
253 return -EINVAL; 253 return -EINVAL;
254 } 254 }
255 255
256 wdt_base = devm_request_and_ioremap(&pdev->dev, res); 256 wdt_base = devm_ioremap_resource(&pdev->dev, res);
257 if (!wdt_base) { 257 if (IS_ERR(wdt_base))
258 dev_err(&pdev->dev, "unable to remap memory region\n"); 258 return PTR_ERR(wdt_base);
259 return -ENOMEM;
260 }
261 259
262 wdt_clk = devm_clk_get(&pdev->dev, "wdt"); 260 wdt_clk = devm_clk_get(&pdev->dev, "wdt");
263 if (IS_ERR(wdt_clk)) 261 if (IS_ERR(wdt_clk))
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index 7df1fdca9e78..100d4fbfde2a 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -27,6 +27,7 @@
27#include <linux/device.h> 27#include <linux/device.h>
28#include <linux/clk.h> 28#include <linux/clk.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/err.h>
30 31
31#define MODULE_NAME "DAVINCI-WDT: " 32#define MODULE_NAME "DAVINCI-WDT: "
32 33
@@ -221,11 +222,9 @@ static int davinci_wdt_probe(struct platform_device *pdev)
221 return -ENOENT; 222 return -ENOENT;
222 } 223 }
223 224
224 wdt_base = devm_request_and_ioremap(dev, wdt_mem); 225 wdt_base = devm_ioremap_resource(dev, wdt_mem);
225 if (!wdt_base) { 226 if (IS_ERR(wdt_base))
226 dev_err(dev, "ioremap failed\n"); 227 return PTR_ERR(wdt_base);
227 return -EADDRNOTAVAIL;
228 }
229 228
230 ret = misc_register(&davinci_wdt_miscdev); 229 ret = misc_register(&davinci_wdt_miscdev);
231 if (ret < 0) { 230 if (ret < 0) {
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index c1a221cbeae4..ee03135f5abd 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -330,10 +330,9 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
330 } 330 }
331 331
332 /* get the memory region for the watchdog timer */ 332 /* get the memory region for the watchdog timer */
333 wdt_base = devm_request_and_ioremap(dev, wdt_mem); 333 wdt_base = devm_ioremap_resource(dev, wdt_mem);
334 if (wdt_base == NULL) { 334 if (IS_ERR(wdt_base)) {
335 dev_err(dev, "failed to devm_request_and_ioremap() region\n"); 335 ret = PTR_ERR(wdt_base);
336 ret = -ENOMEM;
337 goto err; 336 goto err;
338 } 337 }
339 338
diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c
index 6a89e4045fbd..6185af2b3310 100644
--- a/drivers/watchdog/shwdt.c
+++ b/drivers/watchdog/shwdt.c
@@ -34,6 +34,7 @@
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/io.h> 35#include <linux/io.h>
36#include <linux/clk.h> 36#include <linux/clk.h>
37#include <linux/err.h>
37#include <asm/watchdog.h> 38#include <asm/watchdog.h>
38 39
39#define DRV_NAME "sh-wdt" 40#define DRV_NAME "sh-wdt"
@@ -249,9 +250,9 @@ static int sh_wdt_probe(struct platform_device *pdev)
249 wdt->clk = NULL; 250 wdt->clk = NULL;
250 } 251 }
251 252
252 wdt->base = devm_request_and_ioremap(wdt->dev, res); 253 wdt->base = devm_ioremap_resource(wdt->dev, res);
253 if (unlikely(!wdt->base)) { 254 if (IS_ERR(wdt->base)) {
254 rc = -EADDRNOTAVAIL; 255 rc = PTR_ERR(wdt->base);
255 goto err; 256 goto err;
256 } 257 }
257 258