1 --- a/drivers/net/wireless/ath/regd.c
2 +++ b/drivers/net/wireless/ath/regd.c
4 #include "regd_common.h"
6 static int __ath_regd_init(struct ath_regulatory *reg);
7 +static struct reg_dmn_pair_mapping *ath_get_regpair(int regdmn);
10 * This is a set of common rules used by our world regulatory domains.
11 @@ -116,6 +117,9 @@ static const struct ieee80211_regdomain
13 static bool dynamic_country_user_possible(struct ath_regulatory *reg)
15 + if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
18 if (IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_CERT_TESTING))
21 @@ -188,6 +192,8 @@ static bool dynamic_country_user_possibl
23 static bool ath_reg_dyn_country_user_allow(struct ath_regulatory *reg)
25 + if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
27 if (!IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_REG_HINTS))
29 if (!dynamic_country_user_possible(reg))
30 @@ -341,6 +347,9 @@ ath_reg_apply_beaconing_flags(struct wip
31 struct ieee80211_channel *ch;
34 + if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
37 for (band = 0; band < NUM_NL80211_BANDS; band++) {
38 if (!wiphy->bands[band])
40 @@ -374,6 +383,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip
42 struct ieee80211_supported_band *sband;
44 + if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
47 sband = wiphy->bands[NL80211_BAND_2GHZ];
50 @@ -402,6 +414,9 @@ static void ath_reg_apply_radar_flags(st
51 struct ieee80211_channel *ch;
54 + if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
57 if (!wiphy->bands[NL80211_BAND_5GHZ])
60 @@ -539,6 +554,11 @@ void ath_reg_notifier_apply(struct wiphy
61 ath_reg_dyn_country(wiphy, reg, request);
65 + /* Prevent broken CTLs from being applied */
66 + if (IS_ENABLED(CPTCFG_ATH_USER_REGD) &&
67 + reg->regpair != common->reg_world_copy.regpair)
68 + reg->regpair = ath_get_regpair(WOR0_WORLD);
70 EXPORT_SYMBOL(ath_reg_notifier_apply);
72 @@ -634,6 +654,10 @@ ath_regd_init_wiphy(struct ath_regulator
73 const struct ieee80211_regdomain *regd;
75 wiphy->reg_notifier = reg_notifier;
77 + if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
80 wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
81 REGULATORY_CUSTOM_REG;
83 @@ -762,10 +786,7 @@ ath_regd_init(struct ath_regulatory *reg
87 - if (ath_is_world_regd(reg))
88 - memcpy(&common->reg_world_copy, reg,
89 - sizeof(struct ath_regulatory));
91 + memcpy(&common->reg_world_copy, reg, sizeof(struct ath_regulatory));
92 ath_regd_init_wiphy(reg, wiphy, reg_notifier);
95 --- a/drivers/net/wireless/ath/Kconfig
96 +++ b/drivers/net/wireless/ath/Kconfig
97 @@ -23,6 +23,9 @@ config WLAN_VENDOR_ATH
101 +config ATH_USER_REGD
102 + bool "Do not enforce EEPROM regulatory restrictions"
105 bool "Atheros wireless debugging"
109 @@ -130,6 +130,7 @@ ADM8211=
115 ATH_REG_DYNAMIC_USER_REG_HINTS=
116 ATH_REG_DYNAMIC_USER_CERT_TESTING=