[2/3] gpio: generic: replace devm_request_mem_region / devm_ioremap with devm_ioremap_resource
diff mbox

Message ID 560C594C.7090804@gmail.com
State New
Headers show

Commit Message

Heiner Kallweit Sept. 30, 2015, 9:51 p.m. UTC
Replace devm_request_mem_region / devm_ioremap with devm_ioremap_resource.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/gpio/gpio-generic.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

Comments

Linus Walleij Oct. 5, 2015, 7:15 a.m. UTC | #1
On Wed, Sep 30, 2015 at 11:51 PM, Heiner Kallweit <hkallweit1@gmail.com> wrote:

> Replace devm_request_mem_region / devm_ioremap with devm_ioremap_resource.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Edited the too long subject and applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index eefff1a..0cdbe10 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -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;
 	}