diff options
author | Amitoj Kaur Chawla <amitoj1606@gmail.com> | 2016-03-09 08:54:10 +0530 |
---|---|---|
committer | Jacek Anaszewski <j.anaszewski@samsung.com> | 2016-03-14 09:22:22 +0100 |
commit | eed16255d66bde1abbce272400912a9ea9e69e08 (patch) | |
tree | 95c1d66bd3c7be5b11a424dd2fb4bb87eccce1b1 /drivers/leds | |
parent | 48a7032ba044103cf89af680d3e3bb9bf0ba9072 (diff) |
leds: da903x: Use devm_led_classdev_register
Switch to resource-managed function devm_led_classdev_register instead
of led_classdev_register and remove unneeded led_classdev_unregister.
Also, remove platform_set_drvdata in probe function and the remove
function, da903x_led_remove as it is now has nothing to do.
The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
.probe = probefn,
.remove = removefn,
};
@prb@
identifier platform.probefn, pdev;
expression e;
@@
probefn(struct platform_device *pdev, ...) {
...
e =
- led_classdev_register
+ devm_led_classdev_register
(...);
...
?- led_classdev_unregister(...);
...
}
@remove depends on prb@
identifier platform.removefn;
@@
removefn(...) {
...
?- led_classdev_unregister(...);
...
}
//</smpl>
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/leds-da903x.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/drivers/leds/leds-da903x.c b/drivers/leds/leds-da903x.c index 4752a2b6ba2b..5ff7d72f73aa 100644 --- a/drivers/leds/leds-da903x.c +++ b/drivers/leds/leds-da903x.c @@ -113,21 +113,12 @@ static int da903x_led_probe(struct platform_device *pdev) led->flags = pdata->flags; led->master = pdev->dev.parent; - ret = led_classdev_register(led->master, &led->cdev); + ret = devm_led_classdev_register(led->master, &led->cdev); if (ret) { dev_err(&pdev->dev, "failed to register LED %d\n", id); return ret; } - platform_set_drvdata(pdev, led); - return 0; -} - -static int da903x_led_remove(struct platform_device *pdev) -{ - struct da903x_led *led = platform_get_drvdata(pdev); - - led_classdev_unregister(&led->cdev); return 0; } @@ -136,7 +127,6 @@ static struct platform_driver da903x_led_driver = { .name = "da903x-led", }, .probe = da903x_led_probe, - .remove = da903x_led_remove, }; module_platform_driver(da903x_led_driver); |