From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
Jiri Benc <jbenc@suse.cz>, Michael Wu <flamingice@sourmilk.net>
Subject: [PATCH] mac80211: update for cfg80211 rtnl locking
Date: Sat, 21 Apr 2007 11:21:32 +0200 [thread overview]
Message-ID: <1177147293.5941.2.camel@johannes.berg> (raw)
cfg80211 was changed to hold the rtnl lock over calls to stack specific
operations. This patch changes mac80211 to account for that.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
net/mac80211/ieee80211_cfg.c | 27 ++++++---------------------
1 file changed, 6 insertions(+), 21 deletions(-)
--- wireless-dev.orig/net/mac80211/ieee80211_cfg.c 2007-04-21 11:15:09.063578277 +0200
+++ wireless-dev/net/mac80211/ieee80211_cfg.c 2007-04-21 11:19:34.483578277 +0200
@@ -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;
}
next reply other threads:[~2007-04-21 9:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-21 9:21 Johannes Berg [this message]
2007-04-23 18:29 ` [PATCH] mac80211: update for cfg80211 rtnl locking Jiri Benc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1177147293.5941.2.camel@johannes.berg \
--to=johannes@sipsolutions.net \
--cc=flamingice@sourmilk.net \
--cc=jbenc@suse.cz \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox