return 0;
 }
 
-static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
+static int ath6kl_cfg80211_scan(struct wiphy *wiphy,
                                struct cfg80211_scan_request *request)
 {
-       struct ath6kl *ar = ath6kl_priv(ndev);
-       struct ath6kl_vif *vif = netdev_priv(ndev);
+       struct ath6kl_vif *vif = ath6kl_vif_from_wdev(request->wdev);
+       struct ath6kl *ar = ath6kl_priv(vif->ndev);
        s8 n_channels = 0;
        u16 *channels = NULL;
        int ret = 0;
 
 }
 
 static s32
-brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
+brcmf_cfg80211_scan(struct wiphy *wiphy,
                 struct cfg80211_scan_request *request)
 {
+       struct net_device *ndev = request->wdev->netdev;
        s32 err = 0;
 
        WL_TRACE("Enter\n");
 
        return 0;
 }
 
-static int iwm_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
+static int iwm_cfg80211_scan(struct wiphy *wiphy,
                             struct cfg80211_scan_request *request)
 {
+       struct net_device *ndev = request->wdev->netdev;
        struct iwm_priv *iwm = ndev_to_iwm(ndev);
        int ret;
 
 
 }
 
 static int lbs_cfg_scan(struct wiphy *wiphy,
-       struct net_device *dev,
        struct cfg80211_scan_request *request)
 {
        struct lbs_private *priv = wiphy_priv(wiphy);
 
  * it also informs the results.
  */
 static int
-mwifiex_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev,
+mwifiex_cfg80211_scan(struct wiphy *wiphy,
                      struct cfg80211_scan_request *request)
 {
+       struct net_device *dev = request->wdev->netdev;
        struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
        int i;
        struct ieee80211_channel *chan;
 
        return err;
 }
 
-static int orinoco_scan(struct wiphy *wiphy, struct net_device *dev,
+static int orinoco_scan(struct wiphy *wiphy,
                        struct cfg80211_scan_request *request)
 {
        struct orinoco_private *priv = wiphy_priv(wiphy);
 
                                        enum nl80211_iftype type, u32 *flags,
                                        struct vif_params *params);
 
-static int rndis_scan(struct wiphy *wiphy, struct net_device *dev,
+static int rndis_scan(struct wiphy *wiphy,
                        struct cfg80211_scan_request *request);
 
 static int rndis_set_wiphy_params(struct wiphy *wiphy, u32 changed);
 }
 
 #define SCAN_DELAY_JIFFIES (6 * HZ)
-static int rndis_scan(struct wiphy *wiphy, struct net_device *dev,
+static int rndis_scan(struct wiphy *wiphy,
                        struct cfg80211_scan_request *request)
 {
+       struct net_device *dev = request->wdev->netdev;
        struct usbnet *usbdev = netdev_priv(dev);
        struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
        int ret;
 
  * @ie_len: length of ie in octets
  * @rates: bitmap of rates to advertise for each band
  * @wiphy: the wiphy this was for
- * @dev: the interface
+ * @wdev: the wireless device to scan for
  * @aborted: (internal) scan request was notified as aborted
  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
  */
 
        u32 rates[IEEE80211_NUM_BANDS];
 
+       struct wireless_dev *wdev;
+
        /* internal */
        struct wiphy *wiphy;
-       struct net_device *dev;
        bool aborted;
        bool no_cck;
 
                                       struct ieee80211_channel *chan,
                                       enum nl80211_channel_type channel_type);
 
-       int     (*scan)(struct wiphy *wiphy, struct net_device *dev,
+       int     (*scan)(struct wiphy *wiphy,
                        struct cfg80211_scan_request *request);
 
        int     (*auth)(struct wiphy *wiphy, struct net_device *dev,
 
 #endif
 
 static int ieee80211_scan(struct wiphy *wiphy,
-                         struct net_device *dev,
                          struct cfg80211_scan_request *req)
 {
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct ieee80211_sub_if_data *sdata;
+
+       sdata = IEEE80211_WDEV_TO_SUB_IF(req->wdev);
 
        switch (ieee80211_vif_type_p2p(&sdata->vif)) {
        case NL80211_IFTYPE_STATION:
 
 
        cfg80211_lock_rdev(rdev);
 
-       if (WARN_ON(rdev->scan_req && rdev->scan_req->dev == wdev->netdev)) {
+       if (WARN_ON(rdev->scan_req && rdev->scan_req->wdev == wdev)) {
                rdev->scan_req->aborted = true;
                ___cfg80211_scan_done(rdev, true);
        }
 
 static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
 {
        struct cfg80211_registered_device *rdev = info->user_ptr[0];
-       struct net_device *dev = info->user_ptr[1];
+       struct wireless_dev *wdev = info->user_ptr[1];
        struct cfg80211_scan_request *request;
        struct nlattr *attr;
        struct wiphy *wiphy;
        request->no_cck =
                nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]);
 
-       request->dev = dev;
+       request->wdev = wdev;
        request->wiphy = &rdev->wiphy;
 
        rdev->scan_req = request;
-       err = rdev->ops->scan(&rdev->wiphy, dev, request);
+       err = rdev->ops->scan(&rdev->wiphy, request);
 
        if (!err) {
-               nl80211_send_scan_start(rdev, dev);
-               dev_hold(dev);
+               nl80211_send_scan_start(rdev, wdev);
+               if (wdev->netdev)
+                       dev_hold(wdev->netdev);
        } else {
  out_free:
                rdev->scan_req = NULL;
                .doit = nl80211_trigger_scan,
                .policy = nl80211_policy,
                .flags = GENL_ADMIN_PERM,
-               .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
+               .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
                                  NL80211_FLAG_NEED_RTNL,
        },
        {
 
 static int nl80211_send_scan_msg(struct sk_buff *msg,
                                 struct cfg80211_registered_device *rdev,
-                                struct net_device *netdev,
+                                struct wireless_dev *wdev,
                                 u32 pid, u32 seq, int flags,
                                 u32 cmd)
 {
                return -1;
 
        if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
-           nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex))
+           (wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX,
+                                        wdev->netdev->ifindex)) ||
+           nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)))
                goto nla_put_failure;
 
        /* ignore errors and send incomplete event anyway */
 }
 
 void nl80211_send_scan_start(struct cfg80211_registered_device *rdev,
-                            struct net_device *netdev)
+                            struct wireless_dev *wdev)
 {
        struct sk_buff *msg;
 
        if (!msg)
                return;
 
-       if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0,
+       if (nl80211_send_scan_msg(msg, rdev, wdev, 0, 0, 0,
                                  NL80211_CMD_TRIGGER_SCAN) < 0) {
                nlmsg_free(msg);
                return;
 }
 
 void nl80211_send_scan_done(struct cfg80211_registered_device *rdev,
-                           struct net_device *netdev)
+                           struct wireless_dev *wdev)
 {
        struct sk_buff *msg;
 
        if (!msg)
                return;
 
-       if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0,
+       if (nl80211_send_scan_msg(msg, rdev, wdev, 0, 0, 0,
                                  NL80211_CMD_NEW_SCAN_RESULTS) < 0) {
                nlmsg_free(msg);
                return;
 }
 
 void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev,
-                              struct net_device *netdev)
+                              struct wireless_dev *wdev)
 {
        struct sk_buff *msg;
 
        if (!msg)
                return;
 
-       if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0,
+       if (nl80211_send_scan_msg(msg, rdev, wdev, 0, 0, 0,
                                  NL80211_CMD_SCAN_ABORTED) < 0) {
                nlmsg_free(msg);
                return;
 
 void nl80211_exit(void);
 void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev);
 void nl80211_send_scan_start(struct cfg80211_registered_device *rdev,
-                            struct net_device *netdev);
+                            struct wireless_dev *wdev);
 void nl80211_send_scan_done(struct cfg80211_registered_device *rdev,
-                           struct net_device *netdev);
+                           struct wireless_dev *wdev);
 void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev,
