summaryrefslogtreecommitdiffstats
path: root/net/mac80211/util.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-09-11 00:01:53 +0200
committerJohn W. Linville <linville@tuxdriver.com>2008-09-15 16:48:22 -0400
commite16751c3178add97c4f83dcf92e59b536537b22f (patch)
tree2beec8fe3ba7b12ca6787355175d0e2e498c3f5b /net/mac80211/util.c
parent9c6bd79011b14a8bfe58aad0acfb51e4dca05eed (diff)
downloadblackbird-obmc-linux-e16751c3178add97c4f83dcf92e59b536537b22f.tar.gz
blackbird-obmc-linux-e16751c3178add97c4f83dcf92e59b536537b22f.zip
mac80211: move ieee80211_set_freq to utils
It really doesn't belong into the wireless extensions code. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r--net/mac80211/util.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index c3a22ab2ad2e..cf0b820a0eaa 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -612,3 +612,31 @@ void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
dev_queue_xmit(skb);
}
+
+int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz)
+{
+ int ret = -EINVAL;
+ struct ieee80211_channel *chan;
+ struct ieee80211_local *local = sdata->local;
+
+ chan = ieee80211_get_channel(local->hw.wiphy, freqMHz);
+
+ if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
+ if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS &&
+ chan->flags & IEEE80211_CHAN_NO_IBSS) {
+ printk(KERN_DEBUG "%s: IBSS not allowed on frequency "
+ "%d MHz\n", sdata->dev->name, chan->center_freq);
+ return ret;
+ }
+ local->oper_channel = chan;
+
+ if (local->sta_sw_scanning || local->sta_hw_scanning)
+ ret = 0;
+ else
+ ret = ieee80211_hw_config(local);
+
+ rate_control_clear(local);
+ }
+
+ return ret;
+}
OpenPOWER on IntegriCloud