diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-03-16 18:34:33 +0100 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-03-25 16:41:55 -0400 |
commit | 906c730a2db950b7bce4ef17d65399acd791c360 (patch) | |
tree | 75df7353a1407fdcdca45e6f289ab0f25b2361af /net/wireless | |
parent | 857485c0c46ceee5c658c1761bba4d9a5ddf433f (diff) | |
download | blackbird-op-linux-906c730a2db950b7bce4ef17d65399acd791c360.tar.gz blackbird-op-linux-906c730a2db950b7bce4ef17d65399acd791c360.zip |
wireless: add wiphy channel freq to channel struct lookup helper
Add ieee80211_get_channel() which gets you a channel struct for a
specific wiphy if that channel is present in that wiphy.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/util.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c index 77336c22fcf2..f3e623df3515 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -33,6 +33,29 @@ int ieee80211_frequency_to_channel(int freq) } EXPORT_SYMBOL(ieee80211_frequency_to_channel); +struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, + int freq) +{ + enum ieee80211_band band; + struct ieee80211_supported_band *sband; + int i; + + for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + sband = wiphy->bands[band]; + + if (!sband) + continue; + + for (i = 0; i < sband->n_channels; i++) { + if (sband->channels[i].center_freq == freq) + return &sband->channels[i]; + } + } + + return NULL; +} +EXPORT_SYMBOL(ieee80211_get_channel); + static void set_mandatory_flags_band(struct ieee80211_supported_band *sband, enum ieee80211_band band) { |