[PATCH] leds: turn LED off when changing triggers
authorPaul Collins <paul@briny.ondioline.org>
Sun, 1 Oct 2006 06:27:41 +0000 (23:27 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 1 Oct 2006 07:39:21 +0000 (00:39 -0700)
I was playing with LED triggers when I noticed that changing from heartbeat
(or ide-disk) to "none" at the right moment would leave the LED stuck on.
This is easy to reproduce by doing "find / >/dev/null" with the ide-disk
trigger enabled and then switching to "none".

Here is a patch that fixes the problem by explicitly turning the LED off
after removing the existing trigger.

Signed-off-by: Paul Collins <paul@ondioline.org>
Acked-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/leds/led-triggers.c

index 47f0ff196328d2808268a17701444b08faafee1a..454fb0901f8211dc31ec6b86e6edac5bec774286 100644 (file)
@@ -125,6 +125,7 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trigger)
                write_unlock_irqrestore(&led_cdev->trigger->leddev_list_lock, flags);
                if (led_cdev->trigger->deactivate)
                        led_cdev->trigger->deactivate(led_cdev);
+               led_set_brightness(led_cdev, LED_OFF);
        }
        if (trigger) {
                write_lock_irqsave(&trigger->leddev_list_lock, flags);