From: Paul Collins Date: Sun, 1 Oct 2006 06:27:41 +0000 (-0700) Subject: [PATCH] leds: turn LED off when changing triggers X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e3e5fc91d9828a9b94a3992de47d47d2d2e34ec6;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git [PATCH] leds: turn LED off when changing triggers 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 Acked-by: Richard Purdie Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 47f0ff19632..454fb0901f8 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c @@ -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);