1 From bc2c0dd85a0a31505ca2f92bef891ddac9126725 Mon Sep 17 00:00:00 2001
2 From: Heiner Kallweit <hkallweit1@gmail.com>
3 Date: Wed, 14 Sep 2016 20:55:27 +0200
4 Subject: [PATCH] leds: gpio: switch to managed version of
7 Using the managed version of led_classdev_register allows to
8 significantly simplify the code.
10 Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
11 Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
13 drivers/leds/leds-gpio.c | 23 ++---------------------
14 1 file changed, 2 insertions(+), 21 deletions(-)
16 --- a/drivers/leds/leds-gpio.c
17 +++ b/drivers/leds/leds-gpio.c
18 @@ -143,7 +143,7 @@ static int create_gpio_led(const struct
20 INIT_WORK(&led_dat->work, gpio_led_work);
22 - return led_classdev_register(parent, &led_dat->cdev);
23 + return devm_led_classdev_register(parent, &led_dat->cdev);
26 static void delete_gpio_led(struct gpio_led_data *led)
27 @@ -231,8 +231,6 @@ static struct gpio_leds_priv *gpio_leds_
31 - for (count = priv->num_leds - 1; count >= 0; count--)
32 - delete_gpio_led(&priv->leds[count]);
36 @@ -261,12 +259,8 @@ static int gpio_led_probe(struct platfor
37 ret = create_gpio_led(&pdata->leds[i],
39 &pdev->dev, pdata->gpio_blink_set);
41 - /* On failure: unwind the led creations */
42 - for (i = i - 1; i >= 0; i--)
43 - delete_gpio_led(&priv->leds[i]);
49 priv = gpio_leds_create(pdev);
50 @@ -279,17 +273,6 @@ static int gpio_led_probe(struct platfor
54 -static int gpio_led_remove(struct platform_device *pdev)
56 - struct gpio_leds_priv *priv = platform_get_drvdata(pdev);
59 - for (i = 0; i < priv->num_leds; i++)
60 - delete_gpio_led(&priv->leds[i]);
65 static void gpio_led_shutdown(struct platform_device *pdev)
67 struct gpio_leds_priv *priv = platform_get_drvdata(pdev);
68 @@ -304,7 +287,6 @@ static void gpio_led_shutdown(struct pla
70 static struct platform_driver gpio_led_driver = {
71 .probe = gpio_led_probe,
72 - .remove = gpio_led_remove,
73 .shutdown = gpio_led_shutdown,