summaryrefslogtreecommitdiffstats
path: root/net/mac80211/iface.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-07-09 14:40:36 +0200
committerJohn W. Linville <linville@tuxdriver.com>2008-07-14 14:30:07 -0400
commitf3947e2dfa3b18f375b7acd03b7ee2877d0751fc (patch)
tree3f68e55a214e638f1210883958d0746610c9dcf8 /net/mac80211/iface.c
parent75636525fbfa78fa33fd754c89785cfde750acd3 (diff)
downloadop-kernel-dev-f3947e2dfa3b18f375b7acd03b7ee2877d0751fc.zip
op-kernel-dev-f3947e2dfa3b18f375b7acd03b7ee2877d0751fc.tar.gz
mac80211: push interface checks down
This patch pushes the "netif_running()" and "same type as before" checks down into ieee80211_if_change_type() to centralise the logic instead of duplicating it for cfg80211 and wext. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/iface.c')
-rw-r--r--net/mac80211/iface.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 6cf121b..2e3adcb 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -138,9 +138,23 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
ieee80211_debugfs_add_netdev(sdata);
}
-void ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
- enum ieee80211_if_types type)
+int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
+ enum ieee80211_if_types type)
{
+ ASSERT_RTNL();
+
+ if (type == sdata->vif.type)
+ return 0;
+
+ /*
+ * We could, here, on changes between IBSS/STA/MESH modes,
+ * invoke an MLME function instead that disassociates etc.
+ * and goes into the requested mode.
+ */
+
+ if (netif_running(sdata->dev))
+ return -EBUSY;
+
/* Purge and reset type-dependent state. */
ieee80211_teardown_sdata(sdata->dev);
ieee80211_setup_sdata(sdata, type);
@@ -149,6 +163,8 @@ void ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
sdata->basic_rates = 0;
sdata->drop_unencrypted = 0;
sdata->sequence = 0;
+
+ return 0;
}
int ieee80211_if_add(struct ieee80211_local *local, const char *name,
OpenPOWER on IntegriCloud