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>
This commit is contained in:
@@ -90,27 +90,6 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx)
|
|||||||
return &rdev->wiphy;
|
return &rdev->wiphy;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cfg80211_registered_device *
|
|
||||||
cfg80211_get_dev_from_ifindex(struct net *net, int ifindex)
|
|
||||||
{
|
|
||||||
struct cfg80211_registered_device *rdev = ERR_PTR(-ENODEV);
|
|
||||||
struct net_device *dev;
|
|
||||||
|
|
||||||
mutex_lock(&cfg80211_mutex);
|
|
||||||
dev = dev_get_by_index(net, ifindex);
|
|
||||||
if (!dev)
|
|
||||||
goto out;
|
|
||||||
if (dev->ieee80211_ptr) {
|
|
||||||
rdev = wiphy_to_dev(dev->ieee80211_ptr->wiphy);
|
|
||||||
mutex_lock(&rdev->mtx);
|
|
||||||
} else
|
|
||||||
rdev = ERR_PTR(-ENODEV);
|
|
||||||
dev_put(dev);
|
|
||||||
out:
|
|
||||||
mutex_unlock(&cfg80211_mutex);
|
|
||||||
return rdev;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* requires cfg80211_mutex to be held */
|
/* requires cfg80211_mutex to be held */
|
||||||
int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
|
int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
|
||||||
char *newname)
|
char *newname)
|
||||||
|
@@ -164,10 +164,6 @@ int get_wiphy_idx(struct wiphy *wiphy);
|
|||||||
/* requires cfg80211_rdev_mutex to be held! */
|
/* requires cfg80211_rdev_mutex to be held! */
|
||||||
struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx);
|
struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx);
|
||||||
|
|
||||||
/* identical to cfg80211_get_dev_from_info but only operate on ifindex */
|
|
||||||
extern struct cfg80211_registered_device *
|
|
||||||
cfg80211_get_dev_from_ifindex(struct net *net, int ifindex);
|
|
||||||
|
|
||||||
int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
|
int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
|
||||||
struct net *net);
|
struct net *net);
|
||||||
|
|
||||||
|
@@ -1040,6 +1040,27 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
|
|||||||
EXPORT_SYMBOL(cfg80211_unlink_bss);
|
EXPORT_SYMBOL(cfg80211_unlink_bss);
|
||||||
|
|
||||||
#ifdef CONFIG_CFG80211_WEXT
|
#ifdef CONFIG_CFG80211_WEXT
|
||||||
|
static struct cfg80211_registered_device *
|
||||||
|
cfg80211_get_dev_from_ifindex(struct net *net, int ifindex)
|
||||||
|
{
|
||||||
|
struct cfg80211_registered_device *rdev = ERR_PTR(-ENODEV);
|
||||||
|
struct net_device *dev;
|
||||||
|
|
||||||
|
mutex_lock(&cfg80211_mutex);
|
||||||
|
dev = dev_get_by_index(net, ifindex);
|
||||||
|
if (!dev)
|
||||||
|
goto out;
|
||||||
|
if (dev->ieee80211_ptr) {
|
||||||
|
rdev = wiphy_to_dev(dev->ieee80211_ptr->wiphy);
|
||||||
|
mutex_lock(&rdev->mtx);
|
||||||
|
} else
|
||||||
|
rdev = ERR_PTR(-ENODEV);
|
||||||
|
dev_put(dev);
|
||||||
|
out:
|
||||||
|
mutex_unlock(&cfg80211_mutex);
|
||||||
|
return rdev;
|
||||||
|
}
|
||||||
|
|
||||||
int cfg80211_wext_siwscan(struct net_device *dev,
|
int cfg80211_wext_siwscan(struct net_device *dev,
|
||||||
struct iw_request_info *info,
|
struct iw_request_info *info,
|
||||||
union iwreq_data *wrqu, char *extra)
|
union iwreq_data *wrqu, char *extra)
|
||||||
|
Reference in New Issue
Block a user