-                              struct net_device *netdev);
+                              struct wireless_dev *wdev);
 void nl80211_send_sched_scan(struct cfg80211_registered_device *rdev,
                             struct net_device *netdev, u32 cmd);
 void nl80211_send_sched_scan_results(struct cfg80211_registered_device *rdev,
 
 void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak)
 {
        struct cfg80211_scan_request *request;
-       struct net_device *dev;
+       struct wireless_dev *wdev;
 #ifdef CONFIG_CFG80211_WEXT
        union iwreq_data wrqu;
 #endif
        if (!request)
                return;
 
-       dev = request->dev;
+       wdev = request->wdev;
 
        /*
         * This must be before sending the other events!
         * Otherwise, wpa_supplicant gets completely confused with
         * wext events.
         */
-       cfg80211_sme_scan_done(dev);
+       if (wdev->netdev)
+               cfg80211_sme_scan_done(wdev->netdev);
 
        if (request->aborted)
-               nl80211_send_scan_aborted(rdev, dev);
+               nl80211_send_scan_aborted(rdev, wdev);
        else
-               nl80211_send_scan_done(rdev, dev);
+               nl80211_send_scan_done(rdev, wdev);
 
 #ifdef CONFIG_CFG80211_WEXT
-       if (!request->aborted) {
+       if (wdev->netdev && !request->aborted) {
                memset(&wrqu, 0, sizeof(wrqu));
 
-               wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL);
+               wireless_send_event(wdev->netdev, SIOCGIWSCAN, &wrqu, NULL);
        }
 #endif
 
-       dev_put(dev);
+       if (wdev->netdev)
+               dev_put(wdev->netdev);
 
        rdev->scan_req = NULL;
 
        }
 
        creq->wiphy = wiphy;
-       creq->dev = dev;
+       creq->wdev = dev->ieee80211_ptr;
        /* SSIDs come after channels */
        creq->ssids = (void *)&creq->channels[n_channels];
        creq->n_channels = n_channels;
                        creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1;
 
        rdev->scan_req = creq;
-       err = rdev->ops->scan(wiphy, dev, creq);
+       err = rdev->ops->scan(wiphy, creq);
        if (err) {
                rdev->scan_req = NULL;
                /* creq will be freed below */
        } else {
-               nl80211_send_scan_start(rdev, dev);
+               nl80211_send_scan_start(rdev, dev->ieee80211_ptr);
                /* creq now owned by driver */
                creq = NULL;
                dev_hold(dev);
 
                wdev->conn->params.ssid_len);
        request->ssids[0].ssid_len = wdev->conn->params.ssid_len;
 
-       request->dev = wdev->netdev;
+       request->wdev = wdev;
        request->wiphy = &rdev->wiphy;
 
        rdev->scan_req = request;
 
-       err = rdev->ops->scan(wdev->wiphy, wdev->netdev, request);
+       err = rdev->ops->scan(wdev->wiphy, request);
        if (!err) {
                wdev->conn->state = CFG80211_CONN_SCANNING;
-               nl80211_send_scan_start(rdev, wdev->netdev);
+               nl80211_send_scan_start(rdev, wdev);
                dev_hold(wdev->netdev);
        } else {
                rdev->scan_req = NULL;