summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath/ath9k/main.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-09-29 19:12:06 +0200
committerJohn W. Linville <linville@tuxdriver.com>2010-10-05 13:35:22 -0400
commit39162dbe813a2c90b7b9018a74dc1befb9ff4205 (patch)
tree10bd788a67a55e4eb32bf8627a94351b6b39a975 /drivers/net/wireless/ath/ath9k/main.c
parent17e5a8082894a4b66cb69e7ec16074f0f01281e1 (diff)
ath9k: return survey data for all channels instead of just the current one
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index a801a08c4da2..49ea45896b89 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1994,16 +1994,31 @@ static int ath9k_get_survey(struct ieee80211_hw *hw, int idx,
struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc;
struct ath_hw *ah = sc->sc_ah;
- struct ieee80211_conf *conf = &hw->conf;
+ struct ieee80211_supported_band *sband;
+ struct ath9k_channel *chan;
+
+ sband = hw->wiphy->bands[IEEE80211_BAND_2GHZ];
+ if (sband && idx >= sband->n_channels) {
+ idx -= sband->n_channels;
+ sband = NULL;
+ }
- if (idx != 0)
- return -ENOENT;
+ if (!sband)
+ sband = hw->wiphy->bands[IEEE80211_BAND_5GHZ];
- survey->channel = conf->channel;
+ if (!sband || idx >= sband->n_channels)
+ return -ENOENT;
+
+ survey->channel = &sband->channels[idx];
+ chan = &ah->channels[survey->channel->hw_value];
survey->filled = 0;
- if (ah->curchan && ah->curchan->noisefloor) {
+
+ if (chan == ah->curchan)
+ survey->filled |= SURVEY_INFO_IN_USE;
+
+ if (chan->noisefloor) {
survey->filled |= SURVEY_INFO_NOISE_DBM;
- survey->noise = ah->curchan->noisefloor;
+ survey->noise = chan->noisefloor;
}
return 0;