Skip to contentSkip to conversation

mac80211: update for cfg80211 rtnl locking

PATCH In review Johannes Berg 2 participants 2 messages Apr 21, 2007 – Apr 23, 2007 mac80211

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 mac80211: update for cfg80211 rtnl locking

cfg80211 was changed to hold the rtnl lock over calls to stack specific operations. This patch changes mac80211 to account for that.

---
 net/mac80211/ieee80211_cfg.c |   27 ++++++---------------------
 1 file changed, 6 insertions(+), 21 deletions(-)
net/mac80211/ieee80211_cfg.c +6 -21
@@ -12,18 +12,6 @@
 #include "ieee80211_i.h"
 #include "ieee80211_cfg.h"
 
-/* copied from ieee80211_sysfs.c for now ... */
-static inline int rtnl_lock_local(struct ieee80211_local *local)
-{
-	rtnl_lock();
-	if (unlikely(local->reg_state != IEEE80211_DEV_REGISTERED)) {
-		rtnl_unlock();
-		return -ENODEV;
-	}
-	return 0;
-}
-
-
 static int ieee80211_add_iface(struct wiphy *wiphy, char *name,
 			       unsigned int type)
 {
@@ -31,6 +19,9 @@ static int ieee80211_add_iface(struct wi
 	struct net_device *new_dev;
 	int res, itype;
 
+	if (unlikely(local->reg_state != IEEE80211_DEV_REGISTERED))
+		return -ENODEV;
+
 	switch (type) {
 	case NL80211_IFTYPE_UNSPECIFIED:
 		itype = IEEE80211_IF_TYPE_STA;
@@ -54,14 +45,9 @@ static int ieee80211_add_iface(struct wi
 		return -EINVAL;
 	}
 
-	res = rtnl_lock_local(local);
-	if (res)
-		return res;
-
 	res = ieee80211_if_add(local->mdev, name, 0, &new_dev);
 	if (res == 0)
 		ieee80211_if_set_type(new_dev, itype);
-	rtnl_unlock();
 	return res;
 }
 
@@ -72,15 +58,14 @@ static int ieee80211_del_iface(struct wi
 	struct net_device *dev;
 	char *name;
 
-	res = rtnl_lock_local(local);
-	if (res)
-		return res;
+	if (unlikely(local->reg_state != IEEE80211_DEV_REGISTERED))
+		return -ENODEV;
+
 	dev = dev_get_by_index(ifindex);
 	name = dev->name;
 	dev_put(dev);
 
 	res = ieee80211_if_remove(local->mdev, name, -1);
-	rtnl_unlock();
 	return res;
 }
 
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Johannes Berg

cfg80211 was changed to hold the rtnl lock over calls to stack specific operations. This patch changes mac80211 to account for that.

John, please apply with the cfg80211 rtnl patch.

Thanks,

Jiri

Signature · 2 lines
Jiri Benc
SUSE Labs