mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-09-21 11:53:01 +00:00
cfg80211: pass netdev to change_virtual_intf
If there was a reason I'm passing the ifidx I cannot remember it any more and don't see one now, so let's just pass the pointer itself. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
e5a8a896f5
commit
e36d56b648
|
@ -167,20 +167,15 @@ int iwm_cfg80211_inform_bss(struct iwm_priv *iwm)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int iwm_cfg80211_change_iface(struct wiphy *wiphy, int ifindex,
|
static int iwm_cfg80211_change_iface(struct wiphy *wiphy,
|
||||||
|
struct net_device *ndev,
|
||||||
enum nl80211_iftype type, u32 *flags,
|
enum nl80211_iftype type, u32 *flags,
|
||||||
struct vif_params *params)
|
struct vif_params *params)
|
||||||
{
|
{
|
||||||
struct net_device *ndev;
|
|
||||||
struct wireless_dev *wdev;
|
struct wireless_dev *wdev;
|
||||||
struct iwm_priv *iwm;
|
struct iwm_priv *iwm;
|
||||||
u32 old_mode;
|
u32 old_mode;
|
||||||
|
|
||||||
/* we're under RTNL */
|
|
||||||
ndev = __dev_get_by_index(&init_net, ifindex);
|
|
||||||
if (!ndev)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
wdev = ndev->ieee80211_ptr;
|
wdev = ndev->ieee80211_ptr;
|
||||||
iwm = ndev_to_iwm(ndev);
|
iwm = ndev_to_iwm(ndev);
|
||||||
old_mode = iwm->conf.mode;
|
old_mode = iwm->conf.mode;
|
||||||
|
|
|
@ -420,7 +420,8 @@ struct rndis_wlan_private {
|
||||||
/*
|
/*
|
||||||
* cfg80211 ops
|
* cfg80211 ops
|
||||||
*/
|
*/
|
||||||
static int rndis_change_virtual_intf(struct wiphy *wiphy, int ifindex,
|
static int rndis_change_virtual_intf(struct wiphy *wiphy,
|
||||||
|
struct net_device *dev,
|
||||||
enum nl80211_iftype type, u32 *flags,
|
enum nl80211_iftype type, u32 *flags,
|
||||||
struct vif_params *params);
|
struct vif_params *params);
|
||||||
|
|
||||||
|
@ -1222,20 +1223,14 @@ static void set_multicast_list(struct usbnet *usbdev)
|
||||||
/*
|
/*
|
||||||
* cfg80211 ops
|
* cfg80211 ops
|
||||||
*/
|
*/
|
||||||
static int rndis_change_virtual_intf(struct wiphy *wiphy, int ifindex,
|
static int rndis_change_virtual_intf(struct wiphy *wiphy,
|
||||||
|
struct net_device *dev,
|
||||||
enum nl80211_iftype type, u32 *flags,
|
enum nl80211_iftype type, u32 *flags,
|
||||||
struct vif_params *params)
|
struct vif_params *params)
|
||||||
{
|
{
|
||||||
struct net_device *dev;
|
struct usbnet *usbdev = netdev_priv(dev);
|
||||||
struct usbnet *usbdev;
|
|
||||||
int mode;
|
int mode;
|
||||||
|
|
||||||
/* we're under RTNL */
|
|
||||||
dev = __dev_get_by_index(&init_net, ifindex);
|
|
||||||
if (!dev)
|
|
||||||
return -ENODEV;
|
|
||||||
usbdev = netdev_priv(dev);
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case NL80211_IFTYPE_ADHOC:
|
case NL80211_IFTYPE_ADHOC:
|
||||||
mode = NDIS_80211_INFRA_ADHOC;
|
mode = NDIS_80211_INFRA_ADHOC;
|
||||||
|
|
|
@ -866,7 +866,8 @@ struct cfg80211_ops {
|
||||||
enum nl80211_iftype type, u32 *flags,
|
enum nl80211_iftype type, u32 *flags,
|
||||||
struct vif_params *params);
|
struct vif_params *params);
|
||||||
int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
|
int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
|
||||||
int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
|
int (*change_virtual_intf)(struct wiphy *wiphy,
|
||||||
|
struct net_device *dev,
|
||||||
enum nl80211_iftype type, u32 *flags,
|
enum nl80211_iftype type, u32 *flags,
|
||||||
struct vif_params *params);
|
struct vif_params *params);
|
||||||
|
|
||||||
|
|
|
@ -74,19 +74,14 @@ static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
|
static int ieee80211_change_iface(struct wiphy *wiphy,
|
||||||
|
struct net_device *dev,
|
||||||
enum nl80211_iftype type, u32 *flags,
|
enum nl80211_iftype type, u32 *flags,
|
||||||
struct vif_params *params)
|
struct vif_params *params)
|
||||||
{
|
{
|
||||||
struct net_device *dev;
|
|
||||||
struct ieee80211_sub_if_data *sdata;
|
struct ieee80211_sub_if_data *sdata;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* we're under RTNL */
|
|
||||||
dev = __dev_get_by_index(&init_net, ifindex);
|
|
||||||
if (!dev)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
if (!nl80211_type_check(type))
|
if (!nl80211_type_check(type))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
|
|
@ -767,7 +767,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct cfg80211_registered_device *drv;
|
struct cfg80211_registered_device *drv;
|
||||||
struct vif_params params;
|
struct vif_params params;
|
||||||
int err, ifindex;
|
int err;
|
||||||
enum nl80211_iftype otype, ntype;
|
enum nl80211_iftype otype, ntype;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
u32 _flags, *flags = NULL;
|
u32 _flags, *flags = NULL;
|
||||||
|
@ -781,9 +781,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
|
||||||
if (err)
|
if (err)
|
||||||
goto unlock_rtnl;
|
goto unlock_rtnl;
|
||||||
|
|
||||||
ifindex = dev->ifindex;
|
|
||||||
otype = ntype = dev->ieee80211_ptr->iftype;
|
otype = ntype = dev->ieee80211_ptr->iftype;
|
||||||
dev_put(dev);
|
|
||||||
|
|
||||||
if (info->attrs[NL80211_ATTR_IFTYPE]) {
|
if (info->attrs[NL80211_ATTR_IFTYPE]) {
|
||||||
ntype = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]);
|
ntype = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]);
|
||||||
|
@ -826,20 +824,20 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (change)
|
if (change)
|
||||||
err = drv->ops->change_virtual_intf(&drv->wiphy, ifindex,
|
err = drv->ops->change_virtual_intf(&drv->wiphy, dev,
|
||||||
ntype, flags, ¶ms);
|
ntype, flags, ¶ms);
|
||||||
else
|
else
|
||||||
err = 0;
|
err = 0;
|
||||||
|
|
||||||
dev = __dev_get_by_index(&init_net, ifindex);
|
WARN_ON(!err && dev->ieee80211_ptr->iftype != ntype);
|
||||||
WARN_ON(!dev || (!err && dev->ieee80211_ptr->iftype != ntype));
|
|
||||||
|
|
||||||
if (dev && !err && (ntype != otype)) {
|
if (!err && (ntype != otype)) {
|
||||||
if (otype == NL80211_IFTYPE_ADHOC)
|
if (otype == NL80211_IFTYPE_ADHOC)
|
||||||
cfg80211_clear_ibss(dev, false);
|
cfg80211_clear_ibss(dev, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock:
|
unlock:
|
||||||
|
dev_put(dev);
|
||||||
cfg80211_put_dev(drv);
|
cfg80211_put_dev(drv);
|
||||||
unlock_rtnl:
|
unlock_rtnl:
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
|
|
|
@ -103,7 +103,7 @@ int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
|
||||||
|
|
||||||
memset(&vifparams, 0, sizeof(vifparams));
|
memset(&vifparams, 0, sizeof(vifparams));
|
||||||
|
|
||||||
ret = rdev->ops->change_virtual_intf(wdev->wiphy, dev->ifindex, type,
|
ret = rdev->ops->change_virtual_intf(wdev->wiphy, dev, type,
|
||||||
NULL, &vifparams);
|
NULL, &vifparams);
|
||||||
WARN_ON(!ret && wdev->iftype != type);
|
WARN_ON(!ret && wdev->iftype != type);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue