mt76: update to the latest version
[oweals/openwrt.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 @@ -24,6 +24,7 @@
4  #include "regd_common.h"
5  
6  static int __ath_regd_init(struct ath_regulatory *reg);
7 +static struct reg_dmn_pair_mapping *ath_get_regpair(int regdmn);
8  
9  /*
10   * This is a set of common rules used by our world regulatory domains.
11 @@ -116,6 +117,9 @@ static const struct ieee80211_regdomain
12  
13  static bool dynamic_country_user_possible(struct ath_regulatory *reg)
14  {
15 +       if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
16 +               return true;
17 +
18         if (IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_CERT_TESTING))
19                 return true;
20  
21 @@ -188,6 +192,8 @@ static bool dynamic_country_user_possibl
22  
23  static bool ath_reg_dyn_country_user_allow(struct ath_regulatory *reg)
24  {
25 +       if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
26 +               return true;
27         if (!IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_REG_HINTS))
28                 return false;
29         if (!dynamic_country_user_possible(reg))
30 @@ -345,6 +351,9 @@ ath_reg_apply_beaconing_flags(struct wip
31         struct ieee80211_channel *ch;
32         unsigned int i;
33  
34 +       if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
35 +               return;
36 +
37         for (band = 0; band < NUM_NL80211_BANDS; band++) {
38                 if (!wiphy->bands[band])
39                         continue;
40 @@ -378,6 +387,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip
41  {
42         struct ieee80211_supported_band *sband;
43  
44 +       if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
45 +               return;
46 +
47         sband = wiphy->bands[NL80211_BAND_2GHZ];
48         if (!sband)
49                 return;
50 @@ -407,6 +419,9 @@ static void ath_reg_apply_radar_flags(st
51         struct ieee80211_channel *ch;
52         unsigned int i;
53  
54 +       if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
55 +               return;
56 +
57         if (!wiphy->bands[NL80211_BAND_5GHZ])
58                 return;
59  
60 @@ -639,6 +654,10 @@ ath_regd_init_wiphy(struct ath_regulator
61         const struct ieee80211_regdomain *regd;
62  
63         wiphy->reg_notifier = reg_notifier;
64 +
65 +       if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
66 +               return 0;
67 +
68         wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
69                                    REGULATORY_CUSTOM_REG;
70  
71 --- a/drivers/net/wireless/ath/Kconfig
72 +++ b/drivers/net/wireless/ath/Kconfig
73 @@ -23,6 +23,9 @@ config WLAN_VENDOR_ATH
74  
75  if WLAN_VENDOR_ATH
76  
77 +config ATH_USER_REGD
78 +       bool "Do not enforce EEPROM regulatory restrictions"
79 +
80  config ATH_DEBUG
81         bool "Atheros wireless debugging"
82         ---help---
83 --- a/local-symbols
84 +++ b/local-symbols
85 @@ -87,6 +87,7 @@ ADM8211=
86  ATH_COMMON=
87  WLAN_VENDOR_ATH=
88  ATH_DEBUG=
89 +ATH_USER_REGD=
90  ATH_TRACEPOINTS=
91  ATH_REG_DYNAMIC_USER_REG_HINTS=
92  ATH_REG_DYNAMIC_USER_CERT_TESTING=