aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Halperin <dhalperi@cs.washington.edu>2011-05-31 14:59:30 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-06-01 14:35:54 -0400
commit21fdc87248d1d28492c775e05fa92b3c8c7bc8db (patch)
treecd0f69b7a496b866d2a67cfcf12305b1e5060abc
parent333ba7325213f0a09dfa5ceeddb056d6ad74b3b5 (diff)
ath9k: fix two more bugs in tx power
This is the same fix as commit 841051602e3fa18ea468fe5a177aa92b6eb44b56 Author: Matteo Croce <technoboy85@gmail.com> Date: Fri Dec 3 02:25:08 2010 +0100 The ath9k driver subtracts 3 dBm to the txpower as with two radios the signal power is doubled. The resulting value is assigned in an u16 which overflows and makes the card work at full power. in two more places. I grepped the ath tree and didn't find any others. Cc: stable@kernel.org Signed-off-by: Daniel Halperin <dhalperi@cs.washington.edu> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.c10
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_9287.c10
2 files changed, 16 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index 0ca7635d0669..ff8150e46f0e 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -4645,10 +4645,16 @@ static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah,
4645 case 1: 4645 case 1:
4646 break; 4646 break;
4647 case 2: 4647 case 2:
4648 scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; 4648 if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN)
4649 scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
4650 else
4651 scaledPower = 0;
4649 break; 4652 break;
4650 case 3: 4653 case 3:
4651 scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; 4654 if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN)
4655 scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
4656 else
4657 scaledPower = 0;
4652 break; 4658 break;
4653 } 4659 }
4654 4660
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
index 7856f0d4512d..343fc9f946db 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
@@ -524,10 +524,16 @@ static void ath9k_hw_set_ar9287_power_per_rate_table(struct ath_hw *ah,
524 case 1: 524 case 1:
525 break; 525 break;
526 case 2: 526 case 2:
527 scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; 527 if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN)
528 scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
529 else
530 scaledPower = 0;
528 break; 531 break;
529 case 3: 532 case 3:
530 scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; 533 if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN)
534 scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
535 else
536 scaledPower = 0;
531 break; 537 break;
532 } 538 }
533 scaledPower = max((u16)0, scaledPower); 539 scaledPower = max((u16)0, scaledPower);