watchdog: sp805_wdt: Use devm_ioremap_resource()
authorJingoo Han <jg1.han@samsung.com>
Tue, 11 Feb 2014 12:45:56 +0000 (21:45 +0900)
committerWim Van Sebroeck <wim@iguana.be>
Mon, 31 Mar 2014 11:24:57 +0000 (13:24 +0200)
Use devm_ioremap_resource() in order to make the code simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
drivers/watchdog/sp805_wdt.c

index 9a645d6c9d96af385e727080fd532923ec318343..47629d268e0a674a74899a8c620dc128476508ea 100644 (file)
@@ -208,26 +208,15 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
        struct sp805_wdt *wdt;
        int ret = 0;
 
-       if (!devm_request_mem_region(&adev->dev, adev->res.start,
-                               resource_size(&adev->res), "sp805_wdt")) {
-               dev_warn(&adev->dev, "Failed to get memory region resource\n");
-               ret = -ENOENT;
-               goto err;
-       }
-
        wdt = devm_kzalloc(&adev->dev, sizeof(*wdt), GFP_KERNEL);
        if (!wdt) {
                ret = -ENOMEM;
                goto err;
        }
 
-       wdt->base = devm_ioremap(&adev->dev, adev->res.start,
-                       resource_size(&adev->res));
-       if (!wdt->base) {
-               ret = -ENOMEM;
-               dev_warn(&adev->dev, "ioremap fail\n");
-               goto err;
-       }
+       wdt->base = devm_ioremap_resource(&adev->dev, &adev->res);
+       if (IS_ERR(wdt->base))
+               return PTR_ERR(wdt->base);
 
        wdt->clk = devm_clk_get(&adev->dev, NULL);
        if (IS_ERR(wdt->clk)) {