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

* [PATCH 2/2] gpio: pl061: Use devm_ioremap_resource()
  2014-02-12  2:51 [PATCH 1/2] gpio/omap: Use devm_ioremap_resource() Jingoo Han
@ 2014-02-12  2:53 ` 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
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 8+ messages in thread
From: Jingoo Han @ 2014-02-12  2:53 UTC (permalink / raw)
  To: 'Linus Walleij'
  Cc: 'Alexandre Courbot', linux-gpio, 'Jingoo Han',
	'Baruch Siach', 'Haojian Zhuang'

Use devm_ioremap_resource() in order to make the code simpler.

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

diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index b4d4211..1d21968 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -277,14 +277,9 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
 		irq_base = 0;
 	}
 
-	if (!devm_request_mem_region(dev, adev->res.start,
-				     resource_size(&adev->res), "pl061"))
-		return -EBUSY;
-
-	chip->base = devm_ioremap(dev, adev->res.start,
-				  resource_size(&adev->res));
-	if (!chip->base)
-		return -ENOMEM;
+	chip->base = devm_ioremap_resource(dev, &adev->res);
+	if (IS_ERR(chip->base))
+		return PTR_ERR(chip->base);
 
 	spin_lock_init(&chip->lock);
 
-- 
1.7.10.4



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

* Re: [PATCH 1/2] gpio/omap: Use devm_ioremap_resource()
  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:24 ` Alexandre Courbot
  2014-02-14 21:34 ` Kevin Hilman
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Alexandre Courbot @ 2014-02-12  4:24 UTC (permalink / raw)
  To: Jingoo Han
  Cc: Linus Walleij, linux-gpio@vger.kernel.org, Santosh Shilimkar,
	Kevin Hilman

On Wed, Feb 12, 2014 at 11:51 AM, Jingoo Han <jg1.han@samsung.com> wrote:
> 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>

Got to like it when code becomes simpler.

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>

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

* Re: [PATCH 2/2] gpio: pl061: Use devm_ioremap_resource()
  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
  1 sibling, 0 replies; 8+ messages in thread
From: Alexandre Courbot @ 2014-02-12  4:25 UTC (permalink / raw)
  To: Jingoo Han
  Cc: Linus Walleij, linux-gpio@vger.kernel.org, Baruch Siach,
	Haojian Zhuang

On Wed, Feb 12, 2014 at 11:53 AM, Jingoo Han <jg1.han@samsung.com> wrote:
> Use devm_ioremap_resource() in order to make the code simpler.
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>

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

* Re: [PATCH 1/2] gpio/omap: Use devm_ioremap_resource()
  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: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
  4 siblings, 0 replies; 8+ messages in thread
From: Kevin Hilman @ 2014-02-14 21:34 UTC (permalink / raw)
  To: Jingoo Han, 'Linus Walleij'
  Cc: 'Alexandre Courbot', linux-gpio,
	'Santosh Shilimkar'

On 02/11/2014 06:51 PM, Jingoo Han wrote:
> 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>

Nice cleanup.

Acked-by: Kevin Hilman <khilman@linaro.org>

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

* Re: [PATCH 1/2] gpio/omap: Use devm_ioremap_resource()
  2014-02-12  2:51 [PATCH 1/2] gpio/omap: Use devm_ioremap_resource() Jingoo Han
                   ` (2 preceding siblings ...)
  2014-02-14 21:34 ` Kevin Hilman
@ 2014-02-14 22:55 ` Santosh Shilimkar
  2014-02-24 13:45 ` Linus Walleij
  4 siblings, 0 replies; 8+ messages in thread
From: Santosh Shilimkar @ 2014-02-14 22:55 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Linus Walleij', 'Alexandre Courbot', linux-gpio,
	'Kevin Hilman'

On Tuesday 11 February 2014 09:51 PM, Jingoo Han wrote:
> 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>
> ---
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.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);
> 


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

* Re: [PATCH 2/2] gpio: pl061: Use devm_ioremap_resource()
  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
  1 sibling, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2014-02-24 12:16 UTC (permalink / raw)
  To: Jingoo Han
  Cc: Alexandre Courbot, linux-gpio@vger.kernel.org, Baruch Siach,
	Haojian Zhuang

On Wed, Feb 12, 2014 at 3:53 AM, Jingoo Han <jg1.han@samsung.com> wrote:

> Use devm_ioremap_resource() in order to make the code simpler.
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

I rebased this with some manual intervention and applied, thanks!

Yours,
Linus Walleij

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

* Re: [PATCH 1/2] gpio/omap: Use devm_ioremap_resource()
  2014-02-12  2:51 [PATCH 1/2] gpio/omap: Use devm_ioremap_resource() Jingoo Han
                   ` (3 preceding siblings ...)
  2014-02-14 22:55 ` Santosh Shilimkar
@ 2014-02-24 13:45 ` Linus Walleij
  4 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2014-02-24 13:45 UTC (permalink / raw)
  To: Jingoo Han
  Cc: Alexandre Courbot, linux-gpio@vger.kernel.org, Santosh Shilimkar,
	Kevin Hilman

On Wed, Feb 12, 2014 at 3:51 AM, Jingoo Han <jg1.han@samsung.com> wrote:

> 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>

Patch applied with all ACKs.

Yours,
Linus Walleij

^ permalink raw reply	[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).