Skip to contentSkip to conversation

leds: turn LED off when changing triggers

PATCH In review Paul Collins 2 participants 2 messages Sep 19, 2006 LED

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 leds: turn LED off when changing triggers

Hi Richard,

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.

drivers/leds/led-triggers.c +1 -0
index 47f0ff1..454fb09 100644
@@ -125,6 +125,7 @@ void led_trigger_set(struct led_classdev
 		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);
Signature · 4 lines
Paul Collins
Wellington, New Zealand

Dag vijandelijk luchtschip de huismeester is dood
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Paul Collins

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.

Looks good to me, thanks.

Quoted 1 line