* [PATCH] leds: leds-hp6xx: Use of devm_classdev_register
@ 2015-10-26 17:00 Fida Mohammad
2015-10-27 8:16 ` Jacek Anaszewski
0 siblings, 1 reply; 2+ messages in thread
From: Fida Mohammad @ 2015-10-26 17:00 UTC (permalink / raw)
To: Bryan Wu, Richard Purdie, Jacek Anaszewski, linux-leds, LKML
Cc: Muhammad Falak, Kristoffer, Fida Mohammad
Use resource managed function devm_classdev_register to make
error path simpler. Also removed the redundant remove function.
Signed-off-by: Fida Mohammad <fmthoker@gmail.com>
---
drivers/leds/leds-hp6xx.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/leds/leds-hp6xx.c b/drivers/leds/leds-hp6xx.c
index 0b84c01..ffb6d5b 100644
--- a/drivers/leds/leds-hp6xx.c
+++ b/drivers/leds/leds-hp6xx.c
@@ -59,28 +59,17 @@ static int hp6xxled_probe(struct platform_device *pdev)
{
int ret;
- ret = led_classdev_register(&pdev->dev, &hp6xx_red_led);
+ ret = devm_led_classdev_register(&pdev->dev, &hp6xx_red_led);
if (ret < 0)
return ret;
- ret = led_classdev_register(&pdev->dev, &hp6xx_green_led);
- if (ret < 0)
- led_classdev_unregister(&hp6xx_red_led);
+ return devm_led_classdev_register(&pdev->dev, &hp6xx_green_led);
- return ret;
}
-static int hp6xxled_remove(struct platform_device *pdev)
-{
- led_classdev_unregister(&hp6xx_red_led);
- led_classdev_unregister(&hp6xx_green_led);
-
- return 0;
-}
static struct platform_driver hp6xxled_driver = {
.probe = hp6xxled_probe,
- .remove = hp6xxled_remove,
.driver = {
.name = "hp6xx-led",
},
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] leds: leds-hp6xx: Use of devm_classdev_register
2015-10-26 17:00 [PATCH] leds: leds-hp6xx: Use of devm_classdev_register Fida Mohammad
@ 2015-10-27 8:16 ` Jacek Anaszewski
0 siblings, 0 replies; 2+ messages in thread
From: Jacek Anaszewski @ 2015-10-27 8:16 UTC (permalink / raw)
To: Fida Mohammad
Cc: Bryan Wu, Richard Purdie, linux-leds, LKML, Muhammad Falak, Kristoffer
Hi Fida,
Thanks for the patch. It doesn't apply smoothly, though.
Please rebase the patch on the top of LED git tree [1], for-next
branch.
[1]
git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git
Best Regards,
Jacek Anaszewski
On 10/26/2015 06:00 PM, Fida Mohammad wrote:
> Use resource managed function devm_classdev_register to make
> error path simpler. Also removed the redundant remove function.
>
> Signed-off-by: Fida Mohammad <fmthoker@gmail.com>
> ---
> drivers/leds/leds-hp6xx.c | 15 ++-------------
> 1 file changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/leds/leds-hp6xx.c b/drivers/leds/leds-hp6xx.c
> index 0b84c01..ffb6d5b 100644
> --- a/drivers/leds/leds-hp6xx.c
> +++ b/drivers/leds/leds-hp6xx.c
> @@ -59,28 +59,17 @@ static int hp6xxled_probe(struct platform_device *pdev)
> {
> int ret;
>
> - ret = led_classdev_register(&pdev->dev, &hp6xx_red_led);
> + ret = devm_led_classdev_register(&pdev->dev, &hp6xx_red_led);
> if (ret < 0)
> return ret;
>
> - ret = led_classdev_register(&pdev->dev, &hp6xx_green_led);
> - if (ret < 0)
> - led_classdev_unregister(&hp6xx_red_led);
> + return devm_led_classdev_register(&pdev->dev, &hp6xx_green_led);
>
> - return ret;
> }
>
> -static int hp6xxled_remove(struct platform_device *pdev)
> -{
> - led_classdev_unregister(&hp6xx_red_led);
> - led_classdev_unregister(&hp6xx_green_led);
> -
> - return 0;
> -}
>
> static struct platform_driver hp6xxled_driver = {
> .probe = hp6xxled_probe,
> - .remove = hp6xxled_remove,
> .driver = {
> .name = "hp6xx-led",
> },
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-27 8:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-26 17:00 [PATCH] leds: leds-hp6xx: Use of devm_classdev_register Fida Mohammad
2015-10-27 8:16 ` Jacek Anaszewski
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).