aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-07-09 08:40:36 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-07-14 14:30:07 -0400
commitf3947e2dfa3b18f375b7acd03b7ee2877d0751fc (patch)
tree3f68e55a214e638f1210883958d0746610c9dcf8 /net/mac80211/cfg.c
parent75636525fbfa78fa33fd754c89785cfde750acd3 (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/cfg.c')
-rw-r--r--net/mac80211/cfg.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 6aa49ad172aa..ea0301025c15 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -84,22 +84,22 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
84 struct net_device *dev; 84 struct net_device *dev;
85 enum ieee80211_if_types itype; 85 enum ieee80211_if_types itype;
86 struct ieee80211_sub_if_data *sdata; 86 struct ieee80211_sub_if_data *sdata;
87 int ret;
87 88
88 /* we're under RTNL */ 89 /* we're under RTNL */
89 dev = __dev_get_by_index(&init_net, ifindex); 90 dev = __dev_get_by_index(&init_net, ifindex);
90 if (!dev) 91 if (!dev)
91 return -ENODEV; 92 return -ENODEV;
92 93
93 if (netif_running(dev))
94 return -EBUSY;
95
96 itype = nl80211_type_to_mac80211_type(type); 94 itype = nl80211_type_to_mac80211_type(type);
97 if (itype == IEEE80211_IF_TYPE_INVALID) 95 if (itype == IEEE80211_IF_TYPE_INVALID)
98 return -EINVAL; 96 return -EINVAL;
99 97
100 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 98 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
101 99
102 ieee80211_if_change_type(sdata, itype); 100 ret = ieee80211_if_change_type(sdata, itype);
101 if (ret)
102 return ret;
103 103
104 if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len) 104 if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len)
105 ieee80211_if_sta_set_mesh_id(&sdata->u.sta, 105 ieee80211_if_sta_set_mesh_id(&sdata->u.sta,