aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/wext-compat.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/wext-compat.c')
-rw-r--r--net/wireless/wext-compat.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 6fd7bf7b4481..57eaea26b67a 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -285,3 +285,33 @@ int cfg80211_wext_siwmlme(struct net_device *dev,
285 } 285 }
286} 286}
287EXPORT_SYMBOL(cfg80211_wext_siwmlme); 287EXPORT_SYMBOL(cfg80211_wext_siwmlme);
288
289
290/**
291 * cfg80211_wext_freq - get wext frequency for non-"auto"
292 * @wiphy: the wiphy
293 * @freq: the wext freq encoding
294 *
295 * Returns a channel, %NULL for auto, or an ERR_PTR for errors!
296 */
297struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
298 struct iw_freq *freq)
299{
300 if (freq->e == 0) {
301 if (freq->m < 0)
302 return NULL;
303 else
304 return ieee80211_get_channel(wiphy,
305 ieee80211_channel_to_frequency(freq->m));
306 } else {
307 int i, div = 1000000;
308 for (i = 0; i < freq->e; i++)
309 div /= 10;
310 if (div > 0)
311 return ieee80211_get_channel(wiphy, freq->m / div);
312 else
313 return ERR_PTR(-EINVAL);
314 }
315
316}
317EXPORT_SYMBOL(cfg80211_wext_freq);