]> Git Repo - linux.git/commitdiff
leds/leds-regulator.c: fix handling of already enabled regulators
authorAntonio Ospite <[email protected]>
Thu, 14 Apr 2011 22:21:59 +0000 (15:21 -0700)
committerLinus Torvalds <[email protected]>
Thu, 14 Apr 2011 23:06:54 +0000 (16:06 -0700)
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 <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: Antonio Ospite <[email protected]>
Acked-by: Mark Brown <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: Daniel Ribeiro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/leds/leds-regulator.c

index 3790816643bef85bee2dd1824bcb29818a693f86..8497f56f8e461cf70d8d1b8692e04b11e353323c 100644 (file)
@@ -178,6 +178,10 @@ static int __devinit regulator_led_probe(struct platform_device *pdev)
        led->cdev.flags |= LED_CORE_SUSPENDRESUME;
        led->vcc = vcc;
 
+       /* to handle correctly an already enabled regulator */
+       if (regulator_is_enabled(led->vcc))
+               led->enabled = 1;
+
        mutex_init(&led->mutex);
        INIT_WORK(&led->work, led_work);
 
This page took 0.059247 seconds and 4 git commands to generate.