[PATCH v3 3/6] watchdog: omap_wdt: convert request_mem_region() to devm_request_mem_region()

From: Aaro Koskinen
Date: Wed Oct 10 2012 - 16:24:12 EST


Use devm_request_mem_region() to simplify the code.

Signed-off-by: Aaro Koskinen <aaro.koskinen@xxxxxx>
---
drivers/watchdog/omap_wdt.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index d6722db..45019b0 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -217,15 +217,14 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
if (!res)
return -ENOENT;

- mem = request_mem_region(res->start, resource_size(res), pdev->name);
+ mem = devm_request_mem_region(&pdev->dev, res->start,
+ resource_size(res), pdev->name);
if (!mem)
return -EBUSY;

wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL);
- if (!wdev) {
- ret = -ENOMEM;
- goto err_kzalloc;
- }
+ if (!wdev)
+ return -ENOMEM;

omap_wdt->info = &omap_wdt_info;
omap_wdt->ops = &omap_wdt_ops;
@@ -289,9 +288,6 @@ err_misc:
err_ioremap:
wdev->base = NULL;

-err_kzalloc:
- release_mem_region(res->start, resource_size(res));
-
return ret;
}

@@ -316,7 +312,6 @@ static int __devexit omap_wdt_remove(struct platform_device *pdev)

pm_runtime_disable(wdev->dev);
watchdog_unregister_device(wdog);
- release_mem_region(res->start, resource_size(res));
platform_set_drvdata(pdev, NULL);

iounmap(wdev->base);
--
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/