Skip to content

Commit

Permalink
wifi: wcn36xx: buff_to_be(): fix sparse warnings
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Kalle Valo committed Mar 25, 2024
1 parent ed76931 commit fba5295
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/net/wireless/ath/wcn36xx/txrx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 5 additions & 2 deletions drivers/net/wireless/ath/wcn36xx/wcn36xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit fba5295

Please sign in to comment.