Commit e775aaf0 authored by Bob Copeland's avatar Bob Copeland Committed by John W. Linville

ath9k: save a few calls to ath9k_regd_get_eepromRD

Since we already have a stack variable to track the eeprom regd,
we can grab it up front it and save three calls to fetch it again.
Signed-off-by: default avatarBob Copeland <me@bobcopeland.com>
Acked-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 63a7c8e2
...@@ -371,11 +371,8 @@ ath9k_regd_find_country_by_rd(int regdmn) ...@@ -371,11 +371,8 @@ ath9k_regd_find_country_by_rd(int regdmn)
} }
/* Returns the map of the EEPROM set RD to a country code */ /* Returns the map of the EEPROM set RD to a country code */
static u16 ath9k_regd_get_default_country(struct ath_hw *ah) static u16 ath9k_regd_get_default_country(u16 rd)
{ {
u16 rd;
rd = ath9k_regd_get_eepromRD(ah);
if (rd & COUNTRY_ERD_FLAG) { if (rd & COUNTRY_ERD_FLAG) {
struct country_code_to_enum_rd *country = NULL; struct country_code_to_enum_rd *country = NULL;
u16 cc = rd & ~COUNTRY_ERD_FLAG; u16 cc = rd & ~COUNTRY_ERD_FLAG;
...@@ -405,7 +402,7 @@ ath9k_get_regpair(int regdmn) ...@@ -405,7 +402,7 @@ ath9k_get_regpair(int regdmn)
int ath9k_regd_init(struct ath_hw *ah) int ath9k_regd_init(struct ath_hw *ah)
{ {
struct country_code_to_enum_rd *country = NULL; struct country_code_to_enum_rd *country = NULL;
int regdmn; u16 regdmn;
if (!ath9k_regd_is_eeprom_valid(ah)) { if (!ath9k_regd_is_eeprom_valid(ah)) {
DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
...@@ -413,14 +410,14 @@ int ath9k_regd_init(struct ath_hw *ah) ...@@ -413,14 +410,14 @@ int ath9k_regd_init(struct ath_hw *ah)
return -EINVAL; return -EINVAL;
} }
ah->regulatory.country_code = ath9k_regd_get_default_country(ah); regdmn = ath9k_regd_get_eepromRD(ah);
ah->regulatory.country_code = ath9k_regd_get_default_country(regdmn);
if (ah->regulatory.country_code == CTRY_DEFAULT && if (ah->regulatory.country_code == CTRY_DEFAULT &&
ath9k_regd_get_eepromRD(ah) == CTRY_DEFAULT) regdmn == CTRY_DEFAULT)
ah->regulatory.country_code = CTRY_UNITED_STATES; ah->regulatory.country_code = CTRY_UNITED_STATES;
if (ah->regulatory.country_code == CTRY_DEFAULT) { if (ah->regulatory.country_code == CTRY_DEFAULT) {
regdmn = ath9k_regd_get_eepromRD(ah);
country = NULL; country = NULL;
} else { } else {
country = ath9k_regd_find_country(ah->regulatory.country_code); country = ath9k_regd_find_country(ah->regulatory.country_code);
......
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