summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMuhammad Falak R Wani <falakreyaz@gmail.com>2015-10-17 01:47:55 +0530
committerJacek Anaszewski <j.anaszewski@samsung.com>2015-11-03 08:59:52 +0100
commit81aad9f81e6d89819f12656bd38df9ef639dbe45 (patch)
tree1976fba1f28f2c579874c5d2319222f4b210acf3
parentd43986143463690642bac8897196496d4c776269 (diff)
downloadlinux-81aad9f81e6d89819f12656bd38df9ef639dbe45.tar.bz2
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: Muhammad Falak R Wani <falakreyaz@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
-rw-r--r--drivers/leds/leds-menf21bmc.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/drivers/leds/leds-menf21bmc.c b/drivers/leds/leds-menf21bmc.c
index 4b9eea815b1a..dec2a6e59676 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",
},