summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-04-14 22:01:59 +0200
committerJohn W. Linville <linville@tuxdriver.com>2012-04-16 14:38:54 -0400
commit8f942b9b8165eb4079d38979ec37a2bf3f983761 (patch)
tree28fd2ee8071a7d0549f38aa6fc6c3e2db891b899
parentea6f792b2b893249e0eeffdb3fe0ea191eaf80d7 (diff)
downloadop-kernel-dev-8f942b9b8165eb4079d38979ec37a2bf3f983761.zip
op-kernel-dev-8f942b9b8165eb4079d38979ec37a2bf3f983761.tar.gz
ath9k: simplify ath9k_hw_get_scaled_power function
Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
index 61bad99..6a64dec 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -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,
u8 antenna_reduction)
{
- u16 scaled_power;
-
- scaled_power = power_limit - antenna_reduction;
+ u16 reduction = antenna_reduction;
/*
* 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,
case 1:
break;
case 2:
- if (scaled_power > REDUCE_SCALED_POWER_BY_TWO_CHAIN)
- scaled_power -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
- else
- scaled_power = 0;
+ reduction += REDUCE_SCALED_POWER_BY_TWO_CHAIN;
break;
case 3:
- if (scaled_power > REDUCE_SCALED_POWER_BY_THREE_CHAIN)
- scaled_power -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
- else
- scaled_power = 0;
+ reduction += REDUCE_SCALED_POWER_BY_THREE_CHAIN;
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)
OpenPOWER on IntegriCloud