Commit 81aad9f8 authored by Muhammad Falak R Wani's avatar Muhammad Falak R Wani Committed by Jacek Anaszewski

leds: leds-menf21bmc.c: Use devm_led_class_register

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: default avatarMuhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: default avatarJacek Anaszewski <j.anaszewski@samsung.com>
parent d4398614
...@@ -87,36 +87,20 @@ static int menf21bmc_led_probe(struct platform_device *pdev) ...@@ -87,36 +87,20 @@ static int menf21bmc_led_probe(struct platform_device *pdev)
leds[i].cdev.name = leds[i].name; leds[i].cdev.name = leds[i].name;
leds[i].cdev.brightness_set = menf21bmc_led_set; leds[i].cdev.brightness_set = menf21bmc_led_set;
leds[i].i2c_client = i2c_client; leds[i].i2c_client = i2c_client;
ret = led_classdev_register(&pdev->dev, &leds[i].cdev); ret = devm_led_classdev_register(&pdev->dev, &leds[i].cdev);
if (ret < 0) if (ret < 0) {
goto err_free_leds; dev_err(&pdev->dev, "failed to register LED device\n");
return ret;
}
} }
dev_info(&pdev->dev, "MEN 140F21P00 BMC LED device enabled\n"); dev_info(&pdev->dev, "MEN 140F21P00 BMC LED device enabled\n");
return 0; 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 = { static struct platform_driver menf21bmc_led = {
.probe = menf21bmc_led_probe, .probe = menf21bmc_led_probe,
.remove = menf21bmc_led_remove,
.driver = { .driver = {
.name = "menf21bmc_led", .name = "menf21bmc_led",
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment