diff options
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, |