diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-07-09 08:40:36 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-07-14 14:30:07 -0400 |
commit | f3947e2dfa3b18f375b7acd03b7ee2877d0751fc (patch) | |
tree | 3f68e55a214e638f1210883958d0746610c9dcf8 /net/mac80211/iface.c | |
parent | 75636525fbfa78fa33fd754c89785cfde750acd3 (diff) |
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.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 6cf121bebd7a..2e3adcb3ce23 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, | |||
138 | ieee80211_debugfs_add_netdev(sdata); | 138 | ieee80211_debugfs_add_netdev(sdata); |
139 | } | 139 | } |
140 | 140 | ||
141 | void ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | 141 | int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, |
142 | enum ieee80211_if_types type) | 142 | enum ieee80211_if_types type) |
143 | { | 143 | { |
144 | ASSERT_RTNL(); | ||
145 | |||
146 | if (type == sdata->vif.type) | ||
147 | return 0; | ||
148 | |||
149 | /* | ||
150 | * We could, here, on changes between IBSS/STA/MESH modes, | ||
151 | * invoke an MLME function instead that disassociates etc. | ||
152 | * and goes into the requested mode. | ||
153 | */ | ||
154 | |||
155 | if (netif_running(sdata->dev)) | ||
156 | return -EBUSY; | ||
157 | |||
144 | /* Purge and reset type-dependent state. */ | 158 | /* Purge and reset type-dependent state. */ |
145 | ieee80211_teardown_sdata(sdata->dev); | 159 | ieee80211_teardown_sdata(sdata->dev); |
146 | ieee80211_setup_sdata(sdata, type); | 160 | ieee80211_setup_sdata(sdata, type); |
@@ -149,6 +163,8 @@ void ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | |||
149 | sdata->basic_rates = 0; | 163 | sdata->basic_rates = 0; |
150 | sdata->drop_unencrypted = 0; | 164 | sdata->drop_unencrypted = 0; |
151 | sdata->sequence = 0; | 165 | sdata->sequence = 0; |
166 | |||
167 | return 0; | ||
152 | } | 168 | } |
153 | 169 | ||
154 | int ieee80211_if_add(struct ieee80211_local *local, const char *name, | 170 | int ieee80211_if_add(struct ieee80211_local *local, const char *name, |