From: Felix Fietkau <nbd@openwrt.org>
To: Paul Stewart <pstew@google.com>
Cc: linux-wireless@vger.kernel.org, linville@tuxdriver.com,
lrodriguez@atheros.com
Subject: [PATCH v2 6/6] ath9k: return survey data for all channels instead of just the current one
Date: Wed, 29 Sep 2010 19:12:06 +0200 [thread overview]
Message-ID: <4CA37366.3040906@openwrt.org> (raw)
In-Reply-To: <AANLkTim1MuVoJnOqeBQtKzTNLK=2Pf4SpMw4MiQHPeB2@mail.gmail.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
v2: add a missing null pointer check for 5ghz sband (thx, paul)
drivers/net/wireless/ath/ath9k/main.c | 27 +++++++++++++++++++++------
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 a801a08..49ea458 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;
prev parent reply other threads:[~2010-09-29 17:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-29 15:15 [PATCH 1/6] ath9k_htc: remove use of common->ani.noise_floor Felix Fietkau
2010-09-29 15:15 ` [PATCH 2/6] ath9k_hw: keep calibrated noise floor values per channel Felix Fietkau
2010-09-29 15:15 ` [PATCH 3/6] ath9k: do not return default noise floor values via survey Felix Fietkau
2010-09-29 15:15 ` [PATCH 4/6] ath9k: remove the noise floor value in the ani struct Felix Fietkau
2010-09-29 15:15 ` [PATCH 5/6] nl80211: allow drivers to indicate whether the survey data channel is in use Felix Fietkau
2010-09-29 15:15 ` [PATCH 6/6] ath9k: return survey data for all channels instead of just the current one Felix Fietkau
[not found] ` <AANLkTim1MuVoJnOqeBQtKzTNLK=2Pf4SpMw4MiQHPeB2@mail.gmail.com>
2010-09-29 17:12 ` Felix Fietkau [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CA37366.3040906@openwrt.org \
--to=nbd@openwrt.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=lrodriguez@atheros.com \
--cc=pstew@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.