2009-05-23 18:30:59

by Christian Lamparter

[permalink] [raw]
Subject: [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).

Signed-off-by: Christian Lamparter <[email protected]>
---
diff --git a/drivers/net/wireless/ath/ar9170/led.c b/drivers/net/wireless/ath/ar9170/led.c
index 341cead..ebb1c3e 100644
--- a/drivers/net/wireless/ath/ar9170/led.c
+++ b/drivers/net/wireless/ath/ar9170/led.c
@@ -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);
}