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

ath9k: separate ath9k specific code from ath9k_regd_get_ctl()

Until ath5k and ath9k share common channel structures, they will have
to implement their own get_ctl() function.  Split out the portion that
only relies on the current band and reg domain so that it can be common
code.
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 55a3757a
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <net/wireless.h>
#include "ath9k.h" #include "ath9k.h"
#include "regd_common.h" #include "regd_common.h"
...@@ -492,28 +493,37 @@ int ath9k_regd_init(struct ath_hw *ah) ...@@ -492,28 +493,37 @@ int ath9k_regd_init(struct ath_hw *ah)
return 0; return 0;
} }
u32 ath9k_regd_get_ctl(struct ath_hw *ah, struct ath9k_channel *chan) static
u32 ath9k_regd_get_band_ctl(struct ath_hw *ah, enum ieee80211_band band)
{ {
u32 ctl = NO_CTL;
if (!ah->regulatory.regpair || if (!ah->regulatory.regpair ||
(ah->regulatory.country_code == CTRY_DEFAULT && (ah->regulatory.country_code == CTRY_DEFAULT &&
is_wwr_sku(ath9k_regd_get_eepromRD(ah)))) { is_wwr_sku(ath9k_regd_get_eepromRD(ah)))) {
if (IS_CHAN_B(chan)) return SD_NO_CTL;
ctl = SD_NO_CTL | CTL_11B; }
else if (IS_CHAN_G(chan))
ctl = SD_NO_CTL | CTL_11G; switch (band) {
else case IEEE80211_BAND_2GHZ:
ctl = SD_NO_CTL | CTL_11A; return ah->regulatory.regpair->reg_2ghz_ctl;
return ctl; case IEEE80211_BAND_5GHZ:
return ah->regulatory.regpair->reg_5ghz_ctl;
default:
return NO_CTL;
} }
return NO_CTL;
}
u32 ath9k_regd_get_ctl(struct ath_hw *ah, struct ath9k_channel *chan)
{
u32 ctl = ath9k_regd_get_band_ctl(ah, chan->chan->band);
if (IS_CHAN_B(chan)) if (IS_CHAN_B(chan))
ctl = ah->regulatory.regpair->reg_2ghz_ctl | CTL_11B; ctl |= CTL_11B;
else if (IS_CHAN_G(chan)) else if (IS_CHAN_G(chan))
ctl = ah->regulatory.regpair->reg_2ghz_ctl | CTL_11G; ctl |= CTL_11G;
else else
ctl = ah->regulatory.regpair->reg_5ghz_ctl | CTL_11A; ctl |= CTL_11A;
return ctl; return ctl;
} }
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