Skip to contentSkip to conversation

ath9k: Select RELAY for ATH9K_DEBUGFS

PATCH New Sven Eckelmann 2 participants 8 messages Jan 31, 2013 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 ath9k: Select RELAY for ATH9K_DEBUGFS

The spectral scan support activated through ATH9K_DEBUGFS depends on RELAY for the kernel->userspace communication. Not activating RELAY causes build failures.

The RELAY is added as select instead of depend to do it similar like the only other user of RELAY: BLK_DEV_IO_TRACE

---
 drivers/net/wireless/ath/ath9k/Kconfig |    1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath9k/Kconfig +1 -0
index 7647ed6..17507dc 100644
@@ -58,6 +58,7 @@ config ATH9K_DEBUGFS
 	bool "Atheros ath9k debugging"
 	depends on ATH9K
 	select MAC80211_DEBUGFS
+	select RELAY
 	---help---
 	  Say Y, if you need access to ath9k's statistics for
 	  interrupts, rate control, etc.
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/6 ath9k: Only process fft samples when ATH9K_DEBUGFS is enabled

The code can only be used when ATH9k_DEBUGFS is enabled an not when ATH_DEBUG is activated. Still enabling it would cause build failures.

---
 drivers/net/wireless/ath/ath9k/recv.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/recv.c +1 -1
index 2af6f19..d372e4a 100644
@@ -1027,7 +1027,7 @@ static s8 fix_rssi_inv_only(u8 rssi_val)
 static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
 			   struct ath_rx_status *rs, u64 tsf)
 {
-#ifdef CONFIG_ATH_DEBUG
+#ifdef CONFIG_ATH9K_DEBUGFS
 	struct ath_hw *ah = sc->sc_ah;
 	u8 bins[SPECTRAL_HT20_NUM_BINS];
 	u8 *vdata = (u8 *)hdr;
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 3/6 ath9k: Only add fix_rssi_inv_only when spectral code is used

In reply to Sven Eckelmann

The code is only used when ATH9K_DEBUGFS is activated and causes build warnings when it is still compiled without user.

---
 drivers/net/wireless/ath/ath9k/recv.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath9k/recv.c +2 -0
index d372e4a..e349bff 100644
@@ -1016,12 +1016,14 @@ static void ath9k_rx_skb_postprocess(struct ath_common *common,
 		rxs->flag &= ~RX_FLAG_DECRYPTED;
 }
 
+#ifdef CONFIG_ATH9K_DEBUGFS
 static s8 fix_rssi_inv_only(u8 rssi_val)
 {
 	if (rssi_val == 128)
 		rssi_val = 0;
 	return (s8) rssi_val;
 }
+#endif
 
 /* returns 1 if this was a spectral frame, even if not handled. */
 static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 4/6 ath9k: Only spectral scan relay file when it was created

In reply to Sven Eckelmann

The relay file depends on relayfs. Trying to close this file without having ATH9K_DEBUGFS (and therefore RELAY) activated causes build failures.

---
 drivers/net/wireless/ath/ath9k/init.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath9k/init.c +2 -0
index c7d116c..93a6dba 100644
@@ -922,10 +922,12 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
 
 	ath9k_eeprom_release(sc);
 
+#ifdef CONFIG_ATH9K_DEBUGFS
 	if (sc->rfs_chan_spec_scan) {
 		relay_close(sc->rfs_chan_spec_scan);
 		sc->rfs_chan_spec_scan = NULL;
 	}
+#endif
 }
 
 void ath9k_deinit_device(struct ath_softc *sc)
Signature · 1 line
1.7.10.4
#6 lore raw

PATCH 5/6 ath9k: Fix sparse __CHECK_ENDIAN__ for spectral code

In reply to Sven Eckelmann
---
 drivers/net/wireless/ath/ath9k/ath9k.h |    8 ++++----
 drivers/net/wireless/ath/ath9k/recv.c  |    9 +++++----
 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +4 -4
