linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] gpio/omap: Use devm_ioremap_resource()
@ 2014-02-12  2:51 Jingoo Han
  2014-02-12  2:53 ` [PATCH 2/2] gpio: pl061: " Jingoo Han
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Jingoo Han @ 2014-02-12  2:51 UTC (permalink / raw)
  To: 'Linus Walleij'
  Cc: 'Alexandre Courbot', linux-gpio,
	'Santosh Shilimkar', 'Kevin Hilman',
	'Jingoo Han'

Use devm_ioremap_resource() in order to make the code simpler,
and remove redundant return value check of platform_get_resource()
because the value is checked by devm_ioremap_resource().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/gpio/gpio-omap.c |   20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 4243190..19b886c 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1214,24 +1214,10 @@ static int omap_gpio_probe(struct platform_device *pdev)
 
 	/* Static mapping, never released */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (unlikely(!res)) {
-		dev_err(dev, "Invalid mem resource\n");
-		irq_domain_remove(bank->domain);
-		return -ENODEV;
-	}
-
-	if (!devm_request_mem_region(dev, res->start, resource_size(res),
-				     pdev->name)) {
-		dev_err(dev, "Region already claimed\n");
+	bank->base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(bank->base)) {
 		irq_domain_remove(bank->domain);
-		return -EBUSY;
-	}
-
-	bank->base = devm_ioremap(dev, res->start, resource_size(res));
-	if (!bank->base) {
-		dev_err(dev, "Could not ioremap\n");
-		irq_domain_remove(bank->domain);
-		return -ENOMEM;
+		return PTR_ERR(bank->base);
 	}
 
 	platform_set_drvdata(pdev, bank);
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-02-24 13:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-12  2:51 [PATCH 1/2] gpio/omap: Use devm_ioremap_resource() Jingoo Han
2014-02-12  2:53 ` [PATCH 2/2] gpio: pl061: " Jingoo Han
2014-02-12  4:25   ` Alexandre Courbot
2014-02-24 12:16   ` Linus Walleij
2014-02-12  4:24 ` [PATCH 1/2] gpio/omap: " Alexandre Courbot
2014-02-14 21:34 ` Kevin Hilman
2014-02-14 22:55 ` Santosh Shilimkar
2014-02-24 13:45 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).