diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-05-08 15:34:22 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-05-24 18:02:13 -0400 |
commit | 9f419f3851041e0c8170629f0639813dbfc79d5e (patch) | |
tree | 881b599ab8ee0c0924d7152bf4e330aa36213609 /net/wireless | |
parent | dde7dc759b777f385fc5df2af691c82eb455c7f3 (diff) |
cfg80211: move cfg80211_get_dev_from_ifindex under wext
The function is only used and needed by the wext code
for scanning, so move it there.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/core.c | 21 | ||||
-rw-r--r-- | net/wireless/core.h | 4 | ||||
-rw-r--r-- | net/wireless/scan.c | 21 |
3 files changed, 21 insertions, 25 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index 58e69d691601..cc49cf11c7a7 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -90,27 +90,6 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx) | |||
90 | return &rdev->wiphy; | 90 | return &rdev->wiphy; |
91 | } | 91 | } |
92 | 92 | ||
93 | struct cfg80211_registered_device * | ||
94 | cfg80211_get_dev_from_ifindex(struct net *net, int ifindex) | ||
95 | { | ||
96 | struct cfg80211_registered_device *rdev = ERR_PTR(-ENODEV); | ||
97 | struct net_device *dev; | ||
98 | |||
99 | mutex_lock(&cfg80211_mutex); | ||
100 | dev = dev_get_by_index(net, ifindex); | ||
101 | if (!dev) | ||
102 | goto out; | ||
103 | if (dev->ieee80211_ptr) { | ||
104 | rdev = wiphy_to_dev(dev->ieee80211_ptr->wiphy); | ||
105 | mutex_lock(&rdev->mtx); | ||
106 | } else | ||
107 | rdev = ERR_PTR(-ENODEV); | ||
108 | dev_put(dev); | ||
109 | out: | ||
110 | mutex_unlock(&cfg80211_mutex); | ||
111 | return rdev; | ||
112 | } | ||
113 | |||
114 | /* requires cfg80211_mutex to be held */ | 93 | /* requires cfg80211_mutex to be held */ |
115 | int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, | 94 | int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, |
116 | char *newname) | 95 | char *newname) |
diff --git a/net/wireless/core.h b/net/wireless/core.h index fd35dae547c4..95b29075a9c8 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -164,10 +164,6 @@ int get_wiphy_idx(struct wiphy *wiphy); | |||
164 | /* requires cfg80211_rdev_mutex to be held! */ | 164 | /* requires cfg80211_rdev_mutex to be held! */ |
165 | struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx); | 165 | struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx); |
166 | 166 | ||
167 | /* identical to cfg80211_get_dev_from_info but only operate on ifindex */ | ||
168 | extern struct cfg80211_registered_device * | ||
169 | cfg80211_get_dev_from_ifindex(struct net *net, int ifindex); | ||
170 | |||
171 | int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, | 167 | int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, |
172 | struct net *net); | 168 | struct net *net); |
173 | 169 | ||
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index fd99ea495b7e..2ce44a712f13 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -1040,6 +1040,27 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) | |||
1040 | EXPORT_SYMBOL(cfg80211_unlink_bss); | 1040 | EXPORT_SYMBOL(cfg80211_unlink_bss); |
1041 | 1041 | ||
1042 | #ifdef CONFIG_CFG80211_WEXT | 1042 | #ifdef CONFIG_CFG80211_WEXT |
1043 | static struct cfg80211_registered_device * | ||
1044 | cfg80211_get_dev_from_ifindex(struct net *net, int ifindex) | ||
1045 | { | ||
1046 | struct cfg80211_registered_device *rdev = ERR_PTR(-ENODEV); | ||
1047 | struct net_device *dev; | ||
1048 | |||
1049 | mutex_lock(&cfg80211_mutex); | ||
1050 | dev = dev_get_by_index(net, ifindex); | ||
1051 | if (!dev) | ||
1052 | goto out; | ||
1053 | if (dev->ieee80211_ptr) { | ||
1054 | rdev = wiphy_to_dev(dev->ieee80211_ptr->wiphy); | ||
1055 | mutex_lock(&rdev->mtx); | ||
1056 | } else | ||
1057 | rdev = ERR_PTR(-ENODEV); | ||
1058 | dev_put(dev); | ||
1059 | out: | ||
1060 | mutex_unlock(&cfg80211_mutex); | ||
1061 | return rdev; | ||
1062 | } | ||
1063 | |||
1043 | int cfg80211_wext_siwscan(struct net_device *dev, | 1064 | int cfg80211_wext_siwscan(struct net_device *dev, |
1044 | struct iw_request_info *info, | 1065 | struct iw_request_info *info, |
1045 | union iwreq_data *wrqu, char *extra) | 1066 | union iwreq_data *wrqu, char *extra) |