aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2009-03-30 22:30:30 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:37 -0400
commite3bb249be89dd387e78ca382d08fad31745edac9 (patch)
tree9050d6502ace74b8c5c3577825d1b91011fce8be /drivers/net/wireless/ath
parent3a702e49c03ba959e3f5bb2b74ec9921a81c8c98 (diff)
ath: move more setup code into ath_regd_init
Setup the wiphy regulatory parameters when first initializing the Atheros regulatory module. We can remove five exported symbols this way and simplify the driver code for both ath5k and ath9k. Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/regd.c55
-rw-r--r--drivers/net/wireless/ath/regd.h12
2 files changed, 45 insertions, 22 deletions
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 4d3935b6fbdd..3ccf21cceb5a 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -126,14 +126,13 @@ bool ath_is_world_regd(struct ath_regulatory *reg)
126} 126}
127EXPORT_SYMBOL(ath_is_world_regd); 127EXPORT_SYMBOL(ath_is_world_regd);
128 128
129const struct ieee80211_regdomain *ath_default_world_regdomain(void) 129static const struct ieee80211_regdomain *ath_default_world_regdomain(void)
130{ 130{
131 /* this is the most restrictive */ 131 /* this is the most restrictive */
132 return &ath_world_regdom_64; 132 return &ath_world_regdom_64;
133} 133}
134EXPORT_SYMBOL(ath_default_world_regdomain);
135 134
136const struct 135static const struct
137ieee80211_regdomain *ath_world_regdomain(struct ath_regulatory *reg) 136ieee80211_regdomain *ath_world_regdomain(struct ath_regulatory *reg)
138{ 137{
139 switch (reg->regpair->regDmnEnum) { 138 switch (reg->regpair->regDmnEnum) {
@@ -158,7 +157,6 @@ ieee80211_regdomain *ath_world_regdomain(struct ath_regulatory *reg)
158 return ath_default_world_regdomain(); 157 return ath_default_world_regdomain();
159 } 158 }
160} 159}
161EXPORT_SYMBOL(ath_world_regdomain);
162 160
163/* Frequency is one where radar detection is required */ 161/* Frequency is one where radar detection is required */
164static bool ath_is_radar_freq(u16 center_freq) 162static bool ath_is_radar_freq(u16 center_freq)
@@ -285,7 +283,7 @@ static void ath_reg_apply_active_scan_flags(
285} 283}
286 284
287/* Always apply Radar/DFS rules on freq range 5260 MHz - 5700 MHz */ 285/* Always apply Radar/DFS rules on freq range 5260 MHz - 5700 MHz */
288void ath_reg_apply_radar_flags(struct wiphy *wiphy) 286static void ath_reg_apply_radar_flags(struct wiphy *wiphy)
289{ 287{
290 struct ieee80211_supported_band *sband; 288 struct ieee80211_supported_band *sband;
291 struct ieee80211_channel *ch; 289 struct ieee80211_channel *ch;
@@ -316,11 +314,10 @@ void ath_reg_apply_radar_flags(struct wiphy *wiphy)
316 IEEE80211_CHAN_PASSIVE_SCAN; 314 IEEE80211_CHAN_PASSIVE_SCAN;
317 } 315 }
318} 316}
319EXPORT_SYMBOL(ath_reg_apply_radar_flags);
320 317
321void ath_reg_apply_world_flags(struct wiphy *wiphy, 318static void ath_reg_apply_world_flags(struct wiphy *wiphy,
322 enum nl80211_reg_initiator initiator, 319 enum nl80211_reg_initiator initiator,
323 struct ath_regulatory *reg) 320 struct ath_regulatory *reg)
324{ 321{
325 switch (reg->regpair->regDmnEnum) { 322 switch (reg->regpair->regDmnEnum) {
326 case 0x60: 323 case 0x60:
@@ -336,7 +333,6 @@ void ath_reg_apply_world_flags(struct wiphy *wiphy,
336 } 333 }
337 return; 334 return;
338} 335}
339EXPORT_SYMBOL(ath_reg_apply_world_flags);
340 336
341int ath_reg_notifier_apply(struct wiphy *wiphy, 337int ath_reg_notifier_apply(struct wiphy *wiphy,
342 struct regulatory_request *request, struct ath_regulatory *reg) 338 struct regulatory_request *request, struct ath_regulatory *reg)
@@ -360,7 +356,7 @@ int ath_reg_notifier_apply(struct wiphy *wiphy,
360} 356}
361EXPORT_SYMBOL(ath_reg_notifier_apply); 357EXPORT_SYMBOL(ath_reg_notifier_apply);
362 358
363bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg) 359static bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg)
364{ 360{
365 u16 rd = ath_regd_get_eepromRD(reg); 361 u16 rd = ath_regd_get_eepromRD(reg);
366 int i; 362 int i;
@@ -381,7 +377,6 @@ bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg)
381 "ath: invalid regulatory domain/country code 0x%x\n", rd); 377 "ath: invalid regulatory domain/country code 0x%x\n", rd);
382 return false; 378 return false;
383} 379}
384EXPORT_SYMBOL(ath_regd_is_eeprom_valid);
385 380
386/* EEPROM country code to regpair mapping */ 381/* EEPROM country code to regpair mapping */
387static struct country_code_to_enum_rd* 382static struct country_code_to_enum_rd*
@@ -438,7 +433,40 @@ ath_get_regpair(int regdmn)
438 return NULL; 433 return NULL;
439} 434}
440 435
441int ath_regd_init(struct ath_regulatory *reg) 436static int ath_regd_init_wiphy(struct ath_regulatory *reg, struct wiphy *wiphy,
437 int (*reg_notifier)(struct wiphy *wiphy,
438 struct regulatory_request *request))
439{
440 const struct ieee80211_regdomain *regd;
441
442 wiphy->reg_notifier = reg_notifier;
443 wiphy->strict_regulatory = true;
444
445 if (ath_is_world_regd(reg)) {
446 /*
447 * Anything applied here (prior to wiphy registration) gets
448 * saved on the wiphy orig_* parameters
449 */
450 regd = ath_world_regdomain(reg);
451 wiphy->custom_regulatory = true;
452 wiphy->strict_regulatory = false;
453 } else {
454 /*
455 * This gets applied in the case of the absense of CRDA,
456 * it's our own custom world regulatory domain, similar to
457 * cfg80211's but we enable passive scanning.
458 */
459 regd = ath_default_world_regdomain();
460 }
461 wiphy_apply_custom_regulatory(wiphy, regd);
462 ath_reg_apply_radar_flags(wiphy);
463 ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg);
464 return 0;
465}
466
467int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy,
468 int (*reg_notifier)(struct wiphy *wiphy,
469 struct regulatory_request *request))
442{ 470{
443 struct country_code_to_enum_rd *country = NULL; 471 struct country_code_to_enum_rd *country = NULL;
444 u16 regdmn; 472 u16 regdmn;
@@ -492,6 +520,7 @@ int ath_regd_init(struct ath_regulatory *reg)
492 printk(KERN_DEBUG "ath: Regpair detected: 0x%0x\n", 520 printk(KERN_DEBUG "ath: Regpair detected: 0x%0x\n",
493 reg->regpair->regDmnEnum); 521 reg->regpair->regDmnEnum);
494 522
523 ath_regd_init_wiphy(reg, wiphy, reg_notifier);
495 return 0; 524 return 0;
496} 525}
497EXPORT_SYMBOL(ath_regd_init); 526EXPORT_SYMBOL(ath_regd_init);
diff --git a/drivers/net/wireless/ath/regd.h b/drivers/net/wireless/ath/regd.h
index 981f5cf2bdb8..eba7c7123b50 100644
--- a/drivers/net/wireless/ath/regd.h
+++ b/drivers/net/wireless/ath/regd.h
@@ -254,15 +254,9 @@ enum CountryCode {
254}; 254};
255 255
256bool ath_is_world_regd(struct ath_regulatory *reg); 256bool ath_is_world_regd(struct ath_regulatory *reg);
257const 257int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy,
258struct ieee80211_regdomain *ath_world_regdomain(struct ath_regulatory *reg); 258 int (*reg_notifier)(struct wiphy *wiphy,
259const struct ieee80211_regdomain *ath_default_world_regdomain(void); 259 struct regulatory_request *request));
260void ath_reg_apply_world_flags(struct wiphy *wiphy,
261 enum nl80211_reg_initiator,
262 struct ath_regulatory *reg);
263void ath_reg_apply_radar_flags(struct wiphy *wiphy);
264int ath_regd_init(struct ath_regulatory *reg);
265bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg);
266u32 ath_regd_get_band_ctl(struct ath_regulatory *reg, 260u32 ath_regd_get_band_ctl(struct ath_regulatory *reg,
267 enum ieee80211_band band); 261 enum ieee80211_band band);
268int ath_reg_notifier_apply(struct wiphy *wiphy, 262int ath_reg_notifier_apply(struct wiphy *wiphy,