aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2010-03-11 16:58:47 -0500
committerRichard Purdie <rpurdie@linux.intel.com>2010-03-16 15:53:19 -0400
commit0493a4ff10959ff4c8e0d65efee25b7ffd4fa5db (patch)
tree805d40439515577d647d825223e051514fdc9e5c /drivers/leds
parent72dcd8d08aca4ac6154dc37243880ee306c7ea73 (diff)
leds-gpio: fix default state handling on OF platforms
The driver wrongly sets default state for LEDs that don't specify default-state property. Currently the driver handles default state this way: memset(&led, 0, sizeof(led)); for_each_child_of_node(np, child) { state = of_get_property(child, "default-state", NULL); if (state) { if (!strcmp(state, "keep")) led.default_state = LEDS_GPIO_DEFSTATE_KEEP; ... } ret = create_gpio_led(&led, ...); } Which means that all LEDs that do not specify default-state will inherit the last value of the default-state property, which is wrong. This patch fixes the issue by moving LED's template initialization into the loop body. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-gpio.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index e5225d28f392..0823e2622e8c 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -211,7 +211,6 @@ static int __devinit of_gpio_leds_probe(struct of_device *ofdev,
211 const struct of_device_id *match) 211 const struct of_device_id *match)
212{ 212{
213 struct device_node *np = ofdev->node, *child; 213 struct device_node *np = ofdev->node, *child;
214 struct gpio_led led;
215 struct gpio_led_of_platform_data *pdata; 214 struct gpio_led_of_platform_data *pdata;
216 int count = 0, ret; 215 int count = 0, ret;
217 216
@@ -226,8 +225,8 @@ static int __devinit of_gpio_leds_probe(struct of_device *ofdev,
226 if (!pdata) 225 if (!pdata)
227 return -ENOMEM; 226 return -ENOMEM;
228 227
229 memset(&led, 0, sizeof(led));
230 for_each_child_of_node(np, child) { 228 for_each_child_of_node(np, child) {
229 struct gpio_led led = {};
231 enum of_gpio_flags flags; 230 enum of_gpio_flags flags;
232 const char *state; 231 const char *state;
233 232