aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/wireless.h6
-rw-r--r--net/wireless/util.c23
2 files changed, 29 insertions, 0 deletions
diff --git a/include/net/wireless.h b/include/net/wireless.h
index c7f805ee5545..f4b77ab66bae 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -304,4 +304,10 @@ extern int ieee80211_channel_to_frequency(int chan);
304 */ 304 */
305extern int ieee80211_frequency_to_channel(int freq); 305extern int ieee80211_frequency_to_channel(int freq);
306 306
307/**
308 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
309 */
310extern struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy,
311 int freq);
312
307#endif /* __NET_WIRELESS_H */ 313#endif /* __NET_WIRELESS_H */
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)
33} 33}
34EXPORT_SYMBOL(ieee80211_frequency_to_channel); 34EXPORT_SYMBOL(ieee80211_frequency_to_channel);
35 35
36struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy,
37 int freq)
38{
39 enum ieee80211_band band;
40 struct ieee80211_supported_band *sband;
41 int i;
42
43 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
44 sband = wiphy->bands[band];
45
46 if (!sband)
47 continue;
48
49 for (i = 0; i < sband->n_channels; i++) {
50 if (sband->channels[i].center_freq == freq)
51 return &sband->channels[i];
52 }
53 }
54
55 return NULL;
56}
57EXPORT_SYMBOL(ieee80211_get_channel);
58
36static void set_mandatory_flags_band(struct ieee80211_supported_band *sband, 59static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
37 enum ieee80211_band band) 60 enum ieee80211_band band)
38{ 61{