gpio: generic: modernize remapping
authorHeiner Kallweit <hkallweit1@gmail.com>
Wed, 30 Sep 2015 21:51:08 +0000 (23:51 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 5 Oct 2015 07:14:44 +0000 (09:14 +0200)
Replace devm_request_mem_region / devm_ioremap with devm_ioremap_resource.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-generic.c

index eefff1a299862fe7ae1ad0839ab1d4f2a1b36828..0cdbe104e567b386e3ac3b75d0334eadeaf0f976 100644 (file)
@@ -582,9 +582,7 @@ static void __iomem *bgpio_map(struct platform_device *pdev,
                               resource_size_t sane_sz,
                               int *err)
 {
-       struct device *dev = &pdev->dev;
        struct resource *r;
-       resource_size_t start;
        resource_size_t sz;
        void __iomem *ret;
 
@@ -602,15 +600,9 @@ static void __iomem *bgpio_map(struct platform_device *pdev,
                return NULL;
        }
 
-       start = r->start;
-       if (!devm_request_mem_region(dev, start, sz, r->name)) {
-               *err = -EBUSY;
-               return NULL;
-       }
-
-       ret = devm_ioremap(dev, start, sz);
-       if (!ret) {
-               *err = -ENOMEM;
+       ret = devm_ioremap_resource(&pdev->dev, r);
+       if (IS_ERR(ret)) {
+               *err = PTR_ERR(ret);
                return NULL;
        }