From nobody Mon May 11 02:56:30 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83260C433EF for ; Mon, 18 Apr 2022 03:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236097AbiDRDx4 (ORCPT ); Sun, 17 Apr 2022 23:53:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbiDRDxy (ORCPT ); Sun, 17 Apr 2022 23:53:54 -0400 Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A866E17068; Sun, 17 Apr 2022 20:51:15 -0700 (PDT) Received: by mail-qk1-x734.google.com with SMTP id j9so3007430qkg.1; Sun, 17 Apr 2022 20:51:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:subject:message-id:mime-version:content-disposition :content-transfer-encoding; bh=lHG528Ot+Gm26ZY4TwxH4i2UrD///fw3uZsOgGhEAOs=; b=LGaWlbNKFzBlO40ytEdhydgtIQQKWymV/UEpIgaDmEkVHs6Cj6al1bdZaE0QUZBJTA s3yiFS1qAEZZUGf9zwDX8VGgDUKwkaJ0HqGofs8sfY2XTvNoAQh082bbKN8SOJAZlZky KFK/Cn8sCXqxCfaEUkQMza+bggazrW1VX9GTBU0GM5L/j/RZ+D4I/W+ofUpj5NGxAZDB mKqguWIJW88GfmgCKKviFkVRxj36yKBioETr89xRm/oGG1RWzXhD3hkWwaz5iL/rnVVv nhGkMhKexN2KlGCG6CviTIMec4QTZpgJUdxUfIWLTPZn2+pk3V41pf13X2grMp0rc6da COhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:content-transfer-encoding; bh=lHG528Ot+Gm26ZY4TwxH4i2UrD///fw3uZsOgGhEAOs=; b=whk1UePaKRXqfWuVVgd1T1ks/gCaQTabuNaAprittOOA7iujG/9xXXkk1tIGhB+C5O +7z1EombA6FqI8S2LS737EbXOLftBWsPk79sZCdIeoPNXcszGmA7Ux9OydPp0f0m3vjC 3/01pN+NByf6Tr6oCjZlg9vEc4hbpny7z4qjgi+lzxbC639y70FoQPm56JjcbhOTJ3ru 1C8TSChSTJmMY4mRDf/2C5fZnhovpu3MyC0y00hwF4KpOZF1QFhf3EEN5lbHErnHazz+ uFOxINJnhFkMEGwGnXpegBsXFHaNi6tqAXyNj8ltdO/JlXobyalCLJSB1aOb4AUNFQ6H kt/Q== X-Gm-Message-State: AOAM531n4JQ1D4KP93ZM/rTFpnRYlV6KEjphtbJDOmQ7jWt9qGpNY6DU lRPupx+IUeIs0tgKbWAOwgg= X-Google-Smtp-Source: ABdhPJzRbDfTA9SZs+va4+Mi2ML4pGbRhQf9JRMhf3lsT2/vFqQQmp/kjrSirwGXo+qoX7NM3hx8Ag== X-Received: by 2002:a05:620a:4487:b0:69c:160c:48ae with SMTP id x7-20020a05620a448700b0069c160c48aemr5571726qkp.430.1650253874685; Sun, 17 Apr 2022 20:51:14 -0700 (PDT) Received: from jaehee-ThinkPad-X1-Extreme ([2607:fb90:50e6:61ed:4df2:ed9f:52ea:476e]) by smtp.gmail.com with ESMTPSA id v65-20020a376144000000b0069e7842f2f5sm2804375qkb.52.2022.04.17.20.51.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 20:51:14 -0700 (PDT) Date: Sun, 17 Apr 2022 23:51:10 -0400 From: Jaehee Park To: =?iso-8859-1?B?Suly9G1l?= Pouiller , Kalle Valo , "David S. Miller" , Jakub Kicinski , Paolo Abeni , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, outreachy@lists.linux.dev, Jaehee Park , Stefano Brivio Subject: [PATCH] wfx: use container_of() to get vif Message-ID: <20220418035110.GA937332@jaehee-ThinkPad-X1-Extreme> MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Currently, upon virtual interface creation, wfx_add_interface() stores a reference to the corresponding struct ieee80211_vif in private data, for later usage. This is not needed when using the container_of construct. This construct already has all the info it needs to retrieve the reference to the corresponding struct from the offset that is already available, inherent in container_of(), between its type and member inputs (struct ieee80211_vif and drv_priv, respectively). Remove vif (which was previously storing the reference to the struct ieee80211_vif) from the struct wfx_vif, define a function wvif_to_vif(wvif) for container_of(), and replace all wvif->vif with the newly defined container_of construct. Signed-off-by: Jaehee Park --- Changes from staging to wireless-next tree - changed macro into function and named it back to wvif_to_vif - fit all lines in patch to 80 columns - decared a reference to vif at the beginning of the functions NOTE: J=C3=A9r=C3=B4me is going to be testing this patch on his hardware drivers/net/wireless/silabs/wfx/wfx.h | 6 +- drivers/net/wireless/silabs/wfx/data_rx.c | 5 +- drivers/net/wireless/silabs/wfx/data_tx.c | 3 +- drivers/net/wireless/silabs/wfx/key.c | 4 +- drivers/net/wireless/silabs/wfx/queue.c | 3 +- drivers/net/wireless/silabs/wfx/scan.c | 9 ++- drivers/net/wireless/silabs/wfx/sta.c | 69 ++++++++++++++--------- 7 files changed, 63 insertions(+), 36 deletions(-) diff --git a/drivers/net/wireless/silabs/wfx/wfx.h b/drivers/net/wireless/s= ilabs/wfx/wfx.h index 6594cc647c2f..718693a4273d 100644 --- a/drivers/net/wireless/silabs/wfx/wfx.h +++ b/drivers/net/wireless/silabs/wfx/wfx.h @@ -61,7 +61,6 @@ struct wfx_dev { =20 struct wfx_vif { struct wfx_dev *wdev; - struct ieee80211_vif *vif; struct ieee80211_channel *channel; int id; =20 @@ -91,6 +90,11 @@ struct wfx_vif { struct completion set_pm_mode_complete; }; =20 +static inline struct ieee80211_vif *wvif_to_vif(struct wfx_vif *wvif) +{ + return container_of((void *)wvif, struct ieee80211_vif, drv_priv); +} + static inline struct wfx_vif *wdev_to_wvif(struct wfx_dev *wdev, int vif_i= d) { if (vif_id >=3D ARRAY_SIZE(wdev->vif)) { diff --git a/drivers/net/wireless/silabs/wfx/data_rx.c b/drivers/net/wirele= ss/silabs/wfx/data_rx.c index a4b5ffe158e4..342b9cd0e74c 100644 --- a/drivers/net/wireless/silabs/wfx/data_rx.c +++ b/drivers/net/wireless/silabs/wfx/data_rx.c @@ -16,6 +16,7 @@ static void wfx_rx_handle_ba(struct wfx_vif *wvif, struct ieee80211_mgmt *= mgmt) { int params, tid; + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); =20 if (wfx_api_older_than(wvif->wdev, 3, 6)) return; @@ -24,12 +25,12 @@ static void wfx_rx_handle_ba(struct wfx_vif *wvif, stru= ct ieee80211_mgmt *mgmt) case WLAN_ACTION_ADDBA_REQ: params =3D le16_to_cpu(mgmt->u.action.u.addba_req.capab); tid =3D (params & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2; - ieee80211_start_rx_ba_session_offl(wvif->vif, mgmt->sa, tid); + ieee80211_start_rx_ba_session_offl(vif, mgmt->sa, tid); break; case WLAN_ACTION_DELBA: params =3D le16_to_cpu(mgmt->u.action.u.delba.params); tid =3D (params & IEEE80211_DELBA_PARAM_TID_MASK) >> 12; - ieee80211_stop_rx_ba_session_offl(wvif->vif, mgmt->sa, tid); + ieee80211_stop_rx_ba_session_offl(vif, mgmt->sa, tid); break; } } diff --git a/drivers/net/wireless/silabs/wfx/data_tx.c b/drivers/net/wirele= ss/silabs/wfx/data_tx.c index e07381b2ff4d..db99142e8e8f 100644 --- a/drivers/net/wireless/silabs/wfx/data_tx.c +++ b/drivers/net/wireless/silabs/wfx/data_tx.c @@ -213,10 +213,11 @@ static u8 wfx_tx_get_link_id(struct wfx_vif *wvif, st= ruct ieee80211_sta *sta, { struct wfx_sta_priv *sta_priv =3D sta ? (struct wfx_sta_priv *)&sta->drv_= priv : NULL; const u8 *da =3D ieee80211_get_DA(hdr); + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); =20 if (sta_priv && sta_priv->link_id) return sta_priv->link_id; - if (wvif->vif->type !=3D NL80211_IFTYPE_AP) + if (vif->type !=3D NL80211_IFTYPE_AP) return 0; if (is_multicast_ether_addr(da)) return 0; diff --git a/drivers/net/wireless/silabs/wfx/key.c b/drivers/net/wireless/s= ilabs/wfx/key.c index 8f23e8d42bd4..196d64ef68f3 100644 --- a/drivers/net/wireless/silabs/wfx/key.c +++ b/drivers/net/wireless/silabs/wfx/key.c @@ -156,6 +156,7 @@ static int wfx_add_key(struct wfx_vif *wvif, struct iee= e80211_sta *sta, struct wfx_dev *wdev =3D wvif->wdev; int idx =3D wfx_alloc_key(wvif->wdev); bool pairwise =3D key->flags & IEEE80211_KEY_FLAG_PAIRWISE; + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); =20 WARN(key->flags & IEEE80211_KEY_FLAG_PAIRWISE && !sta, "inconsistent data= "); ieee80211_get_key_rx_seq(key, 0, &seq); @@ -174,7 +175,7 @@ static int wfx_add_key(struct wfx_vif *wvif, struct iee= e80211_sta *sta, k.type =3D fill_tkip_pair(&k.key.tkip_pairwise_key, key, sta->addr); else k.type =3D fill_tkip_group(&k.key.tkip_group_key, key, &seq, - wvif->vif->type); + vif->type); } else if (key->cipher =3D=3D WLAN_CIPHER_SUITE_CCMP) { if (pairwise) k.type =3D fill_ccmp_pair(&k.key.aes_pairwise_key, key, sta->addr); @@ -224,4 +225,3 @@ int wfx_set_key(struct ieee80211_hw *hw, enum set_key_c= md cmd, struct ieee80211_ mutex_unlock(&wvif->wdev->conf_mutex); return ret; } - diff --git a/drivers/net/wireless/silabs/wfx/queue.c b/drivers/net/wireless= /silabs/wfx/queue.c index 729825230db2..fa1837a00a74 100644 --- a/drivers/net/wireless/silabs/wfx/queue.c +++ b/drivers/net/wireless/silabs/wfx/queue.c @@ -206,8 +206,9 @@ unsigned int wfx_pending_get_pkt_us_delay(struct wfx_de= v *wdev, struct sk_buff * bool wfx_tx_queues_has_cab(struct wfx_vif *wvif) { int i; + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); =20 - if (wvif->vif->type !=3D NL80211_IFTYPE_AP) + if (vif->type !=3D NL80211_IFTYPE_AP) return false; for (i =3D 0; i < IEEE80211_NUM_ACS; ++i) /* Note: since only AP can have mcast frames in queue and only one vif c= an be AP, diff --git a/drivers/net/wireless/silabs/wfx/scan.c b/drivers/net/wireless/= silabs/wfx/scan.c index 7f34f0d322f9..d2dd9829351a 100644 --- a/drivers/net/wireless/silabs/wfx/scan.c +++ b/drivers/net/wireless/silabs/wfx/scan.c @@ -24,8 +24,10 @@ static void wfx_ieee80211_scan_completed_compat(struct i= eee80211_hw *hw, bool ab static int update_probe_tmpl(struct wfx_vif *wvif, struct cfg80211_scan_re= quest *req) { struct sk_buff *skb; + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); =20 - skb =3D ieee80211_probereq_get(wvif->wdev->hw, wvif->vif->addr, NULL, 0, = req->ie_len); + skb =3D ieee80211_probereq_get(wvif->wdev->hw, vif->addr, NULL, 0, + req->ie_len); if (!skb) return -ENOMEM; =20 @@ -39,6 +41,7 @@ static int send_scan_req(struct wfx_vif *wvif, struct cfg= 80211_scan_request *req { int i, ret; struct ieee80211_channel *ch_start, *ch_cur; + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); =20 for (i =3D start_idx; i < req->n_channels; i++) { ch_start =3D req->channels[start_idx]; @@ -75,8 +78,8 @@ static int send_scan_req(struct wfx_vif *wvif, struct cfg= 80211_scan_request *req } else { ret =3D wvif->scan_nb_chan_done; } - if (req->channels[start_idx]->max_power !=3D wvif->vif->bss_conf.txpower) - wfx_hif_set_output_power(wvif, wvif->vif->bss_conf.txpower); + if (req->channels[start_idx]->max_power !=3D vif->bss_conf.txpower) + wfx_hif_set_output_power(wvif, vif->bss_conf.txpower); wfx_tx_unlock(wvif->wdev); return ret; } diff --git a/drivers/net/wireless/silabs/wfx/sta.c b/drivers/net/wireless/s= ilabs/wfx/sta.c index 3297d73c327a..97fcbad23c94 100644 --- a/drivers/net/wireless/silabs/wfx/sta.c +++ b/drivers/net/wireless/silabs/wfx/sta.c @@ -101,6 +101,7 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsi= gned int changed_flags, struct wfx_vif *wvif =3D NULL; struct wfx_dev *wdev =3D hw->priv; bool filter_bssid, filter_prbreq, filter_beacon; + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); =20 /* Notes: * - Probe responses (FIF_BCN_PRBRESP_PROMISC) are never filtered @@ -132,7 +133,7 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsi= gned int changed_flags, filter_bssid =3D true; =20 /* In AP mode, chip can reply to probe request itself */ - if (*total_flags & FIF_PROBE_REQ && wvif->vif->type =3D=3D NL80211_IFTYP= E_AP) { + if (*total_flags & FIF_PROBE_REQ && vif->type =3D=3D NL80211_IFTYPE_AP) { dev_dbg(wdev->dev, "do not forward probe request in AP mode\n"); *total_flags &=3D ~FIF_PROBE_REQ; } @@ -152,19 +153,28 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, b= ool *enable_ps) { struct ieee80211_channel *chan0 =3D NULL, *chan1 =3D NULL; struct ieee80211_conf *conf =3D &wvif->wdev->hw->conf; + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); =20 - WARN(!wvif->vif->bss_conf.assoc && enable_ps, + WARN(!vif->bss_conf.assoc && enable_ps, "enable_ps is reliable only if associated"); - if (wdev_to_wvif(wvif->wdev, 0)) - chan0 =3D wdev_to_wvif(wvif->wdev, 0)->vif->bss_conf.chandef.chan; - if (wdev_to_wvif(wvif->wdev, 1)) - chan1 =3D wdev_to_wvif(wvif->wdev, 1)->vif->bss_conf.chandef.chan; - if (chan0 && chan1 && wvif->vif->type !=3D NL80211_IFTYPE_AP) { + if (wdev_to_wvif(wvif->wdev, 0)) { + struct wfx_vif *wvif_ch0 =3D wdev_to_wvif(wvif->wdev, 0); + struct ieee80211_vif *vif_ch0 =3D wvif_to_vif(wvif_ch0); + + chan0 =3D vif_ch0->bss_conf.chandef.chan; + } + if (wdev_to_wvif(wvif->wdev, 1)) { + struct wfx_vif *wvif_ch1 =3D wdev_to_wvif(wvif->wdev, 1); + struct ieee80211_vif *vif_ch1 =3D wvif_to_vif(wvif_ch1); + + chan1 =3D vif_ch1->bss_conf.chandef.chan; + } + if (chan0 && chan1 && vif->type !=3D NL80211_IFTYPE_AP) { if (chan0->hw_value =3D=3D chan1->hw_value) { /* It is useless to enable PS if channels are the same. */ if (enable_ps) *enable_ps =3D false; - if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps) + if (vif->bss_conf.assoc && vif->bss_conf.ps) dev_info(wvif->wdev->dev, "ignoring requested PS mode"); return -1; } @@ -177,8 +187,8 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, boo= l *enable_ps) return 30; } if (enable_ps) - *enable_ps =3D wvif->vif->bss_conf.ps; - if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps) + *enable_ps =3D vif->bss_conf.ps; + if (vif->bss_conf.assoc && vif->bss_conf.ps) return conf->dynamic_ps_timeout; else return -1; @@ -188,8 +198,9 @@ int wfx_update_pm(struct wfx_vif *wvif) { int ps_timeout; bool ps; + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); =20 - if (!wvif->vif->bss_conf.assoc) + if (!vif->bss_conf.assoc) return 0; ps_timeout =3D wfx_get_ps_timeout(wvif, &ps); if (!ps) @@ -215,7 +226,8 @@ int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee802= 11_vif *vif, mutex_lock(&wdev->conf_mutex); assign_bit(queue, &wvif->uapsd_mask, params->uapsd); wfx_hif_set_edca_queue_params(wvif, queue, params); - if (wvif->vif->type =3D=3D NL80211_IFTYPE_STATION && old_uapsd !=3D wvif-= >uapsd_mask) { + if (vif->type =3D=3D NL80211_IFTYPE_STATION && + old_uapsd !=3D wvif->uapsd_mask) { wfx_hif_set_uapsd_info(wvif, wvif->uapsd_mask); wfx_update_pm(wvif); } @@ -240,22 +252,24 @@ void wfx_event_report_rssi(struct wfx_vif *wvif, u8 r= aw_rcpi_rssi) */ int rcpi_rssi; int cqm_evt; + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); =20 rcpi_rssi =3D raw_rcpi_rssi / 2 - 110; - if (rcpi_rssi <=3D wvif->vif->bss_conf.cqm_rssi_thold) + if (rcpi_rssi <=3D vif->bss_conf.cqm_rssi_thold) cqm_evt =3D NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW; else cqm_evt =3D NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH; - ieee80211_cqm_rssi_notify(wvif->vif, cqm_evt, rcpi_rssi, GFP_KERNEL); + ieee80211_cqm_rssi_notify(vif, cqm_evt, rcpi_rssi, GFP_KERNEL); } =20 static void wfx_beacon_loss_work(struct work_struct *work) { struct wfx_vif *wvif =3D container_of(to_delayed_work(work), struct wfx_v= if, beacon_loss_work); - struct ieee80211_bss_conf *bss_conf =3D &wvif->vif->bss_conf; + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); + struct ieee80211_bss_conf *bss_conf =3D &vif->bss_conf; =20 - ieee80211_beacon_loss(wvif->vif); + ieee80211_beacon_loss(vif); schedule_delayed_work(to_delayed_work(work), msecs_to_jiffies(bss_conf->b= eacon_int)); } =20 @@ -322,14 +336,15 @@ int wfx_sta_remove(struct ieee80211_hw *hw, struct ie= ee80211_vif *vif, struct ie static int wfx_upload_ap_templates(struct wfx_vif *wvif) { struct sk_buff *skb; + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); =20 - skb =3D ieee80211_beacon_get(wvif->wdev->hw, wvif->vif); + skb =3D ieee80211_beacon_get(wvif->wdev->hw, vif); if (!skb) return -ENOMEM; wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_BCN, API_RATE_INDEX_B_1MB= PS); dev_kfree_skb(skb); =20 - skb =3D ieee80211_proberesp_get(wvif->wdev->hw, wvif->vif); + skb =3D ieee80211_proberesp_get(wvif->wdev->hw, vif); if (!skb) return -ENOMEM; wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_PRBRES, API_RATE_INDEX_B_= 1MBPS); @@ -339,7 +354,8 @@ static int wfx_upload_ap_templates(struct wfx_vif *wvif) =20 static void wfx_set_mfp_ap(struct wfx_vif *wvif) { - struct sk_buff *skb =3D ieee80211_beacon_get(wvif->wdev->hw, wvif->vif); + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); + struct sk_buff *skb =3D ieee80211_beacon_get(wvif->wdev->hw, vif); const int ieoffset =3D offsetof(struct ieee80211_mgmt, u.beacon.variable); const u16 *ptr =3D (u16 *)cfg80211_find_ie(WLAN_EID_RSN, skb->data + ieof= fset, skb->len - ieoffset); @@ -389,7 +405,8 @@ void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80= 211_vif *vif) static void wfx_join(struct wfx_vif *wvif) { int ret; - struct ieee80211_bss_conf *conf =3D &wvif->vif->bss_conf; + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); + struct ieee80211_bss_conf *conf =3D &vif->bss_conf; struct cfg80211_bss *bss =3D NULL; u8 ssid[IEEE80211_MAX_SSID_LEN]; const u8 *ssidie =3D NULL; @@ -420,7 +437,7 @@ static void wfx_join(struct wfx_vif *wvif) wvif->join_in_progress =3D true; ret =3D wfx_hif_join(wvif, conf, wvif->channel, ssid, ssidlen); if (ret) { - ieee80211_connection_loss(wvif->vif); + ieee80211_connection_loss(vif); wfx_reset(wvif); } else { /* Due to beacon filtering it is possible that the AP's beacon is not kn= own for the @@ -437,10 +454,11 @@ static void wfx_join_finalize(struct wfx_vif *wvif, s= truct ieee80211_bss_conf *i struct ieee80211_sta *sta =3D NULL; int ampdu_density =3D 0; bool greenfield =3D false; + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); =20 rcu_read_lock(); /* protect sta */ if (info->bssid && !info->ibss_joined) - sta =3D ieee80211_find_sta(wvif->vif, info->bssid); + sta =3D ieee80211_find_sta(vif, info->bssid); if (sta && sta->deflink.ht_cap.ht_supported) ampdu_density =3D sta->deflink.ht_cap.ampdu_density; if (sta && sta->deflink.ht_cap.ht_supported && @@ -564,8 +582,10 @@ static int wfx_update_tim(struct wfx_vif *wvif) struct sk_buff *skb; u16 tim_offset, tim_length; u8 *tim_ptr; + struct ieee80211_vif *vif =3D wvif_to_vif(wvif); =20 - skb =3D ieee80211_beacon_get_tim(wvif->wdev->hw, wvif->vif, &tim_offset, = &tim_length); + skb =3D ieee80211_beacon_get_tim(wvif->wdev->hw, vif, &tim_offset, + &tim_length); if (!skb) return -ENOENT; tim_ptr =3D skb->data + tim_offset; @@ -707,8 +727,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct i= eee80211_vif *vif) return -EOPNOTSUPP; } =20 - /* FIXME: prefer use of container_of() to get vif */ - wvif->vif =3D vif; wvif->wdev =3D wdev; =20 wvif->link_id_map =3D 1; /* link-id 0 is reserved for multicast */ @@ -767,7 +785,6 @@ void wfx_remove_interface(struct ieee80211_hw *hw, stru= ct ieee80211_vif *vif) =20 cancel_delayed_work_sync(&wvif->beacon_loss_work); wdev->vif[wvif->id] =3D NULL; - wvif->vif =3D NULL; =20 mutex_unlock(&wdev->conf_mutex); =20 --=20 2.25.1