summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath/ath11k/wmi.c
diff options
context:
space:
mode:
authorJeff Johnson <quic_jjohnson@quicinc.com>2023-10-09 09:39:42 -0700
committerKalle Valo <quic_kvalo@quicinc.com>2023-10-12 19:08:22 +0300
commit10c65f97b424fcee439463f933140df2a0022f98 (patch)
treecb0fd0bb42695ca33acd13c99343f7ef8c0aaf4e /drivers/net/wireless/ath/ath11k/wmi.c
parent480d230bef0ecd06e72ae3a84117142e38e77503 (diff)
wifi: ath11k: Introduce and use ath11k_sta_to_arsta()
Currently, the logic to return an ath11k_sta pointer, given a ieee80211_sta pointer, uses typecasting throughout the driver. In general, conversion functions are preferable to typecasting since using a conversion function allows the compiler to validate the types of both the input and output parameters. ath11k already defines a conversion function ath11k_vif_to_arvif() for a similar conversion. So introduce ath11k_sta_to_arsta() for this use case, and convert all of the existing typecasting to use this function. No functional changes, compile tested only. Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com> Link: https://lore.kernel.org/r/20231009-ath11k_sta_to_arsta-v1-1-1563e3a307e8@quicinc.com
Diffstat (limited to 'drivers/net/wireless/ath/ath11k/wmi.c')
-rw-r--r--drivers/net/wireless/ath/ath11k/wmi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 8ecf67bf9b43..26d416aa9c1f 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -6453,7 +6453,7 @@ static int ath11k_wmi_tlv_rssi_chain_parse(struct ath11k_base *ab,
goto exit;
}
- arsta = (struct ath11k_sta *)sta->drv_priv;
+ arsta = ath11k_sta_to_arsta(sta);
BUILD_BUG_ON(ARRAY_SIZE(arsta->chain_signal) >
ARRAY_SIZE(stats_rssi->rssi_avg_beacon));
@@ -6541,7 +6541,7 @@ static int ath11k_wmi_tlv_fw_stats_data_parse(struct ath11k_base *ab,
arvif->bssid,
NULL);
if (sta) {
- arsta = (struct ath11k_sta *)sta->drv_priv;
+ arsta = ath11k_sta_to_arsta(sta);
arsta->rssi_beacon = src->beacon_snr;
ath11k_dbg(ab, ATH11K_DBG_WMI,
"stats vdev id %d snr %d\n",
@@ -7468,7 +7468,7 @@ static void ath11k_wmi_event_peer_sta_ps_state_chg(struct ath11k_base *ab,
goto exit;
}
- arsta = (struct ath11k_sta *)sta->drv_priv;
+ arsta = ath11k_sta_to_arsta(sta);
spin_lock_bh(&ar->data_lock);