struct ieee80211_vif *vif)
 {
        struct ath12k_vif_iter *arvif_iter = data;
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
 
        if (arvif->vdev_id == arvif_iter->vdev_id)
                arvif_iter->arvif = arvif;
                                      struct ieee80211_sta *sta,
                                      struct ath12k_wmi_peer_assoc_arg *arg)
 {
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        u32 aid;
 
        lockdep_assert_held(&ar->conf_mutex);
        struct ieee80211_bss_conf *info = &vif->bss_conf;
        struct cfg80211_chan_def def;
        struct cfg80211_bss *bss;
-       struct ath12k_vif *arvif = (struct ath12k_vif *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        const u8 *rsnie = NULL;
        const u8 *wpaie = NULL;
 
                                      struct ieee80211_sta *sta,
                                      struct ath12k_wmi_peer_assoc_arg *arg)
 {
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        struct wmi_rate_set_arg *rateset = &arg->peer_legacy_rates;
        struct cfg80211_chan_def def;
        const struct ieee80211_supported_band *sband;
                                   struct ath12k_wmi_peer_assoc_arg *arg)
 {
        const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap;
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        struct cfg80211_chan_def def;
        enum nl80211_band band;
        const u8 *ht_mcs_mask;
                                    struct ath12k_wmi_peer_assoc_arg *arg)
 {
        const struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap;
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        struct cfg80211_chan_def def;
        enum nl80211_band band;
        const u16 *vht_mcs_mask;
                                    struct ieee80211_sta *sta,
                                    struct ath12k_wmi_peer_assoc_arg *arg)
 {
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
 
        switch (arvif->vdev_type) {
        case WMI_VDEV_TYPE_AP:
                                        struct ieee80211_sta *sta,
                                        struct ath12k_wmi_peer_assoc_arg *arg)
 {
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        struct cfg80211_chan_def def;
        enum nl80211_band band;
        const u8 *ht_mcs_mask;
        const struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap;
        const struct ieee80211_eht_mcs_nss_supp_20mhz_only *bw_20;
        const struct ieee80211_eht_mcs_nss_supp_bw *bw;
-       struct ath12k_vif *arvif = (struct ath12k_vif *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        u32 *rx_mcs, *tx_mcs;
 
        if (!sta->deflink.he_cap.has_he || !eht_cap->has_eht)
                             struct ieee80211_bss_conf *bss_conf)
 {
        struct ath12k *ar = hw->priv;
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        struct ath12k_wmi_peer_assoc_arg peer_arg;
        struct ieee80211_sta *ap_sta;
        struct ath12k_peer *peer;
                                struct ieee80211_vif *vif)
 {
        struct ath12k *ar = hw->priv;
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        int ret;
 
        lockdep_assert_held(&ar->conf_mutex);
                                         struct ieee80211_vif *vif,
                                         struct cfg80211_chan_def *def)
 {
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        const struct ieee80211_supported_band *sband;
        u8 basic_rate_idx;
        int hw_rate_code;
                                   struct ieee80211_vif *vif,
                                   struct ieee80211_sta *sta)
 {
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        int ret;
 
        lockdep_assert_held(&ar->conf_mutex);
                                       struct ieee80211_sta *sta)
 {
        struct ath12k *ar = hw->priv;
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        int ret;
        s16 txpwr;
 
 {
        struct ath12k *ar = hw->priv;
        struct ath12k_sta *arsta = (struct ath12k_sta *)sta->drv_priv;
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        struct ath12k_peer *peer;
        u32 bw, smps;
 
                                 const struct ieee80211_tx_queue_params *params)
 {
        struct ath12k *ar = hw->priv;
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        struct wmi_wmm_params_arg *p = NULL;
        int ret;
 
        lockdep_assert_held(&ar->conf_mutex);
 
        for (i = 0; i < n_vifs; i++) {
-               arvif = (void *)vifs[i].vif->drv_priv;
+               arvif = ath12k_vif_to_arvif(vifs[i].vif);
 
                if (vifs[i].vif->type == NL80211_IFTYPE_MONITOR)
                        monitor_vif = true;
        /* TODO: Update ar->rx_channel */
 
        for (i = 0; i < n_vifs; i++) {
-               arvif = (void *)vifs[i].vif->drv_priv;
+               arvif = ath12k_vif_to_arvif(vifs[i].vif);
 
                if (WARN_ON(!arvif->is_started))
                        continue;
 {
        struct ath12k *ar = hw->priv;
        struct ath12k_base *ab = ar->ab;
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        int ret;
 
        if (WARN_ON(arvif->is_started))
 {
        struct ath12k *ar = hw->priv;
        struct ath12k_base *ab = ar->ab;
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        int ret;
        struct ath12k_wmi_peer_create_arg param;
 
 {
        struct ath12k *ar = hw->priv;
        struct ath12k_base *ab = ar->ab;
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        int ret;
 
        mutex_lock(&ar->conf_mutex);
                               struct ieee80211_vif *vif,
                               const struct cfg80211_bitrate_mask *mask)
 {
-       struct ath12k_vif *arvif = (void *)vif->drv_priv;
+       struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
        struct cfg80211_chan_def def;
        struct ath12k *ar = arvif->ar;
        enum nl80211_band band;