diff options
author | Thierry Reding <thierry.reding@avionic-design.de> | 2013-01-21 05:09:25 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-25 15:21:48 -0500 |
commit | 4c271bb67c04253c1e99006eb48fb773a8fe8c0f (patch) | |
tree | 5a05de9c0bd07e0ddc29e9312fec52c3c741d041 /drivers/watchdog | |
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>
Diffstat (limited to 'drivers/watchdog')
-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) | |||
285 | return -ENODEV; | 285 | return -ENODEV; |
286 | } | 286 | } |
287 | 287 | ||
288 | ar7_wdt = devm_request_and_ioremap(&pdev->dev, ar7_regs_wdt); | 288 | ar7_wdt = devm_ioremap_resource(&pdev->dev, ar7_regs_wdt); |
289 | if (!ar7_wdt) { | 289 | if (IS_ERR(ar7_wdt)) |
290 | pr_err("could not ioremap registers\n"); | 290 | return PTR_ERR(ar7_wdt); |
291 | return -ENXIO; | ||
292 | } | ||
293 | 291 | ||
294 | vbus_clk = clk_get(NULL, "vbus"); | 292 | vbus_clk = clk_get(NULL, "vbus"); |
295 | if (IS_ERR(vbus_clk)) { | 293 | 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) | |||
301 | if (!mem) | 301 | if (!mem) |
302 | return -EINVAL; | 302 | return -EINVAL; |
303 | 303 | ||
304 | dw_wdt.regs = devm_request_and_ioremap(&pdev->dev, mem); | 304 | dw_wdt.regs = devm_ioremap_resource(&pdev->dev, mem); |
305 | if (!dw_wdt.regs) | 305 | if (IS_ERR(dw_wdt.regs)) |
306 | return -ENOMEM; | 306 | return PTR_ERR(dw_wdt.regs); |
307 | 307 | ||
308 | dw_wdt.clk = clk_get(&pdev->dev, NULL); | 308 | dw_wdt.clk = clk_get(&pdev->dev, NULL); |
309 | if (IS_ERR(dw_wdt.clk)) | 309 | 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) | |||
262 | return -ENODEV; | 262 | return -ENODEV; |
263 | } | 263 | } |
264 | 264 | ||
265 | imx2_wdt.base = devm_request_and_ioremap(&pdev->dev, res); | 265 | imx2_wdt.base = devm_ioremap_resource(&pdev->dev, res); |
266 | if (!imx2_wdt.base) { | 266 | if (IS_ERR(imx2_wdt.base)) |
267 | dev_err(&pdev->dev, "ioremap failed\n"); | 267 | return PTR_ERR(imx2_wdt.base); |
268 | return -ENOMEM; | ||
269 | } | ||
270 | 268 | ||
271 | imx2_wdt.clk = clk_get(&pdev->dev, NULL); | 269 | imx2_wdt.clk = clk_get(&pdev->dev, NULL); |
272 | if (IS_ERR(imx2_wdt.clk)) { | 270 | 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) | |||
171 | watchdog_set_drvdata(jz4740_wdt, drvdata); | 171 | watchdog_set_drvdata(jz4740_wdt, drvdata); |
172 | 172 | ||
173 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 173 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
174 | drvdata->base = devm_request_and_ioremap(&pdev->dev, res); | 174 | drvdata->base = devm_ioremap_resource(&pdev->dev, res); |
175 | if (drvdata->base == NULL) { | 175 | if (IS_ERR(drvdata->base)) { |
176 | ret = -EBUSY; | 176 | ret = PTR_ERR(drvdata->base); |
177 | goto err_out; | 177 | goto err_out; |
178 | } | 178 | } |
179 | 179 | ||
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) | |||
197 | return -ENOENT; | 197 | return -ENOENT; |
198 | } | 198 | } |
199 | 199 | ||
200 | ltq_wdt_membase = devm_request_and_ioremap(&pdev->dev, res); | 200 | ltq_wdt_membase = devm_ioremap_resource(&pdev->dev, res); |
201 | if (!ltq_wdt_membase) { | 201 | if (IS_ERR(ltq_wdt_membase)) |
202 | dev_err(&pdev->dev, "cannot remap I/O memory region\n"); | 202 | return PTR_ERR(ltq_wdt_membase); |
203 | return -ENOMEM; | ||
204 | } | ||
205 | 203 | ||
206 | /* we do not need to enable the clock as it is always running */ | 204 | /* we do not need to enable the clock as it is always running */ |
207 | clk = clk_get_io(); | 205 | 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 @@ | |||
14 | * another interface, some abstraction will have to be introduced. | 14 | * another interface, some abstraction will have to be introduced. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/err.h> | ||
17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
18 | #include <linux/moduleparam.h> | 19 | #include <linux/moduleparam.h> |
19 | #include <linux/types.h> | 20 | #include <linux/types.h> |
@@ -198,9 +199,9 @@ static int max63xx_wdt_probe(struct platform_device *pdev) | |||
198 | heartbeat = current_timeout->twd; | 199 | heartbeat = current_timeout->twd; |
199 | 200 | ||
200 | wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 201 | wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
201 | wdt_base = devm_request_and_ioremap(&pdev->dev, wdt_mem); | 202 | wdt_base = devm_ioremap_resource(&pdev->dev, wdt_mem); |
202 | if (!wdt_base) | 203 | if (IS_ERR(wdt_base)) |
203 | return -ENOMEM; | 204 | return PTR_ERR(wdt_base); |
204 | 205 | ||
205 | max63xx_wdt_dev.timeout = heartbeat; | 206 | max63xx_wdt_dev.timeout = heartbeat; |
206 | watchdog_set_nowayout(&max63xx_wdt_dev, nowayout); | 207 | 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) | |||
155 | heartbeat = DEFAULT_HEARTBEAT; | 155 | heartbeat = DEFAULT_HEARTBEAT; |
156 | 156 | ||
157 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 157 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
158 | wdt_base = devm_request_and_ioremap(&pdev->dev, r); | 158 | wdt_base = devm_ioremap_resource(&pdev->dev, r); |
159 | if (!wdt_base) | 159 | if (IS_ERR(wdt_base)) |
160 | return -EADDRINUSE; | 160 | return PTR_ERR(wdt_base); |
161 | 161 | ||
162 | wdt_clk = clk_get(&pdev->dev, NULL); | 162 | wdt_clk = clk_get(&pdev->dev, NULL); |
163 | if (IS_ERR(wdt_clk)) | 163 | 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) | |||
121 | } | 121 | } |
122 | 122 | ||
123 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | 123 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
124 | txx9wdt_reg = devm_request_and_ioremap(&dev->dev, res); | 124 | txx9wdt_reg = devm_ioremap_resource(&dev->dev, res); |
125 | if (!txx9wdt_reg) { | 125 | if (IS_ERR(txx9wdt_reg)) { |
126 | ret = -EBUSY; | 126 | ret = PTR_ERR(txx9wdt_reg); |
127 | goto exit; | 127 | goto exit; |
128 | } | 128 | } |
129 | 129 | ||