summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/wcn36xx
diff options
context:
space:
mode:
authorKalle Valo <quic_kvalo@quicinc.com>2024-03-20 20:24:47 +0200
committerKalle Valo <quic_kvalo@quicinc.com>2024-03-25 12:50:41 +0200
commitfba52950e59d5eb7137339f2fcaf301a4e963cb4 (patch)
treedee724c12fe41b1be5274c3235d6056cd561cb75 /drivers/net/wireless/ath/wcn36xx
parented769314f55cef504e1a1fe505ef98c45185f371 (diff)
downloadlinux-stable-fba52950e59d5eb7137339f2fcaf301a4e963cb4.tar.gz
linux-stable-fba52950e59d5eb7137339f2fcaf301a4e963cb4.tar.bz2
linux-stable-fba52950e59d5eb7137339f2fcaf301a4e963cb4.zip
wifi: wcn36xx: buff_to_be(): fix sparse warnings
Sparse warns: drivers/net/wireless/ath/wcn36xx/txrx.c: note: in included file (through drivers/net/wireless/ath/wcn36xx/txrx.h): drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: warning: incorrect type in assignment (different base types) drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: expected unsigned int [usertype] drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: got restricted __be32 [usertype] drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: warning: incorrect type in assignment (different base types) drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: expected unsigned int [usertype] drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: got restricted __be32 [usertype] Use void pointers and two separate variables to workaround the warning. Also now the callers don't need any casting. There's actually cpu_to_be32_array() available but decided to do minimal changes instead. Compile tested only. Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com> Link: https://msgid.link/20240320182449.3757215-3-kvalo@kernel.org
Diffstat (limited to 'drivers/net/wireless/ath/wcn36xx')
-rw-r--r--drivers/net/wireless/ath/wcn36xx/txrx.c4
-rw-r--r--drivers/net/wireless/ath/wcn36xx/wcn36xx.h7
2 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c
index 0802ed728824..8826998797d6 100644
--- a/drivers/net/wireless/ath/wcn36xx/txrx.c
+++ b/drivers/net/wireless/ath/wcn36xx/txrx.c
@@ -318,7 +318,7 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
memset(&status, 0, sizeof(status));
bd = (struct wcn36xx_rx_bd *)skb->data;
- buff_to_be((u32 *)bd, sizeof(*bd)/sizeof(u32));
+ buff_to_be(bd, sizeof(*bd)/sizeof(u32));
wcn36xx_dbg_dump(WCN36XX_DBG_RX_DUMP,
"BD <<< ", (char *)bd,
sizeof(struct wcn36xx_rx_bd));
@@ -692,7 +692,7 @@ int wcn36xx_start_tx(struct wcn36xx *wcn,
/* MGMT and CTRL frames are handeld here*/
wcn36xx_set_tx_mgmt(&bd, wcn, &vif_priv, skb, bcast);
- buff_to_be((u32 *)&bd, sizeof(bd)/sizeof(u32));
+ buff_to_be(&bd, sizeof(bd)/sizeof(u32));
bd.tx_bd_sign = 0xbdbdbdbd;
ret = wcn36xx_dxe_tx_frame(wcn, vif_priv, &bd, skb, is_low);
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index ff4a8e5d7209..bccc27de848d 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -100,11 +100,14 @@ enum wcn36xx_ampdu_state {
#define RF_IRIS_WCN3660 0x3660
#define RF_IRIS_WCN3680 0x3680
-static inline void buff_to_be(u32 *buf, size_t len)
+static inline void buff_to_be(void *buf, size_t len)
{
+ __be32 *to = buf;
+ u32 *from = buf;
int i;
+
for (i = 0; i < len; i++)
- buf[i] = cpu_to_be32(buf[i]);
+ to[i] = cpu_to_be32(from[i]);
}
struct nv_data {