diff options
author | Bob Copeland <me@bobcopeland.com> | 2009-03-30 22:30:30 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-04-22 16:54:37 -0400 |
commit | e3bb249be89dd387e78ca382d08fad31745edac9 (patch) | |
tree | 9050d6502ace74b8c5c3577825d1b91011fce8be /drivers/net/wireless/ath | |
parent | 3a702e49c03ba959e3f5bb2b74ec9921a81c8c98 (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.c | 55 | ||||
-rw-r--r-- | drivers/net/wireless/ath/regd.h | 12 |
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 | } |
127 | EXPORT_SYMBOL(ath_is_world_regd); | 127 | EXPORT_SYMBOL(ath_is_world_regd); |
128 | 128 | ||
129 | const struct ieee80211_regdomain *ath_default_world_regdomain(void) | 129 | static 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 | } |
134 | EXPORT_SYMBOL(ath_default_world_regdomain); | ||
135 | 134 | ||
136 | const struct | 135 | static const struct |
137 | ieee80211_regdomain *ath_world_regdomain(struct ath_regulatory *reg) | 136 | ieee80211_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 | } |
161 | EXPORT_SYMBOL(ath_world_regdomain); | ||
162 | 160 | ||
163 | /* Frequency is one where radar detection is required */ | 161 | /* Frequency is one where radar detection is required */ |
164 | static bool ath_is_radar_freq(u16 center_freq) | 162 | static 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 */ |
288 | void ath_reg_apply_radar_flags(struct wiphy *wiphy) | 286 | static 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 | } |
319 | EXPORT_SYMBOL(ath_reg_apply_radar_flags); | ||
320 | 317 | ||
321 | void ath_reg_apply_world_flags(struct wiphy *wiphy, | 318 | static 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 | } |
339 | EXPORT_SYMBOL(ath_reg_apply_world_flags); | ||
340 | 336 | ||
341 | int ath_reg_notifier_apply(struct wiphy *wiphy, | 337 | int 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 | } |
361 | EXPORT_SYMBOL(ath_reg_notifier_apply); | 357 | EXPORT_SYMBOL(ath_reg_notifier_apply); |
362 | 358 | ||
363 | bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg) | 359 | static 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 | } |
384 | EXPORT_SYMBOL(ath_regd_is_eeprom_valid); | ||
385 | 380 | ||
386 | /* EEPROM country code to regpair mapping */ | 381 | /* EEPROM country code to regpair mapping */ |
387 | static struct country_code_to_enum_rd* | 382 | static 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 | ||
441 | int ath_regd_init(struct ath_regulatory *reg) | 436 | static 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 | |||
467 | int 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 | } |
497 | EXPORT_SYMBOL(ath_regd_init); | 526 | EXPORT_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 | ||
256 | bool ath_is_world_regd(struct ath_regulatory *reg); | 256 | bool ath_is_world_regd(struct ath_regulatory *reg); |
257 | const | 257 | int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy, |
258 | struct ieee80211_regdomain *ath_world_regdomain(struct ath_regulatory *reg); | 258 | int (*reg_notifier)(struct wiphy *wiphy, |
259 | const struct ieee80211_regdomain *ath_default_world_regdomain(void); | 259 | struct regulatory_request *request)); |
260 | void ath_reg_apply_world_flags(struct wiphy *wiphy, | ||
261 | enum nl80211_reg_initiator, | ||
262 | struct ath_regulatory *reg); | ||
263 | void ath_reg_apply_radar_flags(struct wiphy *wiphy); | ||
264 | int ath_regd_init(struct ath_regulatory *reg); | ||
265 | bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg); | ||
266 | u32 ath_regd_get_band_ctl(struct ath_regulatory *reg, | 260 | u32 ath_regd_get_band_ctl(struct ath_regulatory *reg, |
267 | enum ieee80211_band band); | 261 | enum ieee80211_band band); |
268 | int ath_reg_notifier_apply(struct wiphy *wiphy, | 262 | int ath_reg_notifier_apply(struct wiphy *wiphy, |