leds: after setting inverted attribute, we must update the LED
authorThadeu Lima de Souza Cascardo <[email protected]>
Wed, 26 Aug 2009 21:29:32 +0000 (14:29 -0700)
committerLinus Torvalds <[email protected]>
Thu, 27 Aug 2009 03:06:53 +0000 (20:06 -0700)
If we change the inverted attribute to another value, the LED will not be
inverted until we change the GPIO state.

Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
Cc: Samuel R. C. Vale <[email protected]>
Cc: Richard Purdie <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/leds/ledtrig-gpio.c

index 8183b81fca84406be5da30b739da0c761e50d37b..1bc5db4ece0d951e202868a8cc539a34093d5cda 100644 (file)
@@ -117,6 +117,9 @@ static ssize_t gpio_trig_inverted_store(struct device *dev,
 
        gpio_data->inverted = !!inverted;
 
+       /* After inverting, we need to update the LED. */
+       schedule_work(&gpio_data->work);
+
        return n;
 }
 static DEVICE_ATTR(inverted, 0644, gpio_trig_inverted_show,