aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-06-18 13:17:03 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-07-12 06:10:41 -0400
commitfd0142844efa85d89017c89227a0f03de1eee327 (patch)
tree2b9977f712df0caa3ecda6dd59fe5b34932e2ab6
parent1c90f9d404a45a1677c1e5791f5a2a8aaee0370a (diff)
nl80211: move scan API to wdev
The new P2P Device will have to be able to scan for P2P search, so move scanning to use struct wireless_dev instead of struct net_device. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c6
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c3
-rw-r--r--drivers/net/wireless/iwmc3200wifi/cfg80211.c3
-rw-r--r--drivers/net/wireless/libertas/cfg.c1
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c3
-rw-r--r--drivers/net/wireless/orinoco/cfg.c2
-rw-r--r--drivers/net/wireless/rndis_wlan.c5
-rw-r--r--include/net/cfg80211.h7
-rw-r--r--net/mac80211/cfg.c5
-rw-r--r--net/wireless/core.c2
-rw-r--r--net/wireless/nl80211.c31
-rw-r--r--net/wireless/nl80211.h6
-rw-r--r--net/wireless/scan.c24
-rw-r--r--net/wireless/sme.c6
14 files changed, 57 insertions, 47 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 88bed02f7521..86aeef4b9d7e 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -966,11 +966,11 @@ static int ath6kl_set_probed_ssids(struct ath6kl *ar,
966 return 0; 966 return 0;
967} 967}
968 968
969static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, 969static int ath6kl_cfg80211_scan(struct wiphy *wiphy,
970 struct cfg80211_scan_request *request) 970 struct cfg80211_scan_request *request)
971{ 971{
972 struct ath6kl *ar = ath6kl_priv(ndev); 972 struct ath6kl_vif *vif = ath6kl_vif_from_wdev(request->wdev);
973 struct ath6kl_vif *vif = netdev_priv(ndev); 973 struct ath6kl *ar = ath6kl_priv(vif->ndev);
974 s8 n_channels = 0; 974 s8 n_channels = 0;
975 u16 *channels = NULL; 975 u16 *channels = NULL;
976 int ret = 0; 976 int ret = 0;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index d13ae9c299f2..c6a10caec79f 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -691,9 +691,10 @@ scan_out:
691} 691}
692 692
693static s32 693static s32
694brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, 694brcmf_cfg80211_scan(struct wiphy *wiphy,
695 struct cfg80211_scan_request *request) 695 struct cfg80211_scan_request *request)
696{ 696{
697 struct net_device *ndev = request->wdev->netdev;
697 s32 err = 0; 698 s32 err = 0;
698 699
699 WL_TRACE("Enter\n"); 700 WL_TRACE("Enter\n");
diff --git a/drivers/net/wireless/iwmc3200wifi/cfg80211.c b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
index 48e8218fd23b..523dd646f052 100644
--- a/drivers/net/wireless/iwmc3200wifi/cfg80211.c
+++ b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
@@ -353,9 +353,10 @@ static int iwm_cfg80211_change_iface(struct wiphy *wiphy,
353 return 0; 353 return 0;
354} 354}
355 355
356static int iwm_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, 356static int iwm_cfg80211_scan(struct wiphy *wiphy,
357 struct cfg80211_scan_request *request) 357 struct cfg80211_scan_request *request)
358{ 358{
359 struct net_device *ndev = request->wdev->netdev;
359 struct iwm_priv *iwm = ndev_to_iwm(ndev); 360 struct iwm_priv *iwm = ndev_to_iwm(ndev);
360 int ret; 361 int ret;
361 362
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index f4a203049fb4..706781316195 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -805,7 +805,6 @@ void lbs_scan_done(struct lbs_private *priv)
805} 805}
806 806
807static int lbs_cfg_scan(struct wiphy *wiphy, 807static int lbs_cfg_scan(struct wiphy *wiphy,
808 struct net_device *dev,
809 struct cfg80211_scan_request *request) 808 struct cfg80211_scan_request *request)
810{ 809{
811 struct lbs_private *priv = wiphy_priv(wiphy); 810 struct lbs_private *priv = wiphy_priv(wiphy);
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 1e8024ea6910..6ca571a1b8e2 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1376,9 +1376,10 @@ mwifiex_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
1376 * it also informs the results. 1376 * it also informs the results.
1377 */ 1377 */
1378static int 1378static int
1379mwifiex_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, 1379mwifiex_cfg80211_scan(struct wiphy *wiphy,
1380 struct cfg80211_scan_request *request) 1380 struct cfg80211_scan_request *request)
1381{ 1381{
1382 struct net_device *dev = request->wdev->netdev;
1382 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 1383 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
1383 int i; 1384 int i;
1384 struct ieee80211_channel *chan; 1385 struct ieee80211_channel *chan;
diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c
index e15675585fb1..7b751fba7e1f 100644
--- a/drivers/net/wireless/orinoco/cfg.c
+++ b/drivers/net/wireless/orinoco/cfg.c
@@ -138,7 +138,7 @@ static int orinoco_change_vif(struct wiphy *wiphy, struct net_device *dev,
138 return err; 138 return err;
139} 139}
140 140
141static int orinoco_scan(struct wiphy *wiphy, struct net_device *dev, 141static int orinoco_scan(struct wiphy *wiphy,
142 struct cfg80211_scan_request *request) 142 struct cfg80211_scan_request *request)
143{ 143{
144 struct orinoco_private *priv = wiphy_priv(wiphy); 144 struct orinoco_private *priv = wiphy_priv(wiphy);
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index dfcd02ab6cae..241162e8111d 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -484,7 +484,7 @@ static int rndis_change_virtual_intf(struct wiphy *wiphy,
484 enum nl80211_iftype type, u32 *flags, 484 enum nl80211_iftype type, u32 *flags,
485 struct vif_params *params); 485 struct vif_params *params);
486 486
487static int rndis_scan(struct wiphy *wiphy, struct net_device *dev, 487static int rndis_scan(struct wiphy *wiphy,
488 struct cfg80211_scan_request *request); 488 struct cfg80211_scan_request *request);
489 489
490static int rndis_set_wiphy_params(struct wiphy *wiphy, u32 changed); 490static int rndis_set_wiphy_params(struct wiphy *wiphy, u32 changed);
@@ -1941,9 +1941,10 @@ static int rndis_get_tx_power(struct wiphy *wiphy, int *dbm)
1941} 1941}
1942 1942
1943#define SCAN_DELAY_JIFFIES (6 * HZ) 1943#define SCAN_DELAY_JIFFIES (6 * HZ)
1944static int rndis_scan(struct wiphy *wiphy, struct net_device *dev, 1944static int rndis_scan(struct wiphy *wiphy,
1945 struct cfg80211_scan_request *request) 1945 struct cfg80211_scan_request *request)
1946{ 1946{
1947 struct net_device *dev = request->wdev->netdev;
1947 struct usbnet *usbdev = netdev_priv(dev); 1948 struct usbnet *usbdev = netdev_priv(dev);
1948 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); 1949 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
1949 int ret; 1950 int ret;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index aaaa3a255ed5..5a67165f3b19 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -999,7 +999,7 @@ struct cfg80211_ssid {
999 * @ie_len: length of ie in octets 999 * @ie_len: length of ie in octets
1000 * @rates: bitmap of rates to advertise for each band 1000 * @rates: bitmap of rates to advertise for each band
1001 * @wiphy: the wiphy this was for 1001 * @wiphy: the wiphy this was for
1002 * @dev: the interface 1002 * @wdev: the wireless device to scan for
1003 * @aborted: (internal) scan request was notified as aborted 1003 * @aborted: (internal) scan request was notified as aborted
1004 * @no_cck: used to send probe requests at non CCK rate in 2GHz band 1004 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
1005 */ 1005 */
@@ -1012,9 +1012,10 @@ struct cfg80211_scan_request {
1012 1012
1013 u32 rates[IEEE80211_NUM_BANDS]; 1013 u32 rates[IEEE80211_NUM_BANDS];
1014 1014
1015 struct wireless_dev *wdev;
1016
1015 /* internal */ 1017 /* internal */
1016 struct wiphy *wiphy; 1018 struct wiphy *wiphy;
1017 struct net_device *dev;
1018 bool aborted; 1019 bool aborted;
1019 bool no_cck; 1020 bool no_cck;
1020 1021
@@ -1700,7 +1701,7 @@ struct cfg80211_ops {
1700 struct ieee80211_channel *chan, 1701 struct ieee80211_channel *chan,
1701 enum nl80211_channel_type channel_type); 1702 enum nl80211_channel_type channel_type);
1702 1703
1703 int (*scan)(struct wiphy *wiphy, struct net_device *dev, 1704 int (*scan)(struct wiphy *wiphy,
1704 struct cfg80211_scan_request *request); 1705 struct cfg80211_scan_request *request);
1705 1706
1706 int (*auth)(struct wiphy *wiphy, struct net_device *dev, 1707 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index a752c7341d62..cfdc03f59e27 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1763,10 +1763,11 @@ static int ieee80211_resume(struct wiphy *wiphy)
1763#endif 1763#endif
1764 1764
1765static int ieee80211_scan(struct wiphy *wiphy, 1765static int ieee80211_scan(struct wiphy *wiphy,
1766 struct net_device *dev,
1767 struct cfg80211_scan_request *req) 1766 struct cfg80211_scan_request *req)
1768{ 1767{
1769 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1768 struct ieee80211_sub_if_data *sdata;
1769
1770 sdata = IEEE80211_WDEV_TO_SUB_IF(req->wdev);
1770 1771
1771 switch (ieee80211_vif_type_p2p(&sdata->vif)) { 1772 switch (ieee80211_vif_type_p2p(&sdata->vif)) {
1772 case NL80211_IFTYPE_STATION: 1773 case NL80211_IFTYPE_STATION:
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 2781a411cecc..0557bb159025 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -708,7 +708,7 @@ static void wdev_cleanup_work(struct work_struct *work)
708 708
709 cfg80211_lock_rdev(rdev); 709 cfg80211_lock_rdev(rdev);
710 710
711 if (WARN_ON(rdev->scan_req && rdev->scan_req->dev == wdev->netdev)) { 711 if (WARN_ON(rdev->scan_req && rdev->scan_req->wdev == wdev)) {
712 rdev->scan_req->aborted = true; 712 rdev->scan_req->aborted = true;
713 ___cfg80211_scan_done(rdev, true); 713 ___cfg80211_scan_done(rdev, true);
714 } 714 }
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 6a9a1d7f51d1..6472c7f928dc 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4130,7 +4130,7 @@ static int validate_scan_freqs(struct nlattr *freqs)
4130static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) 4130static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
4131{ 4131{
4132 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 4132 struct cfg80211_registered_device *rdev = info->user_ptr[0];
4133 struct net_device *dev = info->user_ptr[1]; 4133 struct wireless_dev *wdev = info->user_ptr[1];
4134 struct cfg80211_scan_request *request; 4134 struct cfg80211_scan_request *request;
4135 struct nlattr *attr; 4135 struct nlattr *attr;
4136 struct wiphy *wiphy; 4136 struct wiphy *wiphy;
@@ -4290,15 +4290,16 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
4290 request->no_cck = 4290 request->no_cck =
4291 nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); 4291 nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]);
4292 4292
4293 request->dev = dev; 4293 request->wdev = wdev;
4294 request->wiphy = &rdev->wiphy; 4294 request->wiphy = &rdev->wiphy;
4295 4295
4296 rdev->scan_req = request; 4296 rdev->scan_req = request;
4297 err = rdev->ops->scan(&rdev->wiphy, dev, request); 4297 err = rdev->ops->scan(&rdev->wiphy, request);
4298 4298
4299 if (!err) { 4299 if (!err) {
4300 nl80211_send_scan_start(rdev, dev); 4300 nl80211_send_scan_start(rdev, wdev);
4301 dev_hold(dev); 4301 if (wdev->netdev)
4302 dev_hold(wdev->netdev);
4302 } else { 4303 } else {
4303 out_free: 4304 out_free:
4304 rdev->scan_req = NULL; 4305 rdev->scan_req = NULL;
@@ -7066,7 +7067,7 @@ static struct genl_ops nl80211_ops[] = {
7066 .doit = nl80211_trigger_scan, 7067 .doit = nl80211_trigger_scan,
7067 .policy = nl80211_policy, 7068 .policy = nl80211_policy,
7068 .flags = GENL_ADMIN_PERM, 7069 .flags = GENL_ADMIN_PERM,
7069 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | 7070 .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
7070 NL80211_FLAG_NEED_RTNL, 7071 NL80211_FLAG_NEED_RTNL,
7071 }, 7072 },
7072 { 7073 {
@@ -7458,7 +7459,7 @@ static int nl80211_add_scan_req(struct sk_buff *msg,
7458 7459
7459static int nl80211_send_scan_msg(struct sk_buff *msg, 7460static int nl80211_send_scan_msg(struct sk_buff *msg,
7460 struct cfg80211_registered_device *rdev, 7461 struct cfg80211_registered_device *rdev,
7461 struct net_device *netdev, 7462 struct wireless_dev *wdev,
7462 u32 pid, u32 seq, int flags, 7463 u32 pid, u32 seq, int flags,
7463 u32 cmd) 7464 u32 cmd)
7464{ 7465{
@@ -7469,7 +7470,9 @@ static int nl80211_send_scan_msg(struct sk_buff *msg,
7469 return -1; 7470 return -1;
7470 7471
7471 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || 7472 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
7472 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) 7473 (wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX,
7474 wdev->netdev->ifindex)) ||
7475 nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)))
7473 goto nla_put_failure; 7476 goto nla_put_failure;
7474 7477
7475 /* ignore errors and send incomplete event anyway */ 7478 /* ignore errors and send incomplete event anyway */
@@ -7506,7 +7509,7 @@ nl80211_send_sched_scan_msg(struct sk_buff *msg,
7506} 7509}
7507 7510
7508void nl80211_send_scan_start(struct cfg80211_registered_device *rdev, 7511void nl80211_send_scan_start(struct cfg80211_registered_device *rdev,
7509 struct net_device *netdev) 7512 struct wireless_dev *wdev)
7510{ 7513{
7511 struct sk_buff *msg; 7514 struct sk_buff *msg;
7512 7515
@@ -7514,7 +7517,7 @@ void nl80211_send_scan_start(struct cfg80211_registered_device *rdev,
7514 if (!msg) 7517 if (!msg)
7515 return; 7518 return;
7516 7519
7517 if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0, 7520 if (nl80211_send_scan_msg(msg, rdev, wdev, 0, 0, 0,
7518 NL80211_CMD_TRIGGER_SCAN) < 0) { 7521 NL80211_CMD_TRIGGER_SCAN) < 0) {
7519 nlmsg_free(msg); 7522 nlmsg_free(msg);
7520 return; 7523 return;
@@ -7525,7 +7528,7 @@ void nl80211_send_scan_start(struct cfg80211_registered_device *rdev,
7525} 7528}
7526 7529
7527void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, 7530void nl80211_send_scan_done(struct cfg80211_registered_device *rdev,
7528 struct net_device *netdev) 7531 struct wireless_dev *wdev)
7529{ 7532{
7530 struct sk_buff *msg; 7533 struct sk_buff *msg;
7531 7534
@@ -7533,7 +7536,7 @@ void nl80211_send_scan_done(struct cfg80211_registered_device *rdev,
7533 if (!msg) 7536 if (!msg)
7534 return; 7537 return;
7535 7538
7536 if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0, 7539 if (nl80211_send_scan_msg(msg, rdev, wdev, 0, 0, 0,
7537 NL80211_CMD_NEW_SCAN_RESULTS) < 0) { 7540 NL80211_CMD_NEW_SCAN_RESULTS) < 0) {
7538 nlmsg_free(msg); 7541 nlmsg_free(msg);
7539 return; 7542 return;
@@ -7544,7 +7547,7 @@ void nl80211_send_scan_done(struct cfg80211_registered_device *rdev,
7544} 7547}
7545 7548
7546void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, 7549void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev,
7547 struct net_device *netdev) 7550 struct wireless_dev *wdev)
7548{ 7551{
7549 struct sk_buff *msg; 7552 struct sk_buff *msg;
7550 7553
@@ -7552,7 +7555,7 @@ void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev,
7552 if (!msg) 7555 if (!msg)
7553 return; 7556 return;
7554 7557
7555 if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0, 7558 if (nl80211_send_scan_msg(msg, rdev, wdev, 0, 0, 0,
7556 NL80211_CMD_SCAN_ABORTED) < 0) { 7559 NL80211_CMD_SCAN_ABORTED) < 0) {
7557 nlmsg_free(msg); 7560 nlmsg_free(msg);
7558 return; 7561 return;
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index 0469303b5c3c..89ce99675e61 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -7,11 +7,11 @@ int nl80211_init(void);
7void nl80211_exit(void); 7void nl80211_exit(void);
8void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev); 8void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev);
9void nl80211_send_scan_start(struct cfg80211_registered_device *rdev, 9void nl80211_send_scan_start(struct cfg80211_registered_device *rdev,
10 struct net_device *netdev); 10 struct wireless_dev *wdev);
11void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, 11void nl80211_send_scan_done(struct cfg80211_registered_device *rdev,
12 struct net_device *netdev); 12 struct wireless_dev *wdev);
13void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, 13void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev,
14 struct net_device *netdev); 14 struct wireless_dev *wdev);
15void nl80211_send_sched_scan(struct cfg80211_registered_device *rdev, 15void nl80211_send_sched_scan(struct cfg80211_registered_device *rdev,
16 struct net_device *netdev, u32 cmd); 16 struct net_device *netdev, u32 cmd);
17void nl80211_send_sched_scan_results(struct cfg80211_registered_device *rdev, 17void nl80211_send_sched_scan_results(struct cfg80211_registered_device *rdev,
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index af2b1caa37fa..848523a2b22f 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -23,7 +23,7 @@
23void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak) 23void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak)
24{ 24{
25 struct cfg80211_scan_request *request; 25 struct cfg80211_scan_request *request;
26 struct net_device *dev; 26 struct wireless_dev *wdev;
27#ifdef CONFIG_CFG80211_WEXT 27#ifdef CONFIG_CFG80211_WEXT
28 union iwreq_data wrqu; 28 union iwreq_data wrqu;
29#endif 29#endif
@@ -35,29 +35,31 @@ void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak)
35 if (!request) 35 if (!request)
36 return; 36 return;
37 37
38 dev = request->dev; 38 wdev = request->wdev;
39 39
40 /* 40 /*
41 * This must be before sending the other events! 41 * This must be before sending the other events!
42 * Otherwise, wpa_supplicant gets completely confused with 42 * Otherwise, wpa_supplicant gets completely confused with
43 * wext events. 43 * wext events.
44 */ 44 */
45 cfg80211_sme_scan_done(dev); 45 if (wdev->netdev)
46 cfg80211_sme_scan_done(wdev->netdev);
46 47
47 if (request->aborted) 48 if (request->aborted)
48 nl80211_send_scan_aborted(rdev, dev); 49 nl80211_send_scan_aborted(rdev, wdev);
49 else 50 else
50 nl80211_send_scan_done(rdev, dev); 51 nl80211_send_scan_done(rdev, wdev);
51 52
52#ifdef CONFIG_CFG80211_WEXT 53#ifdef CONFIG_CFG80211_WEXT
53 if (!request->aborted) { 54 if (wdev->netdev && !request->aborted) {
54 memset(&wrqu, 0, sizeof(wrqu)); 55 memset(&wrqu, 0, sizeof(wrqu));
55 56
56 wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL); 57 wireless_send_event(wdev->netdev, SIOCGIWSCAN, &wrqu, NULL);
57 } 58 }
58#endif 59#endif
59 60
60 dev_put(dev); 61 if (wdev->netdev)
62 dev_put(wdev->netdev);
61 63
62 rdev->scan_req = NULL; 64 rdev->scan_req = NULL;
63 65
@@ -955,7 +957,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
955 } 957 }
956 958
957 creq->wiphy = wiphy; 959 creq->wiphy = wiphy;
958 creq->dev = dev; 960 creq->wdev = dev->ieee80211_ptr;
959 /* SSIDs come after channels */ 961 /* SSIDs come after channels */
960 creq->ssids = (void *)&creq->channels[n_channels]; 962 creq->ssids = (void *)&creq->channels[n_channels];
961 creq->n_channels = n_channels; 963 creq->n_channels = n_channels;
@@ -1024,12 +1026,12 @@ int cfg80211_wext_siwscan(struct net_device *dev,
1024 creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1; 1026 creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1;
1025 1027
1026 rdev->scan_req = creq; 1028 rdev->scan_req = creq;
1027 err = rdev->ops->scan(wiphy, dev, creq); 1029 err = rdev->ops->scan(wiphy, creq);
1028 if (err) { 1030 if (err) {
1029 rdev->scan_req = NULL; 1031 rdev->scan_req = NULL;
1030 /* creq will be freed below */ 1032 /* creq will be freed below */
1031 } else { 1033 } else {
1032 nl80211_send_scan_start(rdev, dev); 1034 nl80211_send_scan_start(rdev, dev->ieee80211_ptr);
1033 /* creq now owned by driver */ 1035 /* creq now owned by driver */
1034 creq = NULL; 1036 creq = NULL;
1035 dev_hold(dev); 1037 dev_hold(dev);
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index dec97981e689..6f39cb808302 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -136,15 +136,15 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
136 wdev->conn->params.ssid_len); 136 wdev->conn->params.ssid_len);
137 request->ssids[0].ssid_len = wdev->conn->params.ssid_len; 137 request->ssids[0].ssid_len = wdev->conn->params.ssid_len;
138 138
139 request->dev = wdev->netdev; 139 request->wdev = wdev;
140 request->wiphy = &rdev->wiphy; 140 request->wiphy = &rdev->wiphy;
141 141
142 rdev->scan_req = request; 142 rdev->scan_req = request;
143 143
144 err = rdev->ops->scan(wdev->wiphy, wdev->netdev, request); 144 err = rdev->ops->scan(wdev->wiphy, request);
145 if (!err) { 145 if (!err) {
146 wdev->conn->state = CFG80211_CONN_SCANNING; 146 wdev->conn->state = CFG80211_CONN_SCANNING;
147 nl80211_send_scan_start(rdev, wdev->netdev); 147 nl80211_send_scan_start(rdev, wdev);
148 dev_hold(wdev->netdev); 148 dev_hold(wdev->netdev);
149 } else { 149 } else {
150 rdev->scan_req = NULL; 150 rdev->scan_req = NULL;