From 768e6750d77438bb461c5396f205df8b7f56de94 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Sun, 8 Sep 2013 09:38:38 +0000
Subject: [PATCH] ath9k: clean up some patches

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 37919
---
 .../patches/512-ath9k_channelbw_debugfs.patch | 19 +----------------
 .../patches/521-ath9k_cur_txpower.patch       | 21 ++++++++++++-------
 .../523-mac80211_configure_antenna_gain.patch | 12 ++++++++++-
 ...24-ath9k_use_configured_antenna_gain.patch |  2 +-
 .../patches/542-ath9k_debugfs_diag.patch      |  2 +-
 5 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
index a0bea054a6..69923242ae 100644
--- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
+++ b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
@@ -8,14 +8,6 @@
  	struct survey_info *cur_survey;
  	struct survey_info survey[ATH9K_NUM_CHANNELS];
  
-@@ -905,6 +906,7 @@ struct fft_sample_ht20 {
- 	u8 data[SPECTRAL_HT20_NUM_BINS];
- } __packed;
- 
-+int ath9k_config(struct ieee80211_hw *hw, u32 changed);
- void ath9k_tasklet(unsigned long data);
- int ath_cabq_update(struct ath_softc *);
- 
 --- a/drivers/net/wireless/ath/ath9k/debug.c
 +++ b/drivers/net/wireless/ath/ath9k/debug.c
 @@ -1918,6 +1918,50 @@ static const struct file_operations fops
@@ -52,7 +44,7 @@
 +
 +	sc->chan_bw = chan_bw;
 +	if (!test_bit(SC_OP_INVALID, &sc->sc_flags))
-+		ath9k_config(sc->hw, IEEE80211_CONF_CHANGE_CHANNEL);
++		ath9k_ops.config(sc->hw, IEEE80211_CONF_CHANGE_CHANNEL);
 +
 +	return count;
 +}
@@ -80,15 +72,6 @@
  	debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc,
 --- a/drivers/net/wireless/ath/ath9k/main.c
 +++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -1146,7 +1146,7 @@ int ath9k_spectral_scan_config(struct ie
- 	return 0;
- }
- 
--static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
-+int ath9k_config(struct ieee80211_hw *hw, u32 changed)
- {
- 	struct ath_softc *sc = hw->priv;
- 	struct ath_hw *ah = sc->sc_ah;
 @@ -1200,8 +1200,10 @@ static int ath9k_config(struct ieee80211
  
  	if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) {
diff --git a/package/kernel/mac80211/patches/521-ath9k_cur_txpower.patch b/package/kernel/mac80211/patches/521-ath9k_cur_txpower.patch
index 2aaee2f393..22691910fe 100644
--- a/package/kernel/mac80211/patches/521-ath9k_cur_txpower.patch
+++ b/package/kernel/mac80211/patches/521-ath9k_cur_txpower.patch
@@ -1,15 +1,20 @@
 --- a/drivers/net/wireless/ath/ath9k/main.c
 +++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -1263,6 +1263,8 @@ int ath9k_config(struct ieee80211_hw *hw
- 			return -EINVAL;
- 		}
+@@ -286,8 +286,12 @@ static int ath_reset_internal(struct ath
+ 	    (sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL))
+ 		ath9k_mci_set_txpower(sc, true, false);
  
-+		hw->cur_power_level = sc->curtxpow / 2;
+-	if (!ath_complete_reset(sc, true))
++	if (!ath_complete_reset(sc, true)) {
+ 		r = -EIO;
++		goto out;
++	}
 +
- 		/*
- 		 * The most recent snapshot of channel->noisefloor for the old
- 		 * channel is only available after the hardware reset. Copy it to
-@@ -1299,6 +1301,7 @@ int ath9k_config(struct ieee80211_hw *hw
++	sc->hw->cur_power_level = sc->curtxpow / 2;
+ 
+ out:
+ 	spin_unlock_bh(&sc->sc_pcu_lock);
+@@ -1299,6 +1303,7 @@ static int ath9k_config(struct ieee80211
  		sc->config.txpowlimit = 2 * conf->power_level;
  		ath9k_cmn_update_txpow(ah, sc->curtxpow,
  				       sc->config.txpowlimit, &sc->curtxpow);
diff --git a/package/kernel/mac80211/patches/523-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/523-mac80211_configure_antenna_gain.patch
index 0e2baf95d5..54da9f692f 100644
--- a/package/kernel/mac80211/patches/523-mac80211_configure_antenna_gain.patch
+++ b/package/kernel/mac80211/patches/523-mac80211_configure_antenna_gain.patch
@@ -28,7 +28,17 @@
  
 --- a/include/uapi/linux/nl80211.h
 +++ b/include/uapi/linux/nl80211.h
-@@ -1766,6 +1766,8 @@ enum nl80211_attrs {
+@@ -1460,6 +1460,9 @@ enum nl80211_commands {
+  * @NL80211_ATTR_CSA_C_OFF_PRESP: Offset of the channel switch counter
+  *	field in the probe response (%NL80211_ATTR_PROBE_RESP).
+  *
++ * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
++ *	transmit power to stay within regulatory limits.
++ *
+  * @NL80211_ATTR_MAX: highest attribute number currently defined
+  * @__NL80211_ATTR_AFTER_LAST: internal use
+  */
+@@ -1766,6 +1769,8 @@ enum nl80211_attrs {
  	NL80211_ATTR_CSA_C_OFF_BEACON,
  	NL80211_ATTR_CSA_C_OFF_PRESP,
  
diff --git a/package/kernel/mac80211/patches/524-ath9k_use_configured_antenna_gain.patch b/package/kernel/mac80211/patches/524-ath9k_use_configured_antenna_gain.patch
index dd1fec7ee1..48b5f31dc1 100644
--- a/package/kernel/mac80211/patches/524-ath9k_use_configured_antenna_gain.patch
+++ b/package/kernel/mac80211/patches/524-ath9k_use_configured_antenna_gain.patch
@@ -21,7 +21,7 @@
  	if (ant_gain > max_gain)
 --- a/drivers/net/wireless/ath/ath9k/main.c
 +++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -1297,7 +1297,10 @@ int ath9k_config(struct ieee80211_hw *hw
+@@ -1299,7 +1299,10 @@ static int ath9k_config(struct ieee80211
  	}
  
  	if (changed & IEEE80211_CONF_CHANGE_POWER) {
diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
index 3409b69b95..521f031625 100644
--- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
+++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
@@ -125,7 +125,7 @@
  		REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON);
 --- a/drivers/net/wireless/ath/ath9k/main.c
 +++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -458,6 +458,11 @@ irqreturn_t ath_isr(int irq, void *dev)
+@@ -462,6 +462,11 @@ irqreturn_t ath_isr(int irq, void *dev)
  	ath9k_hw_getisr(ah, &status);	/* NB: clears ISR too */
  	status &= ah->imask;	/* discard unasked-for bits */
  
-- 
GitLab