aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorAntonio Ospite <ospite@studenti.unina.it>2011-04-14 18:21:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-04-14 19:06:54 -0400
commit592ce316395abc6b4e96c1ac198e5f347bb5d578 (patch)
tree28281eed393ec50625ff3558956baccb5c4f4ec7 /drivers/leds
parentd3bc2367180f7ee6afe4ee6e886bfba3ad4eb290 (diff)
leds/leds-regulator.c: fix handling of already enabled regulators
Make the driver aware of the initial status of the regulator. The leds-regulator driver was ignoring the initial status of the regulator; this resulted in rdev->use_count being incremented to 2 after calling regulator_led_set_value() in the .probe method when a regulator was already enabled at insmod time, which made it impossible to ever disable the regulator. Signed-off-by: Antonio Ospite <ospite@studenti.unina.it> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: Antonio Ospite <ospite@studenti.unina.it> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Liam Girdwood <lrg@slimlogic.co.uk> Cc: Daniel Ribeiro <drwyrm@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-regulator.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/leds/leds-regulator.c b/drivers/leds/leds-regulator.c
index 3790816643be..8497f56f8e46 100644
--- a/drivers/leds/leds-regulator.c
+++ b/drivers/leds/leds-regulator.c
@@ -178,6 +178,10 @@ static int __devinit regulator_led_probe(struct platform_device *pdev)
178 led->cdev.flags |= LED_CORE_SUSPENDRESUME; 178 led->cdev.flags |= LED_CORE_SUSPENDRESUME;
179 led->vcc = vcc; 179 led->vcc = vcc;
180 180
181 /* to handle correctly an already enabled regulator */
182 if (regulator_is_enabled(led->vcc))
183 led->enabled = 1;
184
181 mutex_init(&led->mutex); 185 mutex_init(&led->mutex);
182 INIT_WORK(&led->work, led_work); 186 INIT_WORK(&led->work, led_work);
183 187