Skip to content

Commit

Permalink
ath9k: return survey data for all channels instead of just the curren…
Browse files Browse the repository at this point in the history
…t one

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Felix Fietkau authored and John W. Linville committed Oct 5, 2010
1 parent 17e5a80 commit 39162db
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions drivers/net/wireless/ath/ath9k/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 39162db

Please sign in to comment.