Skip to content

Instantly share code, notes, and snippets.

@mlouielu
Created October 7, 2018 04:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlouielu/eb0928563fce3557034438ee0e4146f7 to your computer and use it in GitHub Desktop.
Save mlouielu/eb0928563fce3557034438ee0e4146f7 to your computer and use it in GitHub Desktop.
From bdd191931f8948c80020138c06aaebd10ca9ffcb Mon Sep 17 00:00:00 2001
From: Louie Lu <git@louie.lu>
Date: Sun, 7 Oct 2018 12:36:47 +0800
Subject: [PATCH] ath: Bypass EEPROM regd
---
drivers/net/wireless/ath/regd.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index e25bfdf78c2e..9b40b19cdc50 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#undef CONFIG_ATH_USER_REGD
+#define CONFIG_ATH_USER_REGD 1
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h>
@@ -345,6 +347,10 @@ ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
struct ieee80211_channel *ch;
unsigned int i;
+#ifdef CONFIG_ATH_USER_REGD
+ return;
+#endif
+
for (band = 0; band < NUM_NL80211_BANDS; band++) {
if (!wiphy->bands[band])
continue;
@@ -378,6 +384,10 @@ ath_reg_apply_ir_flags(struct wiphy *wiphy,
{
struct ieee80211_supported_band *sband;
+#ifdef CONFIG_ATH_USER_REGD
+ return;
+#endif
+
sband = wiphy->bands[NL80211_BAND_2GHZ];
if (!sband)
return;
@@ -407,6 +417,10 @@ static void ath_reg_apply_radar_flags(struct wiphy *wiphy,
struct ieee80211_channel *ch;
unsigned int i;
+#ifdef CONFIG_ATH_USER_REGD
+ return;
+#endif
+
if (!wiphy->bands[NL80211_BAND_5GHZ])
return;
@@ -639,6 +653,11 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
const struct ieee80211_regdomain *regd;
wiphy->reg_notifier = reg_notifier;
+
+#ifdef CONFIG_ATH_USER_REGD
+ return 0;
+#endif
+
wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
REGULATORY_CUSTOM_REG;
--
2.18.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment