Skip to contentSkip to conversation

ar9170: fix LED power state handling

PATCH In review Christian Lamparter 1 participant 1 message May 23, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 ar9170: fix LED power state handling

This patch fixes a minor visual bug in the led code, which left the LED in the wrong power state when it was toggled in a _unexpected_ way (e.g: enabling the LED twice).

---

drivers/net/wireless/ath/ar9170/led.c +4 -4
index 341cead..ebb1c3e 100644
@@ -81,10 +81,10 @@ static void ar9170_update_leds(struct work_struct *work)
 			if (tmp < blink_delay)
 				blink_delay = tmp;
 
-			if (ar->leds[i].toggled > 1)
-				ar->leds[i].toggled = 0;
+			if (ar->leds[i].l.brightness == LED_OFF)
+				rerun = true;
 
-			rerun = true;
+			ar->leds[i].toggled = !!ar->leds[i].l.brightness;
 		}
 
 	ar9170_set_leds_state(ar, led_val);
@@ -103,7 +103,7 @@ static void ar9170_led_brightness_set(struct led_classdev *led,
 
 	arl->toggled++;
 
-	if (likely(IS_ACCEPTING_CMD(ar) && brightness))
+	if (likely(IS_ACCEPTING_CMD(ar)))
 		queue_delayed_work(ar->hw->workqueue, &ar->led_work, HZ/10);
 }