diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-06-15 08:18:32 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-06-20 04:57:02 -0400 |
commit | 878d9ec7367816dc336b0c24e6256596559692b7 (patch) | |
tree | a96e4966ee6919bc9bec5587eaa8ed235cf781c8 /net/wireless/nl80211.c | |
parent | 4f7eff10b20fc86f71f2db83e6b16cb5fbde8dbc (diff) |
nl80211: change __cfg80211_rdev_from_info
Change the function to __cfg80211_rdev_from_attrs
to take attributes instead of the info struct to
make it usable from dump callbacks for testmode.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index af232912fff8..7e94d4d960bf 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -71,23 +71,23 @@ static int get_rdev_dev_by_ifindex(struct net *netns, struct nlattr **attrs, | |||
71 | } | 71 | } |
72 | 72 | ||
73 | static struct cfg80211_registered_device * | 73 | static struct cfg80211_registered_device * |
74 | __cfg80211_rdev_from_info(struct net *netns, struct genl_info *info) | 74 | __cfg80211_rdev_from_attrs(struct net *netns, struct nlattr **attrs) |
75 | { | 75 | { |
76 | struct cfg80211_registered_device *rdev = NULL, *tmp; | 76 | struct cfg80211_registered_device *rdev = NULL, *tmp; |
77 | struct net_device *netdev; | 77 | struct net_device *netdev; |
78 | 78 | ||
79 | assert_cfg80211_lock(); | 79 | assert_cfg80211_lock(); |
80 | 80 | ||
81 | if (!info->attrs[NL80211_ATTR_WIPHY] && | 81 | if (!attrs[NL80211_ATTR_WIPHY] && |
82 | !info->attrs[NL80211_ATTR_IFINDEX]) | 82 | !attrs[NL80211_ATTR_IFINDEX]) |
83 | return ERR_PTR(-EINVAL); | 83 | return ERR_PTR(-EINVAL); |
84 | 84 | ||
85 | if (info->attrs[NL80211_ATTR_WIPHY]) | 85 | if (attrs[NL80211_ATTR_WIPHY]) |
86 | rdev = cfg80211_rdev_by_wiphy_idx( | 86 | rdev = cfg80211_rdev_by_wiphy_idx( |
87 | nla_get_u32(info->attrs[NL80211_ATTR_WIPHY])); | 87 | nla_get_u32(attrs[NL80211_ATTR_WIPHY])); |
88 | 88 | ||
89 | if (info->attrs[NL80211_ATTR_IFINDEX]) { | 89 | if (attrs[NL80211_ATTR_IFINDEX]) { |
90 | int ifindex = nla_get_u32(info->attrs[NL80211_ATTR_IFINDEX]); | 90 | int ifindex = nla_get_u32(attrs[NL80211_ATTR_IFINDEX]); |
91 | netdev = dev_get_by_index(netns, ifindex); | 91 | netdev = dev_get_by_index(netns, ifindex); |
92 | if (netdev) { | 92 | if (netdev) { |
93 | if (netdev->ieee80211_ptr) | 93 | if (netdev->ieee80211_ptr) |
@@ -145,7 +145,7 @@ cfg80211_get_dev_from_info(struct net *netns, struct genl_info *info) | |||
145 | struct cfg80211_registered_device *rdev; | 145 | struct cfg80211_registered_device *rdev; |
146 | 146 | ||
147 | mutex_lock(&cfg80211_mutex); | 147 | mutex_lock(&cfg80211_mutex); |
148 | rdev = __cfg80211_rdev_from_info(netns, info); | 148 | rdev = __cfg80211_rdev_from_attrs(netns, info->attrs); |
149 | 149 | ||
150 | /* if it is not an error we grab the lock on | 150 | /* if it is not an error we grab the lock on |
151 | * it to assure it won't be going away while | 151 | * it to assure it won't be going away while |
@@ -1422,7 +1422,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
1422 | } | 1422 | } |
1423 | 1423 | ||
1424 | if (!netdev) { | 1424 | if (!netdev) { |
1425 | rdev = __cfg80211_rdev_from_info(genl_info_net(info), info); | 1425 | rdev = __cfg80211_rdev_from_attrs(genl_info_net(info), |
1426 | info->attrs); | ||
1426 | if (IS_ERR(rdev)) { | 1427 | if (IS_ERR(rdev)) { |
1427 | mutex_unlock(&cfg80211_mutex); | 1428 | mutex_unlock(&cfg80211_mutex); |
1428 | return PTR_ERR(rdev); | 1429 | return PTR_ERR(rdev); |