ath5k: Track current TX power separately from max TX power
authorBruno Randolf <br1@einfach.org>
Tue, 21 Dec 2010 08:30:32 +0000 (17:30 +0900)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 22 Dec 2010 20:43:28 +0000 (15:43 -0500)
commit51f00622e5664ae77fd6c8670ddd402d9b77ccc8
tree0bb0a32d948306e3b4f7b219ed270e05bf974b34
parent56bd29d361a53f3bf6b815b5bf570a23bdc55b35
ath5k: Track current TX power separately from max TX power

Add a new variable to keep track of the currently configured tx power. Before
max_pwr was re-used for keeping the maximum allowed power as well as the
current configuration. Doing a min() on it allows you to lower the txpower, but
how would you be able to make it higher again?

This patch fixes that by adding a new variable ah_cur_pwr which is used instead
of txp_max_pwr to keep the current configuration. txp_max_pwr is used to check
if we are within the limits.

Another problem fixed by this patch is that it avoids setting a zero txpower
when things are initialized first and the current power is not yet set.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath5k/ath5k.h
drivers/net/wireless/ath/ath5k/phy.c