Skip to content

Commit

Permalink
ar9170: fix LED power state handling
Browse files Browse the repository at this point in the history
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 <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Christian Lamparter authored and John W. Linville committed Jun 3, 2009
1 parent 95cf876 commit 2431fe9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ar9170/ar9170.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ struct ar9170_led {
struct led_classdev l;
char name[32];
unsigned int toggled;
bool last_state;
bool registered;
};

Expand Down
7 changes: 5 additions & 2 deletions drivers/net/wireless/ath/ar9170/led.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ static void ar9170_led_brightness_set(struct led_classdev *led,
struct ar9170_led *arl = container_of(led, struct ar9170_led, l);
struct ar9170 *ar = arl->ar;

arl->toggled++;
if (arl->last_state != !!brightness) {
arl->toggled++;
arl->last_state = !!brightness;
}

if (likely(IS_ACCEPTING_CMD(ar) && brightness))
if (likely(IS_ACCEPTING_CMD(ar) && arl->toggled))
queue_delayed_work(ar->hw->workqueue, &ar->led_work, HZ/10);
}

Expand Down

0 comments on commit 2431fe9

Please sign in to comment.