diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-06-09 15:04:43 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 14:57:38 -0400 |
commit | e36d56b64808aec54b68b4e9976180c1da0933b2 (patch) | |
tree | 93f0e696d077b58d1064f3321d52b4611addf104 /net | |
parent | e5a8a896f5180f2950695d2d0b79db348d200ca4 (diff) |
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/cfg.c | 9 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 12 | ||||
-rw-r--r-- | net/wireless/wext-compat.c | 2 |
3 files changed, 8 insertions, 15 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 3f47276caeb8..eb93eb6a9cc7 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -74,19 +74,14 @@ static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex) | |||
74 | return 0; | 74 | return 0; |
75 | } | 75 | } |
76 | 76 | ||
77 | static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex, | 77 | static int ieee80211_change_iface(struct wiphy *wiphy, |
78 | struct net_device *dev, | ||
78 | enum nl80211_iftype type, u32 *flags, | 79 | enum nl80211_iftype type, u32 *flags, |
79 | struct vif_params *params) | 80 | struct vif_params *params) |
80 | { | 81 | { |
81 | struct net_device *dev; | ||
82 | struct ieee80211_sub_if_data *sdata; | 82 | struct ieee80211_sub_if_data *sdata; |
83 | int ret; | 83 | int ret; |
84 | 84 | ||
85 | /* we're under RTNL */ | ||
86 | dev = __dev_get_by_index(&init_net, ifindex); | ||
87 | if (!dev) | ||
88 | return -ENODEV; | ||
89 | |||
90 | if (!nl80211_type_check(type)) | 85 | if (!nl80211_type_check(type)) |
91 | return -EINVAL; | 86 | return -EINVAL; |
92 | 87 | ||
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 43bdb1372cae..f91e5d472c60 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -767,7 +767,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info) | |||
767 | { | 767 | { |
768 | struct cfg80211_registered_device *drv; | 768 | struct cfg80211_registered_device *drv; |
769 | struct vif_params params; | 769 | struct vif_params params; |
770 | int err, ifindex; | 770 | int err; |
771 | enum nl80211_iftype otype, ntype; | 771 | enum nl80211_iftype otype, ntype; |
772 | struct net_device *dev; | 772 | struct net_device *dev; |
773 | u32 _flags, *flags = NULL; | 773 | u32 _flags, *flags = NULL; |
@@ -781,9 +781,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info) | |||
781 | if (err) | 781 | if (err) |
782 | goto unlock_rtnl; | 782 | goto unlock_rtnl; |
783 | 783 | ||
784 | ifindex = dev->ifindex; | ||
785 | otype = ntype = dev->ieee80211_ptr->iftype; | 784 | otype = ntype = dev->ieee80211_ptr->iftype; |
786 | dev_put(dev); | ||
787 | 785 | ||
788 | if (info->attrs[NL80211_ATTR_IFTYPE]) { | 786 | if (info->attrs[NL80211_ATTR_IFTYPE]) { |
789 | ntype = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]); | 787 | 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) | |||
826 | } | 824 | } |
827 | 825 | ||
828 | if (change) | 826 | if (change) |
829 | err = drv->ops->change_virtual_intf(&drv->wiphy, ifindex, | 827 | err = drv->ops->change_virtual_intf(&drv->wiphy, dev, |
830 | ntype, flags, ¶ms); | 828 | ntype, flags, ¶ms); |
831 | else | 829 | else |
832 | err = 0; | 830 | err = 0; |
833 | 831 | ||
834 | dev = __dev_get_by_index(&init_net, ifindex); | 832 | WARN_ON(!err && dev->ieee80211_ptr->iftype != ntype); |
835 | WARN_ON(!dev || (!err && dev->ieee80211_ptr->iftype != ntype)); | ||
836 | 833 | ||
837 | if (dev && !err && (ntype != otype)) { | 834 | if (!err && (ntype != otype)) { |
838 | if (otype == NL80211_IFTYPE_ADHOC) | 835 | if (otype == NL80211_IFTYPE_ADHOC) |
839 | cfg80211_clear_ibss(dev, false); | 836 | cfg80211_clear_ibss(dev, false); |
840 | } | 837 | } |
841 | 838 | ||
842 | unlock: | 839 | unlock: |
840 | dev_put(dev); | ||
843 | cfg80211_put_dev(drv); | 841 | cfg80211_put_dev(drv); |
844 | unlock_rtnl: | 842 | unlock_rtnl: |
845 | rtnl_unlock(); | 843 | rtnl_unlock(); |
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index d030c5315672..9e56f3569e3e 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c | |||
@@ -103,7 +103,7 @@ int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info, | |||
103 | 103 | ||
104 | memset(&vifparams, 0, sizeof(vifparams)); | 104 | memset(&vifparams, 0, sizeof(vifparams)); |
105 | 105 | ||
106 | ret = rdev->ops->change_virtual_intf(wdev->wiphy, dev->ifindex, type, | 106 | ret = rdev->ops->change_virtual_intf(wdev->wiphy, dev, type, |
107 | NULL, &vifparams); | 107 | NULL, &vifparams); |
108 | WARN_ON(!ret && wdev->iftype != type); | 108 | WARN_ON(!ret && wdev->iftype != type); |
109 | 109 | ||