Skip to content

Commit 931749b

Browse files
Mohammed Shafi Shajakhanlinvjw
authored andcommitted
ath9k: make use of a helper to get paprd scale factor
Signed-off-by: Mohammed Shafi Shajakhan <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent 36cb7cc commit 931749b

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

drivers/net/wireless/ath/ath9k/ar9003_paprd.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,10 @@ EXPORT_SYMBOL(ar9003_paprd_enable);
4646

4747
static int ar9003_get_training_power_2g(struct ath_hw *ah)
4848
{
49-
struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
50-
struct ar9300_modal_eep_header *hdr = &eep->modalHeader2G;
49+
struct ath9k_channel *chan = ah->curchan;
5150
unsigned int power, scale, delta;
5251

53-
scale = MS(le32_to_cpu(hdr->papdRateMaskHt20), AR9300_PAPRD_SCALE_1);
52+
scale = ar9003_get_paprd_scale_factor(ah, chan);
5453
power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE5,
5554
AR_PHY_POWERTX_RATE5_POWERTXHT20_0);
5655

@@ -67,20 +66,10 @@ static int ar9003_get_training_power_2g(struct ath_hw *ah)
6766
static int ar9003_get_training_power_5g(struct ath_hw *ah)
6867
{
6968
struct ath_common *common = ath9k_hw_common(ah);
70-
struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
71-
struct ar9300_modal_eep_header *hdr = &eep->modalHeader5G;
7269
struct ath9k_channel *chan = ah->curchan;
7370
unsigned int power, scale, delta;
7471

75-
if (chan->channel >= 5700)
76-
scale = MS(le32_to_cpu(hdr->papdRateMaskHt20),
77-
AR9300_PAPRD_SCALE_1);
78-
else if (chan->channel >= 5400)
79-
scale = MS(le32_to_cpu(hdr->papdRateMaskHt40),
80-
AR9300_PAPRD_SCALE_2);
81-
else
82-
scale = MS(le32_to_cpu(hdr->papdRateMaskHt40),
83-
AR9300_PAPRD_SCALE_1);
72+
scale = ar9003_get_paprd_scale_factor(ah, chan);
8473

8574
if (IS_CHAN_HT40(chan))
8675
power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE8,

0 commit comments

Comments
 (0)