Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2431fe9a authored by Christian Lamparter's avatar Christian Lamparter Committed by John W. Linville
Browse files

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: default avatarChristian Lamparter <chunkeey@web.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 95cf8769
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ struct ar9170_led {
	struct led_classdev l;
	char name[32];
	unsigned int toggled;
	bool last_state;
	bool registered;
};

+5 −2
Original line number Diff line number Diff line
@@ -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;

	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);
}