Commit 13556aef authored by Jeff Johnson's avatar Jeff Johnson Committed by Kalle Valo

wifi: ath12k: Consistently use ath12k_vif_to_arvif()

Helper function ath12k_vif_to_arvif() exists to retrieve a struct
ath12k_vif from a struct ieee80211_vif. However, in multiple places
this logic is open-coded with inline typecasting. Since the
typecasting prevents the compiler from type-checking the source and
destination, update the driver to consistently use the helper
function.

No functional changes, compile tested only.
Signed-off-by: default avatarJeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20231004-ath12k_vif_to_arvif-v1-1-3f38f6882d33@quicinc.com
parent e149353e
...@@ -523,7 +523,7 @@ static void ath12k_get_arvif_iter(void *data, u8 *mac, ...@@ -523,7 +523,7 @@ static void ath12k_get_arvif_iter(void *data, u8 *mac,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
struct ath12k_vif_iter *arvif_iter = data; 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) if (arvif->vdev_id == arvif_iter->vdev_id)
arvif_iter->arvif = arvif; arvif_iter->arvif = arvif;
...@@ -1208,7 +1208,7 @@ static void ath12k_peer_assoc_h_basic(struct ath12k *ar, ...@@ -1208,7 +1208,7 @@ static void ath12k_peer_assoc_h_basic(struct ath12k *ar,
struct ieee80211_sta *sta, struct ieee80211_sta *sta,
struct ath12k_wmi_peer_assoc_arg *arg) 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; u32 aid;
lockdep_assert_held(&ar->conf_mutex); lockdep_assert_held(&ar->conf_mutex);
...@@ -1236,7 +1236,7 @@ static void ath12k_peer_assoc_h_crypto(struct ath12k *ar, ...@@ -1236,7 +1236,7 @@ static void ath12k_peer_assoc_h_crypto(struct ath12k *ar,
struct ieee80211_bss_conf *info = &vif->bss_conf; struct ieee80211_bss_conf *info = &vif->bss_conf;
struct cfg80211_chan_def def; struct cfg80211_chan_def def;
struct cfg80211_bss *bss; 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 *rsnie = NULL;
const u8 *wpaie = NULL; const u8 *wpaie = NULL;
...@@ -1294,7 +1294,7 @@ static void ath12k_peer_assoc_h_rates(struct ath12k *ar, ...@@ -1294,7 +1294,7 @@ static void ath12k_peer_assoc_h_rates(struct ath12k *ar,
struct ieee80211_sta *sta, struct ieee80211_sta *sta,
struct ath12k_wmi_peer_assoc_arg *arg) 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 wmi_rate_set_arg *rateset = &arg->peer_legacy_rates;
struct cfg80211_chan_def def; struct cfg80211_chan_def def;
const struct ieee80211_supported_band *sband; const struct ieee80211_supported_band *sband;
...@@ -1357,7 +1357,7 @@ static void ath12k_peer_assoc_h_ht(struct ath12k *ar, ...@@ -1357,7 +1357,7 @@ static void ath12k_peer_assoc_h_ht(struct ath12k *ar,
struct ath12k_wmi_peer_assoc_arg *arg) struct ath12k_wmi_peer_assoc_arg *arg)
{ {
const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; 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; struct cfg80211_chan_def def;
enum nl80211_band band; enum nl80211_band band;
const u8 *ht_mcs_mask; const u8 *ht_mcs_mask;
...@@ -1518,7 +1518,7 @@ static void ath12k_peer_assoc_h_vht(struct ath12k *ar, ...@@ -1518,7 +1518,7 @@ static void ath12k_peer_assoc_h_vht(struct ath12k *ar,
struct ath12k_wmi_peer_assoc_arg *arg) struct ath12k_wmi_peer_assoc_arg *arg)
{ {
const struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; 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; struct cfg80211_chan_def def;
enum nl80211_band band; enum nl80211_band band;
const u16 *vht_mcs_mask; const u16 *vht_mcs_mask;
...@@ -1793,7 +1793,7 @@ static void ath12k_peer_assoc_h_qos(struct ath12k *ar, ...@@ -1793,7 +1793,7 @@ static void ath12k_peer_assoc_h_qos(struct ath12k *ar,
struct ieee80211_sta *sta, struct ieee80211_sta *sta,
struct ath12k_wmi_peer_assoc_arg *arg) 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) { switch (arvif->vdev_type) {
case WMI_VDEV_TYPE_AP: case WMI_VDEV_TYPE_AP:
...@@ -1991,7 +1991,7 @@ static void ath12k_peer_assoc_h_phymode(struct ath12k *ar, ...@@ -1991,7 +1991,7 @@ static void ath12k_peer_assoc_h_phymode(struct ath12k *ar,
struct ieee80211_sta *sta, struct ieee80211_sta *sta,
struct ath12k_wmi_peer_assoc_arg *arg) 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; struct cfg80211_chan_def def;
enum nl80211_band band; enum nl80211_band band;
const u8 *ht_mcs_mask; const u8 *ht_mcs_mask;
...@@ -2140,7 +2140,7 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar, ...@@ -2140,7 +2140,7 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
const struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap; 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_20mhz_only *bw_20;
const struct ieee80211_eht_mcs_nss_supp_bw *bw; 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; u32 *rx_mcs, *tx_mcs;
if (!sta->deflink.he_cap.has_he || !eht_cap->has_eht) if (!sta->deflink.he_cap.has_he || !eht_cap->has_eht)
...@@ -2266,7 +2266,7 @@ static void ath12k_bss_assoc(struct ieee80211_hw *hw, ...@@ -2266,7 +2266,7 @@ static void ath12k_bss_assoc(struct ieee80211_hw *hw,
struct ieee80211_bss_conf *bss_conf) struct ieee80211_bss_conf *bss_conf)
{ {
struct ath12k *ar = hw->priv; 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 ath12k_wmi_peer_assoc_arg peer_arg;
struct ieee80211_sta *ap_sta; struct ieee80211_sta *ap_sta;
struct ath12k_peer *peer; struct ath12k_peer *peer;
...@@ -2360,7 +2360,7 @@ static void ath12k_bss_disassoc(struct ieee80211_hw *hw, ...@@ -2360,7 +2360,7 @@ static void ath12k_bss_disassoc(struct ieee80211_hw *hw,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
struct ath12k *ar = hw->priv; struct ath12k *ar = hw->priv;
struct ath12k_vif *arvif = (void *)vif->drv_priv; struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
int ret; int ret;
lockdep_assert_held(&ar->conf_mutex); lockdep_assert_held(&ar->conf_mutex);
...@@ -2407,7 +2407,7 @@ static void ath12k_recalculate_mgmt_rate(struct ath12k *ar, ...@@ -2407,7 +2407,7 @@ static void ath12k_recalculate_mgmt_rate(struct ath12k *ar,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct cfg80211_chan_def *def) 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; const struct ieee80211_supported_band *sband;
u8 basic_rate_idx; u8 basic_rate_idx;
int hw_rate_code; int hw_rate_code;
...@@ -3420,7 +3420,7 @@ static int ath12k_station_disassoc(struct ath12k *ar, ...@@ -3420,7 +3420,7 @@ static int ath12k_station_disassoc(struct ath12k *ar,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct ieee80211_sta *sta) struct ieee80211_sta *sta)
{ {
struct ath12k_vif *arvif = (void *)vif->drv_priv; struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
int ret; int ret;
lockdep_assert_held(&ar->conf_mutex); lockdep_assert_held(&ar->conf_mutex);
...@@ -3856,7 +3856,7 @@ static int ath12k_mac_op_sta_set_txpwr(struct ieee80211_hw *hw, ...@@ -3856,7 +3856,7 @@ static int ath12k_mac_op_sta_set_txpwr(struct ieee80211_hw *hw,
struct ieee80211_sta *sta) struct ieee80211_sta *sta)
{ {
struct ath12k *ar = hw->priv; struct ath12k *ar = hw->priv;
struct ath12k_vif *arvif = (void *)vif->drv_priv; struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
int ret; int ret;
s16 txpwr; s16 txpwr;
...@@ -3893,7 +3893,7 @@ static void ath12k_mac_op_sta_rc_update(struct ieee80211_hw *hw, ...@@ -3893,7 +3893,7 @@ static void ath12k_mac_op_sta_rc_update(struct ieee80211_hw *hw,
{ {
struct ath12k *ar = hw->priv; struct ath12k *ar = hw->priv;
struct ath12k_sta *arsta = (struct ath12k_sta *)sta->drv_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; struct ath12k_peer *peer;
u32 bw, smps; u32 bw, smps;
...@@ -4019,7 +4019,7 @@ static int ath12k_mac_op_conf_tx(struct ieee80211_hw *hw, ...@@ -4019,7 +4019,7 @@ static int ath12k_mac_op_conf_tx(struct ieee80211_hw *hw,
const struct ieee80211_tx_queue_params *params) const struct ieee80211_tx_queue_params *params)
{ {
struct ath12k *ar = hw->priv; 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; struct wmi_wmm_params_arg *p = NULL;
int ret; int ret;
...@@ -6123,7 +6123,7 @@ ath12k_mac_update_vif_chan(struct ath12k *ar, ...@@ -6123,7 +6123,7 @@ ath12k_mac_update_vif_chan(struct ath12k *ar,
lockdep_assert_held(&ar->conf_mutex); lockdep_assert_held(&ar->conf_mutex);
for (i = 0; i < n_vifs; i++) { 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) if (vifs[i].vif->type == NL80211_IFTYPE_MONITOR)
monitor_vif = true; monitor_vif = true;
...@@ -6157,7 +6157,7 @@ ath12k_mac_update_vif_chan(struct ath12k *ar, ...@@ -6157,7 +6157,7 @@ ath12k_mac_update_vif_chan(struct ath12k *ar,
/* TODO: Update ar->rx_channel */ /* TODO: Update ar->rx_channel */
for (i = 0; i < n_vifs; i++) { 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)) if (WARN_ON(!arvif->is_started))
continue; continue;
...@@ -6271,7 +6271,7 @@ static int ath12k_start_vdev_delay(struct ieee80211_hw *hw, ...@@ -6271,7 +6271,7 @@ static int ath12k_start_vdev_delay(struct ieee80211_hw *hw,
{ {
struct ath12k *ar = hw->priv; struct ath12k *ar = hw->priv;
struct ath12k_base *ab = ar->ab; 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; int ret;
if (WARN_ON(arvif->is_started)) if (WARN_ON(arvif->is_started))
...@@ -6307,7 +6307,7 @@ ath12k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw, ...@@ -6307,7 +6307,7 @@ ath12k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw,
{ {
struct ath12k *ar = hw->priv; struct ath12k *ar = hw->priv;
struct ath12k_base *ab = ar->ab; 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; int ret;
struct ath12k_wmi_peer_create_arg param; struct ath12k_wmi_peer_create_arg param;
...@@ -6386,7 +6386,7 @@ ath12k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw, ...@@ -6386,7 +6386,7 @@ ath12k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,
{ {
struct ath12k *ar = hw->priv; struct ath12k *ar = hw->priv;
struct ath12k_base *ab = ar->ab; 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; int ret;
mutex_lock(&ar->conf_mutex); mutex_lock(&ar->conf_mutex);
...@@ -6749,7 +6749,7 @@ ath12k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw, ...@@ -6749,7 +6749,7 @@ ath12k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
const struct cfg80211_bitrate_mask *mask) 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 cfg80211_chan_def def;
struct ath12k *ar = arvif->ar; struct ath12k *ar = arvif->ar;
enum nl80211_band band; enum nl80211_band band;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment