7a7c2d4174f9eb8f2ed0f5062516f7761ae26b6c
[librecmc/librecmc.git] / package / kernel / mac80211 / patches / 402-ath_regd_optional.patch
1 --- a/drivers/net/wireless/ath/regd.c
2 +++ b/drivers/net/wireless/ath/regd.c
3 @@ -116,6 +116,9 @@ static const struct ieee80211_regdomain
4  
5  static bool dynamic_country_user_possible(struct ath_regulatory *reg)
6  {
7 +       if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
8 +               return true;
9 +
10         if (IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_CERT_TESTING))
11                 return true;
12  
13 @@ -188,6 +191,8 @@ static bool dynamic_country_user_possibl
14  
15  static bool ath_reg_dyn_country_user_allow(struct ath_regulatory *reg)
16  {
17 +       if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
18 +               return true;
19         if (!IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_REG_HINTS))
20                 return false;
21         if (!dynamic_country_user_possible(reg))
22 @@ -341,6 +346,9 @@ ath_reg_apply_beaconing_flags(struct wip
23         struct ieee80211_channel *ch;
24         unsigned int i;
25  
26 +       if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
27 +               return;
28 +
29         for (band = 0; band < NUM_NL80211_BANDS; band++) {
30                 if (!wiphy->bands[band])
31                         continue;
32 @@ -374,6 +382,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip
33  {
34         struct ieee80211_supported_band *sband;
35  
36 +       if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
37 +               return;
38 +
39         sband = wiphy->bands[NL80211_BAND_2GHZ];
40         if (!sband)
41                 return;
42 @@ -402,6 +413,9 @@ static void ath_reg_apply_radar_flags(st
43         struct ieee80211_channel *ch;
44         unsigned int i;
45  
46 +       if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
47 +               return;
48 +
49         if (!wiphy->bands[NL80211_BAND_5GHZ])
50                 return;
51  
52 @@ -633,6 +647,10 @@ ath_regd_init_wiphy(struct ath_regulator
53         const struct ieee80211_regdomain *regd;
54  
55         wiphy->reg_notifier = reg_notifier;
56 +
57 +       if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
58 +               return 0;
59 +
60         wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
61                                    REGULATORY_CUSTOM_REG;
62  
63 --- a/drivers/net/wireless/ath/Kconfig
64 +++ b/drivers/net/wireless/ath/Kconfig
65 @@ -23,6 +23,9 @@ config WLAN_VENDOR_ATH
66  
67  if WLAN_VENDOR_ATH
68  
69 +config ATH_USER_REGD
70 +       bool "Do not enforce EEPROM regulatory restrictions"
71 +
72  config ATH_DEBUG
73         bool "Atheros wireless debugging"
74         ---help---
75 --- a/.local-symbols
76 +++ b/.local-symbols
77 @@ -127,6 +127,7 @@ ADM8211=
78  ATH_COMMON=
79  WLAN_VENDOR_ATH=
80  ATH_DEBUG=
81 +ATH_USER_REGD=
82  ATH_TRACEPOINTS=
83  ATH_REG_DYNAMIC_USER_REG_HINTS=
84  ATH_REG_DYNAMIC_USER_CERT_TESTING=