static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
                                    struct ieee80211_bss *bss)
 {
+       struct cfg80211_bss *cbss =
+               container_of((void *)bss, struct cfg80211_bss, priv);
        struct ieee80211_supported_band *sband;
        u32 basic_rates;
        int i, j;
-       u16 beacon_int = bss->cbss.beacon_interval;
+       u16 beacon_int = cbss->beacon_interval;
 
        if (beacon_int < 10)
                beacon_int = 10;
 
-       sband = sdata->local->hw.wiphy->bands[bss->cbss.channel->band];
+       sband = sdata->local->hw.wiphy->bands[cbss->channel->band];
 
        basic_rates = 0;
 
                }
        }
 
-       __ieee80211_sta_join_ibss(sdata, bss->cbss.bssid,
+       __ieee80211_sta_join_ibss(sdata, cbss->bssid,
                                  beacon_int,
-                                 bss->cbss.channel,
+                                 cbss->channel,
                                  basic_rates,
-                                 bss->cbss.capability,
-                                 bss->cbss.tsf);
+                                 cbss->capability,
+                                 cbss->tsf);
 }
 
 static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
 {
        struct ieee80211_local *local = sdata->local;
        int freq;
+       struct cfg80211_bss *cbss;
        struct ieee80211_bss *bss;
        struct sta_info *sta;
        struct ieee80211_channel *channel;
        if (!bss)
                return;
 
+       cbss = container_of((void *)bss, struct cfg80211_bss, priv);
+
        /* was just updated in ieee80211_bss_info_update */
-       beacon_timestamp = bss->cbss.tsf;
+       beacon_timestamp = cbss->tsf;
 
        /* check if we need to merge IBSS */
 
                goto put_bss;
 
        /* not an IBSS */
-       if (!(bss->cbss.capability & WLAN_CAPABILITY_IBSS))
+       if (!(cbss->capability & WLAN_CAPABILITY_IBSS))
                goto put_bss;
 
        /* different channel */
-       if (bss->cbss.channel != local->oper_channel)
+       if (cbss->channel != local->oper_channel)
                goto put_bss;
 
        /* different SSID */
                goto put_bss;
 
        /* same BSSID */
-       if (memcmp(bss->cbss.bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0)
+       if (memcmp(cbss->bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0)
                goto put_bss;
 
        if (rx_status->flag & RX_FLAG_TSFT) {
 {
        struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
        struct ieee80211_local *local = sdata->local;
-       struct ieee80211_bss *bss;
+       struct cfg80211_bss *cbss;
        struct ieee80211_channel *chan = NULL;
        const u8 *bssid = NULL;
        int active_ibss;
                chan = ifibss->channel;
        if (!is_zero_ether_addr(ifibss->bssid))
                bssid = ifibss->bssid;
-       bss = (void *)cfg80211_get_bss(local->hw.wiphy, chan, bssid,
-                                      ifibss->ssid, ifibss->ssid_len,
-                                      WLAN_CAPABILITY_IBSS |
-                                      WLAN_CAPABILITY_PRIVACY,
-                                      capability);
+       cbss = cfg80211_get_bss(local->hw.wiphy, chan, bssid,
+                               ifibss->ssid, ifibss->ssid_len,
+                               WLAN_CAPABILITY_IBSS | WLAN_CAPABILITY_PRIVACY,
+                               capability);
+
+       if (cbss) {
+               struct ieee80211_bss *bss;
 
-       if (bss) {
+               bss = (void *)cbss->priv;
 #ifdef CONFIG_MAC80211_IBSS_DEBUG
                printk(KERN_DEBUG "   sta_find_ibss: selected %pM current "
-                      "%pM\n", bss->cbss.bssid, ifibss->bssid);
+                      "%pM\n", cbss->bssid, ifibss->bssid);
 #endif /* CONFIG_MAC80211_IBSS_DEBUG */
 
                printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM"
                       " based on configured SSID\n",
-                      sdata->name, bss->cbss.bssid);
+                      sdata->name, cbss->bssid);
 
                ieee80211_sta_join_ibss(sdata, bss);
                ieee80211_rx_bss_put(local, bss);
 
        ieee80211_hw_config(sdata->local, IEEE80211_CONF_CHANGE_CHANNEL);
 
        /* XXX: shouldn't really modify cfg80211-owned data! */
-       ifmgd->associated->cbss.channel = sdata->local->oper_channel;
+       ifmgd->associated->channel = sdata->local->oper_channel;
 
        ieee80211_wake_queues_by_reason(&sdata->local->hw,
                                        IEEE80211_QUEUE_STOP_REASON_CSA);
                                      struct ieee80211_channel_sw_ie *sw_elem,
                                      struct ieee80211_bss *bss)
 {
+       struct cfg80211_bss *cbss =
+               container_of((void *)bss, struct cfg80211_bss, priv);
        struct ieee80211_channel *new_ch;
        struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
        int new_freq = ieee80211_channel_to_frequency(sw_elem->new_ch_num);
                mod_timer(&ifmgd->chswitch_timer,
                          jiffies +
                          msecs_to_jiffies(sw_elem->count *
-                                          bss->cbss.beacon_interval));
+                                          cbss->beacon_interval));
        }
 }
 
 }
 
 static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
-                                    struct ieee80211_bss *bss,
+                                    struct cfg80211_bss *cbss,
                                     u32 bss_info_changed)
 {
+       struct ieee80211_bss *bss = (void *)cbss->priv;
        struct ieee80211_local *local = sdata->local;
 
        bss_info_changed |= BSS_CHANGED_ASSOC;
        /* set timing information */
-       sdata->vif.bss_conf.beacon_int = bss->cbss.beacon_interval;
-       sdata->vif.bss_conf.timestamp = bss->cbss.tsf;
+       sdata->vif.bss_conf.beacon_int = cbss->beacon_interval;
+       sdata->vif.bss_conf.timestamp = cbss->tsf;
        sdata->vif.bss_conf.dtim_period = bss->dtim_period;
 
        bss_info_changed |= BSS_CHANGED_BEACON_INT;
        bss_info_changed |= ieee80211_handle_bss_capability(sdata,
-               bss->cbss.capability, bss->has_erp_value, bss->erp_value);
+               cbss->capability, bss->has_erp_value, bss->erp_value);
 
-       sdata->u.mgd.associated = bss;
-       memcpy(sdata->u.mgd.bssid, bss->cbss.bssid, ETH_ALEN);
+       sdata->u.mgd.associated = cbss;
+       memcpy(sdata->u.mgd.bssid, cbss->bssid, ETH_ALEN);
 
        /* just to be sure */
        sdata->u.mgd.flags &= ~(IEEE80211_STA_CONNECTION_POLL |
        if (WARN_ON(!ifmgd->associated))
                return;
 
-       memcpy(bssid, ifmgd->associated->cbss.bssid, ETH_ALEN);
+       memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
 
        ifmgd->associated = NULL;
        memset(ifmgd->bssid, 0, ETH_ALEN);
        struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
        const u8 *ssid;
 
-       ssid = ieee80211_bss_get_ie(&ifmgd->associated->cbss, WLAN_EID_SSID);
-       ieee80211_send_probe_req(sdata, ifmgd->associated->cbss.bssid,
+       ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID);
+       ieee80211_send_probe_req(sdata, ifmgd->associated->bssid,
                                 ssid + 2, ssid[1], NULL, 0);
 
        ifmgd->probe_send_count++;
 
        ASSERT_MGD_MTX(ifmgd);
 
-       bssid = ifmgd->associated->cbss.bssid;
+       bssid = ifmgd->associated->bssid;
 
        reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
 
        if (WARN_ON(!ifmgd->associated))
                return RX_MGMT_NONE;
 
-       if (WARN_ON(memcmp(ifmgd->associated->cbss.bssid, mgmt->sa, ETH_ALEN)))
+       if (WARN_ON(memcmp(ifmgd->associated->bssid, mgmt->sa, ETH_ALEN)))
                return RX_MGMT_NONE;
 
        reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_supported_band *sband;
        struct sta_info *sta;
-       struct ieee80211_bss *bss = wk->assoc.bss;
+       struct cfg80211_bss *cbss = wk->assoc.bss;
        u8 *pos;
        u32 rates, basic_rates;
        u16 capab_info, aid;
 
        ifmgd->aid = aid;
 
-       sta = sta_info_alloc(sdata, bss->cbss.bssid, GFP_KERNEL);
+       sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL);
        if (!sta) {
                printk(KERN_DEBUG "%s: failed to alloc STA entry for"
                       " the AP\n", sdata->name);
            (sdata->local->hw.queues >= 4) &&
            !(ifmgd->flags & IEEE80211_STA_DISABLE_11N))
                changed |= ieee80211_enable_ht(sdata, elems.ht_info_elem,
-                                              bss->cbss.bssid,
-                                              ap_ht_cap_flags);
+                                              cbss->bssid, ap_ht_cap_flags);
 
        /* set AID and assoc capability,
         * ieee80211_set_associated() will tell the driver */
        bss_conf->aid = aid;
        bss_conf->assoc_capability = capab_info;
-       ieee80211_set_associated(sdata, bss, changed);
+       ieee80211_set_associated(sdata, cbss, changed);
 
        /*
         * Start timer to probe the connection to the AP now.
                return;
 
        if (elems->ch_switch_elem && (elems->ch_switch_elem_len == 3) &&
-           (memcmp(mgmt->bssid, sdata->u.mgd.associated->cbss.bssid,
+           (memcmp(mgmt->bssid, sdata->u.mgd.associated->bssid,
                                                        ETH_ALEN) == 0)) {
                struct ieee80211_channel_sw_ie *sw_elem =
                        (struct ieee80211_channel_sw_ie *)elems->ch_switch_elem;
        ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false);
 
        if (ifmgd->associated &&
-           memcmp(mgmt->bssid, ifmgd->associated->cbss.bssid, ETH_ALEN) == 0 &&
+           memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN) == 0 &&
            ifmgd->flags & (IEEE80211_STA_BEACON_POLL |
                            IEEE80211_STA_CONNECTION_POLL)) {
                ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL |
        if (!ifmgd->associated)
                return;
 
-       bssid = ifmgd->associated->cbss.bssid;
+       bssid = ifmgd->associated->bssid;
 
        /*
         * And in theory even frames from a different AP we were just
        mutex_lock(&ifmgd->mtx);
 
        if (ifmgd->associated &&
-           memcmp(ifmgd->associated->cbss.bssid, mgmt->bssid,
-                                                       ETH_ALEN) == 0) {
+           memcmp(ifmgd->associated->bssid, mgmt->bssid, ETH_ALEN) == 0) {
                switch (fc & IEEE80211_FCTL_STYPE) {
                case IEEE80211_STYPE_BEACON:
                        ieee80211_rx_mgmt_beacon(sdata, mgmt, skb->len,
                        /* XXX: differentiate, can only happen for CSA now! */
                        ieee80211_sta_process_chanswitch(sdata,
                                        &mgmt->u.action.u.chan_switch.sw_elem,
-                                       ifmgd->associated);
+                                       (void *)ifmgd->associated->priv);
                        break;
                }
                mutex_unlock(&ifmgd->mtx);
            ifmgd->associated) {
                u8 bssid[ETH_ALEN];
 
-               memcpy(bssid, ifmgd->associated->cbss.bssid, ETH_ALEN);
+               memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
                if (time_is_after_jiffies(ifmgd->probe_timeout))
                        run_again(ifmgd, ifmgd->probe_timeout);
 
                        struct cfg80211_assoc_request *req)
 {
        struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
+       struct ieee80211_bss *bss = (void *)req->bss->priv;
        struct ieee80211_work *wk;
        const u8 *ssid;
        int i;
        } else
                wk->ie_len = 0;
 
-       wk->assoc.bss = (void *)req->bss;
+       wk->assoc.bss = req->bss;
 
        memcpy(wk->filter_ta, req->bss->bssid, ETH_ALEN);
 
         */
        wk->assoc.use_11n = !(ifmgd->flags & IEEE80211_STA_DISABLE_11N);
        wk->assoc.capability = req->bss->capability;
-       wk->assoc.wmm_used = wk->assoc.bss->wmm_used;
-       wk->assoc.supp_rates = wk->assoc.bss->supp_rates;
-       wk->assoc.supp_rates_len = wk->assoc.bss->supp_rates_len;
+       wk->assoc.wmm_used = bss->wmm_used;
+       wk->assoc.supp_rates = bss->supp_rates;
+       wk->assoc.supp_rates_len = bss->supp_rates_len;
        wk->assoc.ht_information_ie =
                ieee80211_bss_get_ie(req->bss, WLAN_EID_HT_INFORMATION);
 
 
        mutex_lock(&ifmgd->mtx);
 
-       if (ifmgd->associated && &ifmgd->associated->cbss == req->bss) {
+       if (ifmgd->associated == req->bss) {
                bssid = req->bss->bssid;
                ieee80211_set_disassoc(sdata);
                mutex_unlock(&ifmgd->mtx);
         * to cfg80211 while that's in a locked section already
         * trying to tell us that the user wants to disconnect.
         */
-       if (&ifmgd->associated->cbss != req->bss) {
+       if (ifmgd->associated != req->bss) {
                mutex_unlock(&ifmgd->mtx);
                return -ENOLINK;
        }
 
 ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
                     u8 *ssid, u8 ssid_len)
 {
-       return (void *)cfg80211_get_bss(local->hw.wiphy,
-                                       ieee80211_get_channel(local->hw.wiphy,
-                                                             freq),
-                                       bssid, ssid, ssid_len,
-                                       0, 0);
+       struct cfg80211_bss *cbss;
+
+       cbss = cfg80211_get_bss(local->hw.wiphy,
+                               ieee80211_get_channel(local->hw.wiphy, freq),
+                               bssid, ssid, ssid_len, 0, 0);
+       if (!cbss)
+               return NULL;
+       return (void *)cbss->priv;
 }
 
 static void ieee80211_rx_bss_free(struct cfg80211_bss *cbss)
 {
-       struct ieee80211_bss *bss = (void *)cbss;
+       struct ieee80211_bss *bss = (void *)cbss->priv;
 
        kfree(bss_mesh_id(bss));
        kfree(bss_mesh_cfg(bss));
 void ieee80211_rx_bss_put(struct ieee80211_local *local,
                          struct ieee80211_bss *bss)
 {
-       cfg80211_put_bss((struct cfg80211_bss *)bss);
+       if (!bss)
+               return;
+       cfg80211_put_bss(container_of((void *)bss, struct cfg80211_bss, priv));
 }
 
 struct ieee80211_bss *
                          struct ieee80211_channel *channel,
                          bool beacon)
 {
+       struct cfg80211_bss *cbss;
        struct ieee80211_bss *bss;
        int clen;
        s32 signal = 0;
        else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)
                signal = (rx_status->signal * 100) / local->hw.max_signal;
 
-       bss = (void *)cfg80211_inform_bss_frame(local->hw.wiphy, channel,
-                                               mgmt, len, signal, GFP_ATOMIC);
+       cbss = cfg80211_inform_bss_frame(local->hw.wiphy, channel,
+                                        mgmt, len, signal, GFP_ATOMIC);
 
-       if (!bss)
+       if (!cbss)
                return NULL;
 
-       bss->cbss.free_priv = ieee80211_rx_bss_free;
+       cbss->free_priv = ieee80211_rx_bss_free;
+       bss = (void *)cbss->priv;
 
        /* save the ERP value so that it is available at association time */
        if (elems->erp_info && elems->erp_info_len >= 1) {