aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-05-16 17:50:16 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-06-05 15:32:15 -0400
commit3d9e6e12077d2611749ba3145bc4934aae461425 (patch)
treebf03abbc0d0760a9629aa164f907dc8df4cab7b2 /net/mac80211/cfg.c
parent8a2ac260bb89dc34bd31d694e885164a3b78c4d9 (diff)
mac80211: move ieee80211_set_channel function
Move the set_channel function up so it can be used by other code in this file in the future. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index bb04f4a707e7..9aab849fd6cf 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -674,6 +674,41 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
674 return ret; 674 return ret;
675} 675}
676 676
677static int ieee80211_set_channel(struct wiphy *wiphy,
678 struct net_device *netdev,
679 struct ieee80211_channel *chan,
680 enum nl80211_channel_type channel_type)
681{
682 struct ieee80211_local *local = wiphy_priv(wiphy);
683 struct ieee80211_sub_if_data *sdata = NULL;
684
685 if (netdev)
686 sdata = IEEE80211_DEV_TO_SUB_IF(netdev);
687
688 switch (ieee80211_get_channel_mode(local, NULL)) {
689 case CHAN_MODE_HOPPING:
690 return -EBUSY;
691 case CHAN_MODE_FIXED:
692 if (local->oper_channel != chan)
693 return -EBUSY;
694 if (!sdata && local->_oper_channel_type == channel_type)
695 return 0;
696 break;
697 case CHAN_MODE_UNDEFINED:
698 break;
699 }
700
701 if (!ieee80211_set_channel_type(local, sdata, channel_type))
702 return -EBUSY;
703
704 local->oper_channel = chan;
705
706 /* auto-detects changes */
707 ieee80211_hw_config(local, 0);
708
709 return 0;
710}
711
677static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata, 712static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
678 const u8 *resp, size_t resp_len) 713 const u8 *resp, size_t resp_len)
679{ 714{
@@ -1677,41 +1712,6 @@ static int ieee80211_set_txq_params(struct wiphy *wiphy,
1677 return 0; 1712 return 0;
1678} 1713}
1679 1714
1680static int ieee80211_set_channel(struct wiphy *wiphy,
1681 struct net_device *netdev,
1682 struct ieee80211_channel *chan,
1683 enum nl80211_channel_type channel_type)
1684{
1685 struct ieee80211_local *local = wiphy_priv(wiphy);
1686 struct ieee80211_sub_if_data *sdata = NULL;
1687
1688 if (netdev)
1689 sdata = IEEE80211_DEV_TO_SUB_IF(netdev);
1690
1691 switch (ieee80211_get_channel_mode(local, NULL)) {
1692 case CHAN_MODE_HOPPING:
1693 return -EBUSY;
1694 case CHAN_MODE_FIXED:
1695 if (local->oper_channel != chan)
1696 return -EBUSY;
1697 if (!sdata && local->_oper_channel_type == channel_type)
1698 return 0;
1699 break;
1700 case CHAN_MODE_UNDEFINED:
1701 break;
1702 }
1703
1704 if (!ieee80211_set_channel_type(local, sdata, channel_type))
1705 return -EBUSY;
1706
1707 local->oper_channel = chan;
1708
1709 /* auto-detects changes */
1710 ieee80211_hw_config(local, 0);
1711
1712 return 0;
1713}
1714
1715#ifdef CONFIG_PM 1715#ifdef CONFIG_PM
1716static int ieee80211_suspend(struct wiphy *wiphy, 1716static int ieee80211_suspend(struct wiphy *wiphy,
1717 struct cfg80211_wowlan *wowlan) 1717 struct cfg80211_wowlan *wowlan)