mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 15:32:33 +00:00
74d00a8c38
* properly format/comment all patches * merge debloat patches * merge Kconfig patches * merge swconfig patches * merge hotplug patches * drop 200-fix_localversion.patch - upstream * drop 222-arm_zimage_none.patch - unused * drop 252-mv_cesa_depends.patch - no longer required * drop 410-mtd-move-forward-declaration-of-struct-mtd_info.patch - unused * drop 661-fq_codel_keep_dropped_stats.patch - outdated * drop 702-phy_add_aneg_done_function.patch - upstream * drop 840-rtc7301.patch - unused * drop 841-rtc_pt7c4338.patch - upstream * drop 921-use_preinit_as_init.patch - unused * drop spio-gpio-old and gpio-mmc - unused Signed-off-by: John Crispin <john@phrozen.org>
76 lines
2.1 KiB
Diff
76 lines
2.1 KiB
Diff
From bc2c0dd85a0a31505ca2f92bef891ddac9126725 Mon Sep 17 00:00:00 2001
|
|
From: Heiner Kallweit <hkallweit1@gmail.com>
|
|
Date: Wed, 14 Sep 2016 20:55:27 +0200
|
|
Subject: [PATCH] leds: gpio: switch to managed version of
|
|
led_classdev_register
|
|
|
|
Using the managed version of led_classdev_register allows to
|
|
significantly simplify the code.
|
|
|
|
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
|
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
|
|
---
|
|
drivers/leds/leds-gpio.c | 23 ++---------------------
|
|
1 file changed, 2 insertions(+), 21 deletions(-)
|
|
|
|
--- a/drivers/leds/leds-gpio.c
|
|
+++ b/drivers/leds/leds-gpio.c
|
|
@@ -143,7 +143,7 @@ static int create_gpio_led(const struct
|
|
|
|
INIT_WORK(&led_dat->work, gpio_led_work);
|
|
|
|
- return led_classdev_register(parent, &led_dat->cdev);
|
|
+ return devm_led_classdev_register(parent, &led_dat->cdev);
|
|
}
|
|
|
|
static void delete_gpio_led(struct gpio_led_data *led)
|
|
@@ -231,8 +231,6 @@ static struct gpio_leds_priv *gpio_leds_
|
|
return priv;
|
|
|
|
err:
|
|
- for (count = priv->num_leds - 1; count >= 0; count--)
|
|
- delete_gpio_led(&priv->leds[count]);
|
|
return ERR_PTR(ret);
|
|
}
|
|
|
|
@@ -261,12 +259,8 @@ static int gpio_led_probe(struct platfor
|
|
ret = create_gpio_led(&pdata->leds[i],
|
|
&priv->leds[i],
|
|
&pdev->dev, pdata->gpio_blink_set);
|
|
- if (ret < 0) {
|
|
- /* On failure: unwind the led creations */
|
|
- for (i = i - 1; i >= 0; i--)
|
|
- delete_gpio_led(&priv->leds[i]);
|
|
+ if (ret < 0)
|
|
return ret;
|
|
- }
|
|
}
|
|
} else {
|
|
priv = gpio_leds_create(pdev);
|
|
@@ -279,17 +273,6 @@ static int gpio_led_probe(struct platfor
|
|
return 0;
|
|
}
|
|
|
|
-static int gpio_led_remove(struct platform_device *pdev)
|
|
-{
|
|
- struct gpio_leds_priv *priv = platform_get_drvdata(pdev);
|
|
- int i;
|
|
-
|
|
- for (i = 0; i < priv->num_leds; i++)
|
|
- delete_gpio_led(&priv->leds[i]);
|
|
-
|
|
- return 0;
|
|
-}
|
|
-
|
|
static void gpio_led_shutdown(struct platform_device *pdev)
|
|
{
|
|
struct gpio_leds_priv *priv = platform_get_drvdata(pdev);
|
|
@@ -304,7 +287,6 @@ static void gpio_led_shutdown(struct pla
|
|
|
|
static struct platform_driver gpio_led_driver = {
|
|
.probe = gpio_led_probe,
|
|
- .remove = gpio_led_remove,
|
|
.shutdown = gpio_led_shutdown,
|
|
.driver = {
|
|
.name = "leds-gpio",
|