aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath/regd.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 7a89f9fac7d4..eef370bd1211 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -366,11 +366,17 @@ static bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg)
366 if (rd & COUNTRY_ERD_FLAG) { 366 if (rd & COUNTRY_ERD_FLAG) {
367 /* EEPROM value is a country code */ 367 /* EEPROM value is a country code */
368 u16 cc = rd & ~COUNTRY_ERD_FLAG; 368 u16 cc = rd & ~COUNTRY_ERD_FLAG;
369 printk(KERN_DEBUG
370 "ath: EEPROM indicates we should expect "
371 "a country code\n");
369 for (i = 0; i < ARRAY_SIZE(allCountries); i++) 372 for (i = 0; i < ARRAY_SIZE(allCountries); i++)
370 if (allCountries[i].countryCode == cc) 373 if (allCountries[i].countryCode == cc)
371 return true; 374 return true;
372 } else { 375 } else {
373 /* EEPROM value is a regpair value */ 376 /* EEPROM value is a regpair value */
377 if (rd != CTRY_DEFAULT)
378 printk(KERN_DEBUG "ath: EEPROM indicates we "
379 "should expect a direct regpair map\n");
374 for (i = 0; i < ARRAY_SIZE(regDomainPairs); i++) 380 for (i = 0; i < ARRAY_SIZE(regDomainPairs); i++)
375 if (regDomainPairs[i].regDmnEnum == rd) 381 if (regDomainPairs[i].regDmnEnum == rd)
376 return true; 382 return true;
@@ -477,6 +483,11 @@ ath_regd_init(struct ath_regulatory *reg,
477 struct country_code_to_enum_rd *country = NULL; 483 struct country_code_to_enum_rd *country = NULL;
478 u16 regdmn; 484 u16 regdmn;
479 485
486 if (!reg)
487 return -EINVAL;
488
489 printk(KERN_DEBUG "ath: EEPROM regdomain: 0x%0x\n", reg->current_rd);
490
480 if (!ath_regd_is_eeprom_valid(reg)) { 491 if (!ath_regd_is_eeprom_valid(reg)) {
481 printk(KERN_ERR "ath: Invalid EEPROM contents\n"); 492 printk(KERN_ERR "ath: Invalid EEPROM contents\n");
482 return -EINVAL; 493 return -EINVAL;
@@ -486,20 +497,30 @@ ath_regd_init(struct ath_regulatory *reg,
486 reg->country_code = ath_regd_get_default_country(regdmn); 497 reg->country_code = ath_regd_get_default_country(regdmn);
487 498
488 if (reg->country_code == CTRY_DEFAULT && 499 if (reg->country_code == CTRY_DEFAULT &&
489 regdmn == CTRY_DEFAULT) 500 regdmn == CTRY_DEFAULT) {
501 printk(KERN_DEBUG "ath: EEPROM indicates default "
502 "country code should be used\n");
490 reg->country_code = CTRY_UNITED_STATES; 503 reg->country_code = CTRY_UNITED_STATES;
504 }
491 505
492 if (reg->country_code == CTRY_DEFAULT) { 506 if (reg->country_code == CTRY_DEFAULT) {
493 country = NULL; 507 country = NULL;
494 } else { 508 } else {
509 printk(KERN_DEBUG "ath: doing EEPROM country->regdmn "
510 "map search\n");
495 country = ath_regd_find_country(reg->country_code); 511 country = ath_regd_find_country(reg->country_code);
496 if (country == NULL) { 512 if (country == NULL) {
497 printk(KERN_DEBUG 513 printk(KERN_DEBUG
498 "ath: Country is NULL!!!!, cc= %d\n", 514 "ath: no valid country maps found for "
515 "country code: 0x%0x\n",
499 reg->country_code); 516 reg->country_code);
500 return -EINVAL; 517 return -EINVAL;
501 } else 518 } else {
502 regdmn = country->regDmnEnum; 519 regdmn = country->regDmnEnum;
520 printk(KERN_DEBUG "ath: country maps to "
521 "regdmn code: 0x%0x\n",
522 regdmn);
523 }
503 } 524 }
504 525
505 reg->regpair = ath_get_regpair(regdmn); 526 reg->regpair = ath_get_regpair(regdmn);
@@ -523,7 +544,7 @@ ath_regd_init(struct ath_regulatory *reg,
523 544
524 printk(KERN_DEBUG "ath: Country alpha2 being used: %c%c\n", 545 printk(KERN_DEBUG "ath: Country alpha2 being used: %c%c\n",
525 reg->alpha2[0], reg->alpha2[1]); 546 reg->alpha2[0], reg->alpha2[1]);
526 printk(KERN_DEBUG "ath: Regpair detected: 0x%0x\n", 547 printk(KERN_DEBUG "ath: Regpair used: 0x%0x\n",
527 reg->regpair->regDmnEnum); 548 reg->regpair->regDmnEnum);
528 549
529 ath_regd_init_wiphy(reg, wiphy, reg_notifier); 550 ath_regd_init_wiphy(reg, wiphy, reg_notifier);