summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath/ath9k/common-spectral.c
diff options
context:
space:
mode:
authorNick Kossifidis <mickflemm@gmail.com>2015-04-30 02:51:13 +0300
committerKalle Valo <kvalo@codeaurora.org>2015-05-09 16:46:10 +0300
commite33f855d436846f0e6034311bf9f52f32808d9a7 (patch)
treeec8eada5cefc408aeb484109cd5a3653f6c44b6a /drivers/net/wireless/ath/ath9k/common-spectral.c
parent04a81e183d506f8bcf919b9dbbb287d6723e989e (diff)
downloadlinux-e33f855d436846f0e6034311bf9f52f32808d9a7.tar.xz
ath9k: Fix hanlding of maximum magnitude index
Maximum magnitude index is a 5bit signed integer, convert to an 8bit signed integer and then "shift" it so that it can be used as an array index. Note that the current implementation adds +1 to the index value (so it can't be used as an array index) and it's only valid for HT20 channels. Note that the maximum magnitude index is not being used by the userspace tools that parse FFT samples (they just use maximum magnitude) so this doesn't break userspace compatibility. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/common-spectral.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/common-spectral.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c
index 5cee231cca1f..8752634d007d 100644
--- a/drivers/net/wireless/ath/ath9k/common-spectral.c
+++ b/drivers/net/wireless/ath/ath9k/common-spectral.c
@@ -160,8 +160,10 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_h
upper_mag = spectral_max_magnitude(mag_info->upper_bins);
fft_sample_40.lower_max_magnitude = __cpu_to_be16(lower_mag);
fft_sample_40.upper_max_magnitude = __cpu_to_be16(upper_mag);
- lower_max_index = spectral_max_index(mag_info->lower_bins);
- upper_max_index = spectral_max_index(mag_info->upper_bins);
+ lower_max_index = spectral_max_index(mag_info->lower_bins,
+ num_bins);
+ upper_max_index = spectral_max_index(mag_info->upper_bins,
+ num_bins);
fft_sample_40.lower_max_index = lower_max_index;
fft_sample_40.upper_max_index = upper_max_index;
lower_bitmap_w = spectral_bitmap_weight(mag_info->lower_bins);
@@ -189,7 +191,8 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_h
mag_info = ((struct ath_ht20_mag_info *)radar_info) - 1;
magnitude = spectral_max_magnitude(mag_info->all_bins);
fft_sample_20.max_magnitude = __cpu_to_be16(magnitude);
- max_index = spectral_max_index(mag_info->all_bins);
+ max_index = spectral_max_index(mag_info->all_bins,
+ num_bins);
fft_sample_20.max_index = max_index;
bitmap_w = spectral_bitmap_weight(mag_info->all_bins);
fft_sample_20.bitmap_weight = bitmap_w;