1
0

402-ath_regd_optional.patch 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. --- a/drivers/net/wireless/ath/regd.c
  2. +++ b/drivers/net/wireless/ath/regd.c
  3. @@ -24,6 +24,7 @@
  4. #include "regd_common.h"
  5. static int __ath_regd_init(struct ath_regulatory *reg);
  6. +static struct reg_dmn_pair_mapping *ath_get_regpair(int regdmn);
  7. /*
  8. * This is a set of common rules used by our world regulatory domains.
  9. @@ -116,6 +117,9 @@ static const struct ieee80211_regdomain
  10. static bool dynamic_country_user_possible(struct ath_regulatory *reg)
  11. {
  12. + if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
  13. + return true;
  14. +
  15. if (IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_CERT_TESTING))
  16. return true;
  17. @@ -188,6 +192,8 @@ static bool dynamic_country_user_possibl
  18. static bool ath_reg_dyn_country_user_allow(struct ath_regulatory *reg)
  19. {
  20. + if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
  21. + return true;
  22. if (!IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_REG_HINTS))
  23. return false;
  24. if (!dynamic_country_user_possible(reg))
  25. @@ -341,6 +347,9 @@ ath_reg_apply_beaconing_flags(struct wip
  26. struct ieee80211_channel *ch;
  27. unsigned int i;
  28. + if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
  29. + return;
  30. +
  31. for (band = 0; band < NUM_NL80211_BANDS; band++) {
  32. if (!wiphy->bands[band])
  33. continue;
  34. @@ -374,6 +383,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip
  35. {
  36. struct ieee80211_supported_band *sband;
  37. + if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
  38. + return;
  39. +
  40. sband = wiphy->bands[NL80211_BAND_2GHZ];
  41. if (!sband)
  42. return;
  43. @@ -402,6 +414,9 @@ static void ath_reg_apply_radar_flags(st
  44. struct ieee80211_channel *ch;
  45. unsigned int i;
  46. + if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
  47. + return;
  48. +
  49. if (!wiphy->bands[NL80211_BAND_5GHZ])
  50. return;
  51. @@ -539,6 +554,11 @@ void ath_reg_notifier_apply(struct wiphy
  52. ath_reg_dyn_country(wiphy, reg, request);
  53. break;
  54. }
  55. +
  56. + /* Prevent broken CTLs from being applied */
  57. + if (IS_ENABLED(CPTCFG_ATH_USER_REGD) &&
  58. + reg->regpair != common->reg_world_copy.regpair)
  59. + reg->regpair = ath_get_regpair(WOR0_WORLD);
  60. }
  61. EXPORT_SYMBOL(ath_reg_notifier_apply);
  62. @@ -634,6 +654,10 @@ ath_regd_init_wiphy(struct ath_regulator
  63. const struct ieee80211_regdomain *regd;
  64. wiphy->reg_notifier = reg_notifier;
  65. +
  66. + if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
  67. + return 0;
  68. +
  69. wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
  70. REGULATORY_CUSTOM_REG;
  71. @@ -762,10 +786,7 @@ ath_regd_init(struct ath_regulatory *reg
  72. if (r)
  73. return r;
  74. - if (ath_is_world_regd(reg))
  75. - memcpy(&common->reg_world_copy, reg,
  76. - sizeof(struct ath_regulatory));
  77. -
  78. + memcpy(&common->reg_world_copy, reg, sizeof(struct ath_regulatory));
  79. ath_regd_init_wiphy(reg, wiphy, reg_notifier);
  80. return 0;
  81. --- a/drivers/net/wireless/ath/Kconfig
  82. +++ b/drivers/net/wireless/ath/Kconfig
  83. @@ -23,6 +23,9 @@ config WLAN_VENDOR_ATH
  84. if WLAN_VENDOR_ATH
  85. +config ATH_USER_REGD
  86. + bool "Do not enforce EEPROM regulatory restrictions"
  87. +
  88. config ATH_DEBUG
  89. bool "Atheros wireless debugging"
  90. ---help---
  91. --- a/.local-symbols
  92. +++ b/.local-symbols
  93. @@ -130,6 +130,7 @@ ADM8211=
  94. ATH_COMMON=
  95. WLAN_VENDOR_ATH=
  96. ATH_DEBUG=
  97. +ATH_USER_REGD=
  98. ATH_TRACEPOINTS=
  99. ATH_REG_DYNAMIC_USER_REG_HINTS=
  100. ATH_REG_DYNAMIC_USER_CERT_TESTING=