index 67df864..5fb99d6 100644
@@ -869,7 +869,7 @@ enum ath_fft_sample_type {
 
 struct fft_sample_tlv {
 	u8 type;	/* see ath_fft_sample */
-	u16 length;
+	__be16 length;
 	/* type dependent data follows */
 } __packed;
 
@@ -878,15 +878,15 @@ struct fft_sample_ht20 {
 
 	u8 max_exp;
 
-	u16 freq;
+	__be16 freq;
 	s8 rssi;
 	s8 noise;
 
-	u16 max_magnitude;
+	__be16 max_magnitude;
 	u8 max_index;
 	u8 bitmap_weight;
 
-	u64 tsf;
+	__be64 tsf;
 
 	u8 data[SPECTRAL_HT20_NUM_BINS];
 } __packed;
drivers/net/wireless/ath/ath9k/recv.c +5 -4
index e349bff..0910146 100644
@@ -1038,6 +1038,7 @@ static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
 	struct ath_ht20_mag_info *mag_info;
 	int len = rs->rs_datalen;
 	int dc_pos;
+	u16 length, max_magnitude;
 
 	/* AR9280 and before report via ATH9K_PHYERR_RADAR, AR93xx and newer
 	 * via ATH9K_PHYERR_SPECTRAL. Haven't seen ATH9K_PHYERR_FALSE_RADAR_EXT
@@ -1065,8 +1066,8 @@ static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
 		return 1;
 
 	fft_sample.tlv.type = ATH_FFT_SAMPLE_HT20;
-	fft_sample.tlv.length = sizeof(fft_sample) - sizeof(fft_sample.tlv);
-	fft_sample.tlv.length = __cpu_to_be16(fft_sample.tlv.length);
+	length = sizeof(fft_sample) - sizeof(fft_sample.tlv);
+	fft_sample.tlv.length = __cpu_to_be16(length);
 
 	fft_sample.freq = __cpu_to_be16(ah->curchan->chan->center_freq);
 	fft_sample.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0);
@@ -1112,8 +1113,8 @@ static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
 	memcpy(fft_sample.data, bins, SPECTRAL_HT20_NUM_BINS);
 	fft_sample.max_exp = mag_info->max_exp & 0xf;
 
-	fft_sample.max_magnitude = spectral_max_magnitude(mag_info->all_bins);
-	fft_sample.max_magnitude = __cpu_to_be16(fft_sample.max_magnitude);
+	max_magnitude = spectral_max_magnitude(mag_info->all_bins);
+	fft_sample.max_magnitude = __cpu_to_be16(max_magnitude);
 	fft_sample.max_index = spectral_max_index(mag_info->all_bins);
 	fft_sample.bitmap_weight = spectral_bitmap_weight(mag_info->all_bins);
 	fft_sample.tsf = __cpu_to_be64(tsf);
Signature · 1 line
1.7.10.4
#7 lore raw

PATCH 6/6 ath9k: Remove unused variables in ath_mci_cleanup

In reply to Sven Eckelmann

Leaving the unused variables ath_mci_cleanup causes build warnings.

---
 drivers/net/wireless/ath/ath9k/mci.c |    2 --
 1 file changed, 2 deletions(-)
drivers/net/wireless/ath/ath9k/mci.c +0 -2
index d207433..815bee2 100644
@@ -474,8 +474,6 @@ void ath_mci_cleanup(struct ath_softc *sc)
 {
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_hw *ah = sc->sc_ah;
-	struct ath_mci_coex *mci = &sc->mci_coex;
-	struct ath_mci_buf *buf = &mci->sched_buf;
 
 	ar9003_mci_cleanup(ah);
 
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 4/6 ath9k: Only spectral scan relay file when it was created

In reply to Sven Eckelmann
Quoted 4 lines · Sven Eckelmann

The relay file depends on relayfs. Trying to close this file without having ATH9K_DEBUGFS (and therefore RELAY) activated causes build failures.

[...]

drivers/net/wireless/ath/ath9k/init.c static void ath9k_deinit_softc(struct ath_softc *sc) · line 930

Quoted 6 lines
drivers/net/wireless/ath/ath9k/init.c +2 -0
+#ifdef CONFIG_ATH9K_DEBUGFS
 	if (sc->rfs_chan_spec_scan) {
 		relay_close(sc->rfs_chan_spec_scan);
 		sc->rfs_chan_spec_scan = NULL;
 	}
+#endif

Instead of ugly #ifdef you could do something like this:

        if (config_enabled(CONFIG_ATH6KL_REGDOMAIN) &&

I think you could use that elsehwere in your patchset as well, but I didn't check that carefully.

Signature · 1 line
Kalle Valo
#5 lore raw

PATCH v2 4/6 ath9k: Only remove spectral scan relay file when it was created

In reply to Sven Eckelmann

The relay file depends on relayfs. Trying to close this file without having ATH9K_DEBUGFS (and therefore RELAY) activated causes build failures.

---
 drivers/net/wireless/ath/ath9k/init.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

v2:
* Use config_enabled instead of #ifdef as requested by Kalle Valo <[email protected]>

drivers/net/wireless/ath/ath9k/init.c +1 -1
index c7d116c..af932c9 100644
@@ -922,7 +922,7 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
 
 	ath9k_eeprom_release(sc);
 
-	if (sc->rfs_chan_spec_scan) {
+	if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->rfs_chan_spec_scan) {
 		relay_close(sc->rfs_chan_spec_scan);
 		sc->rfs_chan_spec_scan = NULL;
 	}
Signature · 1 line
1.7.10.4