public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] leds: leds-cobalt-qube: Use devm_led_classdev_register
@ 2015-09-01 12:35 Vaishali Thakkar
  2015-09-04 11:24 ` Jacek Anaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: Vaishali Thakkar @ 2015-09-01 12:35 UTC (permalink / raw)
  To: Jacek Anaszewski; +Cc: Richard Purdie, linux-leds, linux-kernel

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


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

end of thread, other threads:[~2015-09-04 11:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-01 12:35 [PATCH v2] leds: leds-cobalt-qube: Use devm_led_classdev_register Vaishali Thakkar
2015-09-04 11:24 ` Jacek Anaszewski
2015-09-04 11:30   ` Vaishali Thakkar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox