enum nl80211_iftype type, u32 *flags,
                                  struct vif_params *params)
 {
-       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct net_device *dev;
        struct ieee80211_sub_if_data *sdata;
        int ret;
        if (!nl80211_type_check(type))
                return -EINVAL;
 
-       if (dev == local->mdev)
-               return -EOPNOTSUPP;
-
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        ret = ieee80211_if_change_type(sdata, type);
                             u8 key_idx, u8 *mac_addr,
                             struct key_params *params)
 {
-       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata;
        struct sta_info *sta = NULL;
        enum ieee80211_key_alg alg;
        struct ieee80211_key *key;
        int err;
 
-       if (dev == local->mdev)
-               return -EOPNOTSUPP;
-
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        switch (params->cipher) {
 static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
                             u8 key_idx, u8 *mac_addr)
 {
-       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata;
        struct sta_info *sta;
        int ret;
 
-       if (dev == local->mdev)
-               return -EOPNOTSUPP;
-
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        rcu_read_lock();
                             void (*callback)(void *cookie,
                                              struct key_params *params))
 {
-       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata;
        struct sta_info *sta = NULL;
        u8 seq[6] = {0};
        u16 iv16;
        int err = -ENOENT;
 
-       if (dev == local->mdev)
-               return -EOPNOTSUPP;
-
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        rcu_read_lock();
                                        struct net_device *dev,
                                        u8 key_idx)
 {
-       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata;
 
-       if (dev == local->mdev)
-               return -EOPNOTSUPP;
-
        rcu_read_lock();
 
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
                                struct beacon_parameters *params)
 {
-       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata;
        struct beacon_data *old;
 
-       if (dev == local->mdev)
-               return -EOPNOTSUPP;
-
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        if (sdata->vif.type != NL80211_IFTYPE_AP)
 static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
                                struct beacon_parameters *params)
 {
-       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata;
        struct beacon_data *old;
 
-       if (dev == local->mdev)
-               return -EOPNOTSUPP;
-
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        if (sdata->vif.type != NL80211_IFTYPE_AP)
 
 static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
 {
-       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata;
        struct beacon_data *old;
 
-       if (dev == local->mdev)
-               return -EOPNOTSUPP;
-
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        if (sdata->vif.type != NL80211_IFTYPE_AP)
        struct ieee80211_sub_if_data *sdata;
        int err;
 
-       if (dev == local->mdev || params->vlan == local->mdev)
-               return -EOPNOTSUPP;
-
        /* Prevent a race with changing the rate control algorithm */
        if (!netif_running(dev))
                return -ENETDOWN;
        struct ieee80211_sub_if_data *sdata;
        struct sta_info *sta;
 
-       if (dev == local->mdev)
-               return -EOPNOTSUPP;
-
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        if (mac) {
        struct sta_info *sta;
        struct ieee80211_sub_if_data *vlansdata;
 
-       if (dev == local->mdev || params->vlan == local->mdev)
-               return -EOPNOTSUPP;
-
        rcu_read_lock();
 
        /* XXX: get sta belonging to dev */
        struct sta_info *sta;
        int err;
 
-       if (dev == local->mdev)
-               return -EOPNOTSUPP;
-
        if (!netif_running(dev))
                return -ENETDOWN;
 
        struct mesh_path *mpath;
        struct sta_info *sta;
 
-       if (dev == local->mdev)
-               return -EOPNOTSUPP;
-
        if (!netif_running(dev))
                return -ENETDOWN;
 
                               u8 *dst, u8 *next_hop, struct mpath_info *pinfo)
 
 {
-       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata;
        struct mesh_path *mpath;
 
-       if (dev == local->mdev)
-               return -EOPNOTSUPP;
-
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
                                 int idx, u8 *dst, u8 *next_hop,
                                 struct mpath_info *pinfo)
 {
-       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata;
        struct mesh_path *mpath;
 
-       if (dev == local->mdev)
-               return -EOPNOTSUPP;
-
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
                                struct net_device *dev,
                                struct bss_parameters *params)
 {
-       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata;
        u32 changed = 0;
 
-       if (dev == local->mdev)
-               return -EOPNOTSUPP;
-
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        if (sdata->vif.type != NL80211_IFTYPE_AP)
 
                const char __user *user_buf, size_t count, loff_t *ppos)
 {
        struct sta_info *sta = file->private_data;
-       struct net_device *dev = sta->sdata->dev;
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+       struct ieee80211_local *local = sta->sdata->local;
        struct ieee80211_hw *hw = &local->hw;
        u8 *da = sta->sta.addr;
        static int tid_static_tx[16] = {0, 0, 0, 0, 0, 0, 0, 0,
 
 /* maximum number of hardware queues we support. */
 #define QD_MAX_QUEUES (IEEE80211_MAX_AMPDU_QUEUES + IEEE80211_MAX_QUEUES)
 
+struct ieee80211_master_priv {
+       struct ieee80211_local *local;
+};
+
 struct ieee80211_local {
        /* embed the driver visible part.
         * don't cast (use the static inlines below), but we keep
 
 
 static int ieee80211_master_open(struct net_device *dev)
 {
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+       struct ieee80211_master_priv *mpriv = netdev_priv(dev);
+       struct ieee80211_local *local = mpriv->local;
        struct ieee80211_sub_if_data *sdata;
        int res = -EOPNOTSUPP;
 
 
 static int ieee80211_master_stop(struct net_device *dev)
 {
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+       struct ieee80211_master_priv *mpriv = netdev_priv(dev);
+       struct ieee80211_local *local = mpriv->local;
        struct ieee80211_sub_if_data *sdata;
 
        /* we hold the RTNL here so can safely walk the list */
 
 static void ieee80211_master_set_multicast_list(struct net_device *dev)
 {
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+       struct ieee80211_master_priv *mpriv = netdev_priv(dev);
+       struct ieee80211_local *local = mpriv->local;
 
        ieee80211_configure_filter(local);
 }
        int result;
        enum ieee80211_band band;
        struct net_device *mdev;
-       struct wireless_dev *mwdev;
+       struct ieee80211_master_priv *mpriv;
 
        /*
         * generic code guarantees at least one band,
        if (hw->queues < 4)
                hw->ampdu_queues = 0;
 
-       mdev = alloc_netdev_mq(sizeof(struct wireless_dev),
+       mdev = alloc_netdev_mq(sizeof(struct ieee80211_master_priv),
                               "wmaster%d", ether_setup,
                               ieee80211_num_queues(hw));
        if (!mdev)
                goto fail_mdev_alloc;
 
-       mwdev = netdev_priv(mdev);
-       mdev->ieee80211_ptr = mwdev;
-       mwdev->wiphy = local->hw.wiphy;
-
+       mpriv = netdev_priv(mdev);
+       mpriv->local = local;
        local->mdev = mdev;
 
        ieee80211_rx_bss_list_init(local);
 
        struct ieee80211_sub_if_data *sdata =
                (struct ieee80211_sub_if_data *) data;
        struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
-       struct ieee80211_local *local = wdev_priv(&sdata->wdev);
+       struct ieee80211_local *local = sdata->local;
 
        queue_work(local->hw.workqueue, &ifmsh->work);
 }
 
        return result;
 }
 
-static void ap_sta_ps_start(struct net_device *dev, struct sta_info *sta)
+static void ap_sta_ps_start(struct sta_info *sta)
 {
-       struct ieee80211_sub_if_data *sdata;
+       struct ieee80211_sub_if_data *sdata = sta->sdata;
        DECLARE_MAC_BUF(mac);
 
-       sdata = sta->sdata;
-
        atomic_inc(&sdata->bss->num_sta_ps);
        set_and_clear_sta_flags(sta, WLAN_STA_PS, WLAN_STA_PSPOLL);
 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
        printk(KERN_DEBUG "%s: STA %s aid %d enters power save mode\n",
-              dev->name, print_mac(mac, sta->sta.addr), sta->sta.aid);
+              sdata->dev->name, print_mac(mac, sta->sta.addr), sta->sta.aid);
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
 }
 
-static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
+static int ap_sta_ps_end(struct sta_info *sta)
 {
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+       struct ieee80211_sub_if_data *sdata = sta->sdata;
+       struct ieee80211_local *local = sdata->local;
        struct sk_buff *skb;
        int sent = 0;
-       struct ieee80211_sub_if_data *sdata;
        struct ieee80211_tx_info *info;
        DECLARE_MAC_BUF(mac);
 
-       sdata = sta->sdata;
-
        atomic_dec(&sdata->bss->num_sta_ps);
 
        clear_sta_flags(sta, WLAN_STA_PS | WLAN_STA_PSPOLL);
 
 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
        printk(KERN_DEBUG "%s: STA %s aid %d exits power save mode\n",
-              dev->name, print_mac(mac, sta->sta.addr), sta->sta.aid);
+              sdata->dev->name, print_mac(mac, sta->sta.addr), sta->sta.aid);
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
 
        /* Send all buffered frames to the station */
                sent++;
 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
                printk(KERN_DEBUG "%s: STA %s aid %d send PS frame "
-                      "since STA not sleeping anymore\n", dev->name,
+                      "since STA not sleeping anymore\n", sdata->dev->name,
                       print_mac(mac, sta->sta.addr), sta->sta.aid);
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
                info->flags |= IEEE80211_TX_CTL_REQUEUE;
 ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
 {
        struct sta_info *sta = rx->sta;
-       struct net_device *dev = rx->dev;
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
 
        if (!sta)
                 * exchange sequence */
                if (test_sta_flags(sta, WLAN_STA_PS) &&
                    !ieee80211_has_pm(hdr->frame_control))
-                       rx->sent_ps_buffered += ap_sta_ps_end(dev, sta);
+                       rx->sent_ps_buffered += ap_sta_ps_end(sta);
                else if (!test_sta_flags(sta, WLAN_STA_PS) &&
                         ieee80211_has_pm(hdr->frame_control))
-                       ap_sta_ps_start(dev, sta);
+                       ap_sta_ps_start(sta);
        }
 
        /* Drop data::nullfunc frames silently, since they are used only to
 
        return cpu_to_le16(dur);
 }
 
-static int inline is_ieee80211_device(struct net_device *dev,
-                                     struct net_device *master)
+static int inline is_ieee80211_device(struct ieee80211_local *local,
+                                     struct net_device *dev)
 {
-       return (wdev_priv(dev->ieee80211_ptr) ==
-               wdev_priv(master->ieee80211_ptr));
+       return local == wdev_priv(dev->ieee80211_ptr);
 }
 
 /* tx handlers */
 /*
  * NB: @tx is uninitialised when passed in here
  */
-static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
-                               struct sk_buff *skb,
-                               struct net_device *mdev)
+static int ieee80211_tx_prepare(struct ieee80211_local *local,
+                               struct ieee80211_tx_data *tx,
+                               struct sk_buff *skb)
 {
        struct net_device *dev;
 
        dev = dev_get_by_index(&init_net, skb->iif);
-       if (unlikely(dev && !is_ieee80211_device(dev, mdev))) {
+       if (unlikely(dev && !is_ieee80211_device(local, dev))) {
                dev_put(dev);
                dev = NULL;
        }
 int ieee80211_master_start_xmit(struct sk_buff *skb,
                                struct net_device *dev)
 {
+       struct ieee80211_master_priv *mpriv = netdev_priv(dev);
+       struct ieee80211_local *local = mpriv->local;
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
        struct net_device *odev = NULL;
 
        if (skb->iif)
                odev = dev_get_by_index(&init_net, skb->iif);
-       if (unlikely(odev && !is_ieee80211_device(odev, dev))) {
+       if (unlikely(odev && !is_ieee80211_device(local, odev))) {
                dev_put(odev);
                odev = NULL;
        }
 int ieee80211_subif_start_xmit(struct sk_buff *skb,
                               struct net_device *dev)
 {
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-       struct ieee80211_sub_if_data *sdata;
+       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct ieee80211_local *local = sdata->local;
        int ret = 1, head_need;
        u16 ethertype, hdrlen,  meshhdrlen = 0;
        __le16 fc;
        struct sta_info *sta;
        u32 sta_flags = 0;
 
-       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
        if (unlikely(skb->len < ETH_HLEN)) {
                ret = 0;
                goto fail;
                                cpu_to_le16(IEEE80211_FCTL_MOREDATA);
                }
 
-               if (!ieee80211_tx_prepare(&tx, skb, local->mdev))
+               if (!ieee80211_tx_prepare(local, &tx, skb))
                        break;
                dev_kfree_skb_any(skb);
        }