[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-id: <5624A6B2.4020005@samsung.com>
Date: Mon, 19 Oct 2015 10:15:46 +0200
From: Jacek Anaszewski <j.anaszewski@...sung.com>
To: Muhammad Falak R Wani <falakreyaz@...il.com>
Cc: Anreas Werner <andreas.werner@....de>,
Bryan Wu <cooloney@...il.com>,
Richard Purdie <rpurdie@...ys.net>, linux-leds@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] leds: leds-menf21bmc.c: Use devm_led_class_register
Hi Muhammad,
On 10/16/2015 10:17 PM, Muhammad Falak R Wani wrote:
> Use resource-managed function devm_led_classdev_register instead
> of led_classdev_register, consequently remove redundant
> menf21bmc_led_remove function.
> Also drop the unneeded label err_free_leds.
>
> Signed-off-by: Muhammad Falak R Wani <falakreyaz@...il.com>
> ---
> drivers/leds/leds-menf21bmc.c | 26 +++++---------------------
> 1 file changed, 5 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/leds/leds-menf21bmc.c b/drivers/leds/leds-menf21bmc.c
> index 4b9eea8..dec2a6e 100644
> --- a/drivers/leds/leds-menf21bmc.c
> +++ b/drivers/leds/leds-menf21bmc.c
> @@ -87,36 +87,20 @@ static int menf21bmc_led_probe(struct platform_device *pdev)
> leds[i].cdev.name = leds[i].name;
> leds[i].cdev.brightness_set = menf21bmc_led_set;
> leds[i].i2c_client = i2c_client;
> - ret = led_classdev_register(&pdev->dev, &leds[i].cdev);
> - if (ret < 0)
> - goto err_free_leds;
> + ret = devm_led_classdev_register(&pdev->dev, &leds[i].cdev);
> + if (ret < 0) {
> + dev_err(&pdev->dev, "failed to register LED device\n");
> + return ret;
> + }
> }
> dev_info(&pdev->dev, "MEN 140F21P00 BMC LED device enabled\n");
>
> return 0;
>
> -err_free_leds:
> - dev_err(&pdev->dev, "failed to register LED device\n");
> -
> - for (i = i - 1; i >= 0; i--)
> - led_classdev_unregister(&leds[i].cdev);
> -
> - return ret;
> -}
> -
> -static int menf21bmc_led_remove(struct platform_device *pdev)
> -{
> - int i;
> -
> - for (i = 0; i < ARRAY_SIZE(leds); i++)
> - led_classdev_unregister(&leds[i].cdev);
> -
> - return 0;
> }
>
> static struct platform_driver menf21bmc_led = {
> .probe = menf21bmc_led_probe,
> - .remove = menf21bmc_led_remove,
> .driver = {
> .name = "menf21bmc_led",
> },
>
Applied, thanks.
--
Best Regards,
Jacek Anaszewski
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists