public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Devendra Naga <devendra.aaru@gmail.com>
To: Bryan Wu <bryan.wu@canonical.com>,
	Richard Purdie <rpurdie@rpsys.net>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Devendra Naga <devendra.aaru@gmail.com>
Subject: [PATCH] leds/leds-s3c24xx: use devm_gpio_request
Date: Wed, 11 Jul 2012 15:35:32 +0545	[thread overview]
Message-ID: <1342000232-10105-1-git-send-email-devendra.aaru@gmail.com> (raw)

why?
because if the led_classdev_register fails we wont do gpio free
because using devm_ functions, there is no need for error paths

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
---
Bryan,

	This patch is not even compile tested, since my machine crashed, and
didn't have the ARM toolchain, sorry ..

	And i think this patch is legit not as that pci_set_drvdata one :(
 drivers/leds/leds-s3c24xx.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/leds/leds-s3c24xx.c b/drivers/leds/leds-s3c24xx.c
index e120640..942f0ea 100644
--- a/drivers/leds/leds-s3c24xx.c
+++ b/drivers/leds/leds-s3c24xx.c
@@ -65,7 +65,6 @@ static int s3c24xx_led_remove(struct platform_device *dev)
 	struct s3c24xx_gpio_led *led = pdev_to_gpio(dev);
 
 	led_classdev_unregister(&led->cdev);
-	gpio_free(led->pdata->gpio);
 
 	return 0;
 }
@@ -92,7 +91,7 @@ static int s3c24xx_led_probe(struct platform_device *dev)
 
 	led->pdata = pdata;
 
-	ret = gpio_request(pdata->gpio, "S3C24XX_LED");
+	ret = devm_gpio_request(&dev->dev, pdata->gpio, "S3C24XX_LED");
 	if (ret < 0)
 		return ret;
 
-- 
1.7.9.5


             reply	other threads:[~2012-07-11  9:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11  9:50 Devendra Naga [this message]
2012-07-13  3:27 ` [PATCH] leds/leds-s3c24xx: use devm_gpio_request Bryan Wu
2012-07-13  5:07   ` devendra.aaru

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1342000232-10105-1-git-send-email-devendra.aaru@gmail.com \
    --to=devendra.aaru@gmail.com \
    --cc=bryan.wu@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox