Commit 8f942b9b authored by Gabor Juhos's avatar Gabor Juhos Committed by John W. Linville

ath9k: simplify ath9k_hw_get_scaled_power function

Signed-off-by: default avatarGabor Juhos <juhosg@openwrt.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ea6f792b
...@@ -293,9 +293,7 @@ u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower, ...@@ -293,9 +293,7 @@ u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower,
u16 ath9k_hw_get_scaled_power(struct ath_hw *ah, u16 power_limit, u16 ath9k_hw_get_scaled_power(struct ath_hw *ah, u16 power_limit,
u8 antenna_reduction) u8 antenna_reduction)
{ {
u16 scaled_power; u16 reduction = antenna_reduction;
scaled_power = power_limit - antenna_reduction;
/* /*
* Reduce scaled Power by number of chains active * Reduce scaled Power by number of chains active
...@@ -305,22 +303,19 @@ u16 ath9k_hw_get_scaled_power(struct ath_hw *ah, u16 power_limit, ...@@ -305,22 +303,19 @@ u16 ath9k_hw_get_scaled_power(struct ath_hw *ah, u16 power_limit,
case 1: case 1:
break; break;
case 2: case 2:
if (scaled_power > REDUCE_SCALED_POWER_BY_TWO_CHAIN) reduction += REDUCE_SCALED_POWER_BY_TWO_CHAIN;
scaled_power -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
else
scaled_power = 0;
break; break;
case 3: case 3:
if (scaled_power > REDUCE_SCALED_POWER_BY_THREE_CHAIN) reduction += REDUCE_SCALED_POWER_BY_THREE_CHAIN;
scaled_power -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
else
scaled_power = 0;
break; break;
} }
scaled_power = max((u16)0, scaled_power); if (power_limit > reduction)
power_limit -= reduction;
else
power_limit = 0;
return scaled_power; return power_limit;
} }
void ath9k_hw_update_regulatory_maxpower(struct ath_hw *ah) void ath9k_hw_update_regulatory_maxpower(struct ath_hw *ah)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment