提交 906c730a 编写于 作者: J Johannes Berg 提交者: John W. Linville

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: NJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 857485c0
...@@ -304,4 +304,10 @@ extern int ieee80211_channel_to_frequency(int chan); ...@@ -304,4 +304,10 @@ extern int ieee80211_channel_to_frequency(int chan);
*/ */
extern int ieee80211_frequency_to_channel(int freq); 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 */ #endif /* __NET_WIRELESS_H */
...@@ -33,6 +33,29 @@ int ieee80211_frequency_to_channel(int freq) ...@@ -33,6 +33,29 @@ int ieee80211_frequency_to_channel(int freq)
} }
EXPORT_SYMBOL(ieee80211_frequency_to_channel); 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, static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
enum ieee80211_band band) enum ieee80211_band band)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册