aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/util.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-09-10 18:01:53 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-15 16:48:22 -0400
commite16751c3178add97c4f83dcf92e59b536537b22f (patch)
tree2beec8fe3ba7b12ca6787355175d0e2e498c3f5b /net/mac80211/util.c
parent9c6bd79011b14a8bfe58aad0acfb51e4dca05eed (diff)
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,
612 612
613 dev_queue_xmit(skb); 613 dev_queue_xmit(skb);
614} 614}
615
616int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz)
617{
618 int ret = -EINVAL;
619 struct ieee80211_channel *chan;
620 struct ieee80211_local *local = sdata->local;
621
622 chan = ieee80211_get_channel(local->hw.wiphy, freqMHz);
623
624 if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
625 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS &&
626 chan->flags & IEEE80211_CHAN_NO_IBSS) {
627 printk(KERN_DEBUG "%s: IBSS not allowed on frequency "
628 "%d MHz\n", sdata->dev->name, chan->center_freq);
629 return ret;
630 }
631 local->oper_channel = chan;
632
633 if (local->sta_sw_scanning || local->sta_hw_scanning)
634 ret = 0;
635 else
636 ret = ieee80211_hw_config(local);
637
638 rate_control_clear(local);
639 }
640
641 return ret;
642}