aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2009-03-30 22:30:27 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:37 -0400
commitfc2ada30cacc28c96eabc598d3ef294338d8dcf5 (patch)
tree7bf4c3c16c763a881937c2faf5b17d9d6a238ef8 /drivers/net/wireless
parent55a3757a5703ebc58612ffbfbcb7f193dae17df7 (diff)
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: Bob Copeland <me@bobcopeland.com> Acked-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath9k/regd.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath9k/regd.c b/drivers/net/wireless/ath9k/regd.c
index 4ca625102291..43ed35ba95cf 100644
--- a/drivers/net/wireless/ath9k/regd.c
+++ b/drivers/net/wireless/ath9k/regd.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <net/wireless.h>
19#include "ath9k.h" 20#include "ath9k.h"
20#include "regd_common.h" 21#include "regd_common.h"
21 22
@@ -492,28 +493,37 @@ int ath9k_regd_init(struct ath_hw *ah)
492 return 0; 493 return 0;
493} 494}
494 495
495u32 ath9k_regd_get_ctl(struct ath_hw *ah, struct ath9k_channel *chan) 496static
497u32 ath9k_regd_get_band_ctl(struct ath_hw *ah, enum ieee80211_band band)
496{ 498{
497 u32 ctl = NO_CTL;
498
499 if (!ah->regulatory.regpair || 499 if (!ah->regulatory.regpair ||
500 (ah->regulatory.country_code == CTRY_DEFAULT && 500 (ah->regulatory.country_code == CTRY_DEFAULT &&
501 is_wwr_sku(ath9k_regd_get_eepromRD(ah)))) { 501 is_wwr_sku(ath9k_regd_get_eepromRD(ah)))) {
502 if (IS_CHAN_B(chan)) 502 return SD_NO_CTL;
503 ctl = SD_NO_CTL | CTL_11B; 503 }
504 else if (IS_CHAN_G(chan)) 504
505 ctl = SD_NO_CTL | CTL_11G; 505 switch (band) {
506 else 506 case IEEE80211_BAND_2GHZ:
507 ctl = SD_NO_CTL | CTL_11A; 507 return ah->regulatory.regpair->reg_2ghz_ctl;
508 return ctl; 508 case IEEE80211_BAND_5GHZ:
509 return ah->regulatory.regpair->reg_5ghz_ctl;
510 default:
511 return NO_CTL;
509 } 512 }
510 513
514 return NO_CTL;
515}
516
517u32 ath9k_regd_get_ctl(struct ath_hw *ah, struct ath9k_channel *chan)
518{
519 u32 ctl = ath9k_regd_get_band_ctl(ah, chan->chan->band);
520
511 if (IS_CHAN_B(chan)) 521 if (IS_CHAN_B(chan))
512 ctl = ah->regulatory.regpair->reg_2ghz_ctl | CTL_11B; 522 ctl |= CTL_11B;
513 else if (IS_CHAN_G(chan)) 523 else if (IS_CHAN_G(chan))
514 ctl = ah->regulatory.regpair->reg_2ghz_ctl | CTL_11G; 524 ctl |= CTL_11G;
515 else 525 else
516 ctl = ah->regulatory.regpair->reg_5ghz_ctl | CTL_11A; 526 ctl |= CTL_11A;
517 527
518 return ctl; 528 return ctl;
519} 529}