Skip to content

Commit 592ce31

Browse files
Antonio Ospitetorvalds
Antonio Ospite
authored andcommitted
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 <[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]>
1 parent d3bc236 commit 592ce31

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/leds/leds-regulator.c

+4
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ static int __devinit regulator_led_probe(struct platform_device *pdev)
178178
led->cdev.flags |= LED_CORE_SUSPENDRESUME;
179179
led->vcc = vcc;
180180

181+
/* to handle correctly an already enabled regulator */
182+
if (regulator_is_enabled(led->vcc))
183+
led->enabled = 1;
184+
181185
mutex_init(&led->mutex);
182186
INIT_WORK(&led->work, led_work);
183187

0 commit comments

Comments
 (0)