aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-gpio.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-07-01 22:09:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-07-01 22:09:11 -0400
commit13d45f79a2af84de9083310db58b309a61065208 (patch)
tree06968d83ed6e5e23e1f729cf6f096f9a79f14f72 /drivers/leds/leds-gpio.c
parent05fde26a943a9c55d8b498d97bb49d3d207e5069 (diff)
parentb67893206fc0a0e8af87130e67f3d8ae553fc87c (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds
Pull LED subsystem updates from Bryan Wu: "In this cycle, we finished to merge patches for LED Flash class driver. Other than that we have some bug fixes and new drivers for LED controllers" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (33 commits) leds:lp55xx: fix firmware loading error leds: fix max77693-led build errors leds: fix aat1290 build errors leds: aat1290: pass flags parameter to devm_gpiod_get leds: ktd2692: pass flags parameter to devm_gpiod_get drivers/leds: don't use module_init in non-modular leds-cobalt-raq.c leds: aat1290: add support for V4L2 Flash sub-device DT: aat1290: Document handling external strobe sources leds: max77693: add support for V4L2 Flash sub-device media: Add registration helpers for V4L2 flash sub-devices v4l: async: Add a pointer to of_node to struct v4l2_subdev, match it Documentation: leds: Add description of v4l2-flash sub-device leds: add BCM6358 LED driver leds: add DT binding for BCM6358 LED controller leds: fix brightness changing when software blinking is active Documentation: leds-lp5523: describe master fader attributes leds: lp5523: add master_fader support leds: leds-gpio: Allow compile test if !GPIOLIB leds: leds-gpio: Add missing #include <linux/of.h> gpiolib: Add missing dummies for the unified device properties interface ...
Diffstat (limited to 'drivers/leds/leds-gpio.c')
-rw-r--r--drivers/leds/leds-gpio.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index d2d54d62afee..af1876a3a77c 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -16,6 +16,7 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/leds.h> 17#include <linux/leds.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/of.h>
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
20#include <linux/property.h> 21#include <linux/property.h>
21#include <linux/slab.h> 22#include <linux/slab.h>
@@ -198,8 +199,10 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
198 } else { 199 } else {
199 if (IS_ENABLED(CONFIG_OF) && !led.name && np) 200 if (IS_ENABLED(CONFIG_OF) && !led.name && np)
200 led.name = np->name; 201 led.name = np->name;
201 if (!led.name) 202 if (!led.name) {
202 return ERR_PTR(-EINVAL); 203 ret = -EINVAL;
204 goto err;
205 }
203 } 206 }
204 fwnode_property_read_string(child, "linux,default-trigger", 207 fwnode_property_read_string(child, "linux,default-trigger",
205 &led.default_trigger); 208 &led.default_trigger);
@@ -217,18 +220,19 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
217 if (fwnode_property_present(child, "retain-state-suspended")) 220 if (fwnode_property_present(child, "retain-state-suspended"))
218 led.retain_state_suspended = 1; 221 led.retain_state_suspended = 1;
219 222
220 ret = create_gpio_led(&led, &priv->leds[priv->num_leds++], 223 ret = create_gpio_led(&led, &priv->leds[priv->num_leds],
221 dev, NULL); 224 dev, NULL);
222 if (ret < 0) { 225 if (ret < 0) {
223 fwnode_handle_put(child); 226 fwnode_handle_put(child);
224 goto err; 227 goto err;
225 } 228 }
229 priv->num_leds++;
226 } 230 }
227 231
228 return priv; 232 return priv;
229 233
230err: 234err:
231 for (count = priv->num_leds - 2; count >= 0; count--) 235 for (count = priv->num_leds - 1; count >= 0; count--)
232 delete_gpio_led(&priv->leds[count]); 236 delete_gpio_led(&priv->leds[count]);
233 return ERR_PTR(ret); 237 return ERR_PTR(ret);
234} 238}