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@xxxxxxxxxxxxxxxx> --- include/net/wireless.h | 6 ++++++ net/wireless/util.c | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) --- everything.orig/include/net/wireless.h 2008-03-16 18:17:35.000000000 +0100 +++ everything/include/net/wireless.h 2008-03-16 18:18:48.000000000 +0100 @@ -304,4 +304,10 @@ extern int ieee80211_channel_to_frequenc */ extern int ieee80211_frequency_to_channel(int freq); +/** + * ieee80211_get_channel - get channel struct from wiphy for specified frequency + */ +extern struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, + int freq); + #endif /* __NET_WIRELESS_H */ --- everything.orig/net/wireless/util.c 2008-03-16 18:18:52.000000000 +0100 +++ everything/net/wireless/util.c 2008-03-16 18:23:02.000000000 +0100 @@ -33,6 +33,29 @@ int ieee80211_frequency_to_channel(int f } 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) { -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html