linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: Switch to using managed resources with devm_
@ 2014-10-01 10:46 Pramod Gurav
  2014-10-05 10:28 ` Alexandre Courbot
  2014-10-21  8:52 ` Linus Walleij
  0 siblings, 2 replies; 4+ messages in thread
From: Pramod Gurav @ 2014-10-01 10:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pramod Gurav, Linus Walleij, Alexandre Courbot, linux-gpio

This change switches to devm_request_region to request region
and hence simplifies the module unload and does away with
release_region in remove function.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 drivers/gpio/gpio-cs5535.c |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/gpio/gpio-cs5535.c b/drivers/gpio/gpio-cs5535.c
index 92ec58f..802d518 100644
--- a/drivers/gpio/gpio-cs5535.c
+++ b/drivers/gpio/gpio-cs5535.c
@@ -319,7 +319,8 @@ static int cs5535_gpio_probe(struct platform_device *pdev)
 		goto done;
 	}
 
-	if (!request_region(res->start, resource_size(res), pdev->name)) {
+	if (!devm_request_region(&pdev->dev, res->start, resource_size(res),
+				 pdev->name)) {
 		dev_err(&pdev->dev, "can't request region\n");
 		goto done;
 	}
@@ -345,24 +346,18 @@ static int cs5535_gpio_probe(struct platform_device *pdev)
 	/* finally, register with the generic GPIO API */
 	err = gpiochip_add(&cs5535_gpio_chip.chip);
 	if (err)
-		goto release_region;
+		goto done;
 
 	return 0;
 
-release_region:
-	release_region(res->start, resource_size(res));
 done:
 	return err;
 }
 
 static int cs5535_gpio_remove(struct platform_device *pdev)
 {
-	struct resource *r;
-
 	gpiochip_remove(&cs5535_gpio_chip.chip);
 
-	r = platform_get_resource(pdev, IORESOURCE_IO, 0);
-	release_region(r->start, resource_size(r));
 	return 0;
 }
 
-- 
1.7.9.5


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

* Re: [PATCH] gpio: Switch to using managed resources with devm_
  2014-10-01 10:46 [PATCH] gpio: Switch to using managed resources with devm_ Pramod Gurav
@ 2014-10-05 10:28 ` Alexandre Courbot
  2014-10-21  8:52 ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Alexandre Courbot @ 2014-10-05 10:28 UTC (permalink / raw)
  To: Pramod Gurav
  Cc: Linux Kernel Mailing List, Linus Walleij,
	linux-gpio@vger.kernel.org

On Wed, Oct 1, 2014 at 7:46 PM, Pramod Gurav
<pramod.gurav@smartplayin.com> wrote:
> This change switches to devm_request_region to request region
> and hence simplifies the module unload and does away with
> release_region in remove function.

Your subject line should probably start with "gpio: cs5535:"

Otherwise,

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

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

* Re: [PATCH] gpio: Switch to using managed resources with devm_
  2014-10-01 10:46 [PATCH] gpio: Switch to using managed resources with devm_ Pramod Gurav
  2014-10-05 10:28 ` Alexandre Courbot
@ 2014-10-21  8:52 ` Linus Walleij
  2014-10-21  9:00   ` Pramod Gurav
  1 sibling, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2014-10-21  8:52 UTC (permalink / raw)
  To: Pramod Gurav
  Cc: linux-kernel@vger.kernel.org, Alexandre Courbot,
	linux-gpio@vger.kernel.org

On Wed, Oct 1, 2014 at 12:46 PM, Pramod Gurav
<pramod.gurav@smartplayin.com> wrote:

> This change switches to devm_request_region to request region
> and hence simplifies the module unload and does away with
> release_region in remove function.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Alexandre Courbot <gnurou@gmail.com>
> Cc: linux-gpio@vger.kernel.org
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>

Patch applied with augmented subject.

Yours,
Linus Walleij

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

* Re: [PATCH] gpio: Switch to using managed resources with devm_
  2014-10-21  8:52 ` Linus Walleij
@ 2014-10-21  9:00   ` Pramod Gurav
  0 siblings, 0 replies; 4+ messages in thread
From: Pramod Gurav @ 2014-10-21  9:00 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Pramod Gurav, linux-kernel@vger.kernel.org, Alexandre Courbot,
	linux-gpio@vger.kernel.org

On Tue, Oct 21, 2014 at 2:22 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Wed, Oct 1, 2014 at 12:46 PM, Pramod Gurav
> <pramod.gurav@smartplayin.com> wrote:
>
>> This change switches to devm_request_region to request region
>> and hence simplifies the module unload and does away with
>> release_region in remove function.
>>
>> Cc: Linus Walleij <linus.walleij@linaro.org>
>> Cc: Alexandre Courbot <gnurou@gmail.com>
>> Cc: linux-gpio@vger.kernel.org
>> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
>
> Patch applied with augmented subject.

Had sent v2 of this with change in subject. But thanks for the manual
change and applying.
>
> Yours,
> Linus Walleij
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
Thanks and Regards
Pramod

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

end of thread, other threads:[~2014-10-21  9:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-01 10:46 [PATCH] gpio: Switch to using managed resources with devm_ Pramod Gurav
2014-10-05 10:28 ` Alexandre Courbot
2014-10-21  8:52 ` Linus Walleij
2014-10-21  9:00   ` Pramod Gurav

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