From: Vaishali Thakkar <vthakkar1994@gmail.com>
To: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Richard Purdie <rpurdie@rpsys.net>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] leds: leds-cobalt-qube: Use devm_led_classdev_register
Date: Tue, 1 Sep 2015 18:05:26 +0530 [thread overview]
Message-ID: <20150901123525.GA12241@localhost> (raw)
Use resource-managed function devm_led_classdev_register instead
of led_classdev_register to make the error-path simpler.
To be compatible with the change, goto is replaced with direct
return, unneeded label err_null is dropped and unnecessary variable
retval is removed. Also, remove redundant cobalt_qube_led_remove.
Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
---
Changes since v1:
- Remove use of variable retval
- Change commit log
---
drivers/leds/leds-cobalt-qube.c | 21 +--------------------
1 file changed, 1 insertion(+), 20 deletions(-)
diff --git a/drivers/leds/leds-cobalt-qube.c b/drivers/leds/leds-cobalt-qube.c
index d975220..f1374d2 100644
--- a/drivers/leds/leds-cobalt-qube.c
+++ b/drivers/leds/leds-cobalt-qube.c
@@ -36,7 +36,6 @@ static struct led_classdev qube_front_led = {
static int cobalt_qube_led_probe(struct platform_device *pdev)
{
struct resource *res;
- int retval;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
@@ -49,31 +48,13 @@ static int cobalt_qube_led_probe(struct platform_device *pdev)
led_value = LED_FRONT_LEFT | LED_FRONT_RIGHT;
writeb(led_value, led_port);
- retval = led_classdev_register(&pdev->dev, &qube_front_led);
- if (retval)
- goto err_null;
-
- return 0;
-
-err_null:
- led_port = NULL;
-
- return retval;
-}
-
-static int cobalt_qube_led_remove(struct platform_device *pdev)
-{
- led_classdev_unregister(&qube_front_led);
-
- if (led_port)
- led_port = NULL;
+ return devm_led_classdev_register(&pdev->dev, &qube_front_led);
return 0;
}
static struct platform_driver cobalt_qube_led_driver = {
.probe = cobalt_qube_led_probe,
- .remove = cobalt_qube_led_remove,
.driver = {
.name = "cobalt-qube-leds",
},
--
1.9.1
next reply other threads:[~2015-09-01 12:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-01 12:35 Vaishali Thakkar [this message]
2015-09-04 11:24 ` [PATCH v2] leds: leds-cobalt-qube: Use devm_led_classdev_register Jacek Anaszewski
2015-09-04 11:30 ` Vaishali Thakkar
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=20150901123525.GA12241@localhost \
--to=vthakkar1994@gmail.com \
--cc=j.anaszewski@samsung.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