linux/drivers/leds
Anton Vorontsov 0493a4ff10 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>
2010-03-16 19:53:19 +00:00
..
Kconfig leds: Add Dell Business Class Netbook LED driver 2010-03-16 19:49:21 +00:00
Makefile leds: Add Dell Business Class Netbook LED driver 2010-03-16 19:49:21 +00:00
dell-led.c leds: Add Dell Business Class Netbook LED driver 2010-03-16 19:49:21 +00:00
led-class.c leds: led-class.c - Quiet boot messages 2010-03-16 19:49:21 +00:00
led-core.c leds: Cleanup various whitespace and code style issues 2008-04-24 23:37:42 +01:00
led-triggers.c leds: Prevent multiple LED triggers with the same name 2009-04-06 16:06:26 +01:00
leds-88pm860x.c led: Enable led in 88pm860x 2010-03-07 22:17:05 +01:00
leds-adp5520.c leds: Add driver for ADP5520/ADP5501 MFD PMICs 2009-12-16 11:30:10 +00:00
leds-alix2.c leds: leds-alix2c - take port address from MSR 2009-12-16 11:30:09 +00:00
leds-ams-delta.c omap: headers: Move remaining headers from include/mach to include/plat 2009-10-20 09:40:47 -07:00
leds-atmel-pwm.c leds: fix unsigned value overflow in atmel pwm driver 2008-07-23 09:49:56 +01:00
leds-bd2802.c leds: add the sysfs interface into the leds-bd2802 driver for changing wave pattern and led current. 2009-06-23 20:19:10 +01:00
leds-clevo-mail.c Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds 2009-09-26 10:50:47 -07:00
leds-cobalt-qube.c leds: use default-on trigger for Cobalt Qube 2009-12-17 11:38:31 +00:00
leds-cobalt-raq.c leds: leds-cobalt-raq.c - use resource_size() 2009-12-17 11:16:23 +00:00
leds-da903x.c leds: da903x: (da9030 only) led brightness reversed. 2008-10-30 22:14:10 +08:00
leds-dac124s085.c spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
leds-fsg.c IXP4xx: move FSG platform macros to the platform code. 2009-12-05 16:58:40 +01:00
leds-gpio.c leds-gpio: fix default state handling on OF platforms 2010-03-16 19:53:19 +00:00
leds-h1940.c [ARM] S3C24XX: GPIO: Move gpio functions out of <mach/hardware.h> 2009-05-18 16:25:40 +01:00
leds-hp6xx.c leds: Add suspend/resume to the core class 2009-01-08 17:55:03 +00:00
leds-locomo.c collie: locomo-led change default trigger 2009-11-27 21:07:19 +01:00
leds-lp3944.c leds: LED driver for National Semiconductor LP3944 Funlight Chip 2009-06-23 20:21:38 +01:00
leds-lt3593.c leds: Add driver for LT3593 controlled LEDs 2009-12-16 11:30:09 +00:00
leds-net48xx.c leds: Add suspend/resume to the core class 2009-01-08 17:55:03 +00:00
leds-pca955x.c leds: leds-pca955x - Mark pca955x_led_set() static 2008-10-20 22:57:56 +01:00
leds-pca9532.c leds: leds-pca9532 - Drop unused module parameters 2009-10-04 22:53:43 +02:00
leds-pwm.c leds: leds-pwm: Set led_classdev max_brightness 2009-12-17 11:42:34 +00:00
leds-rb532.c leds: Add rb532 LED driver for the User LED 2009-04-06 16:06:26 +01:00
leds-regulator.c leds: Add LED class driver for regulator driven LEDs. 2009-12-17 11:27:09 +00:00
leds-s3c24xx.c [ARM] S3C24XX: GPIO: Move gpio functions out of <mach/hardware.h> 2009-05-18 16:25:40 +01:00
leds-ss4200.c leds: make PCI device id constant 2010-03-16 19:49:21 +00:00
leds-sunfire.c leds: Add driver for Sunfire UltraSPARC server LEDs. 2008-08-31 20:26:48 -07:00
leds-wm831x-status.c leds: Add WM831x status LED driver 2009-09-07 14:33:33 +01:00
leds-wm8350.c leds: Add suspend/resume to the core class 2009-01-08 17:55:03 +00:00
leds-wrap.c leds: Add suspend/resume to the core class 2009-01-08 17:55:03 +00:00
leds.h leds: allow led-drivers to use a variable range of brightness values 2009-04-06 16:06:25 +01:00
ledtrig-backlight.c leds: Add backlight LED trigger 2008-10-20 22:34:12 +01:00
ledtrig-default-on.c leds: allow led-drivers to use a variable range of brightness values 2009-04-06 16:06:25 +01:00
ledtrig-gpio.c leds: fix coding style in worker thread code for ledtrig-gpio. 2009-09-07 14:33:33 +01:00
ledtrig-heartbeat.c leds: allow led-drivers to use a variable range of brightness values 2009-04-06 16:06:25 +01:00
ledtrig-ide-disk.c leds: allow led-drivers to use a variable range of brightness values 2009-04-06 16:06:25 +01:00
ledtrig-timer.c tree-wide: convert open calls to remove spaces to skip_spaces() lib function 2009-12-15 08:53:32 -08:00