diff mbox series

wifi: cw1200: restore endian swapping

Message ID 20240228121156.62f820aa6dfb.Ia63314e4d0ed1ee76f100846d68f0722abf6b793@changeid
State New
Headers show
Series wifi: cw1200: restore endian swapping | expand

Commit Message

Johannes Berg Feb. 28, 2024, 11:11 a.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

The code here looks well thought-out, so it seems likely
that the byte-swaps are actually needed, due to SPI bus
and device behaviour. Restore the byte-swapping, in a way
that doesn't result in sparse warnings.

Fixes: 7ceade653429 ("wifi: cw1200: fix __le16 sparse warnings")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 drivers/net/wireless/st/cw1200/cw1200_spi.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Kalle Valo March 5, 2024, 6:54 p.m. UTC | #1
Johannes Berg <johannes@sipsolutions.net> wrote:

> From: Johannes Berg <johannes.berg@intel.com>
> 
> The code here looks well thought-out, so it seems likely
> that the byte-swaps are actually needed, due to SPI bus
> and device behaviour. Restore the byte-swapping, in a way
> that doesn't result in sparse warnings.
> 
> Fixes: 7ceade653429 ("wifi: cw1200: fix __le16 sparse warnings")
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Patch applied to wireless-next.git, thanks.

81e060584f1d wifi: cw1200: restore endian swapping
diff mbox series

Patch

diff --git a/drivers/net/wireless/st/cw1200/cw1200_spi.c b/drivers/net/wireless/st/cw1200/cw1200_spi.c
index fb3aafcafe18..4f346fb977a9 100644
--- a/drivers/net/wireless/st/cw1200/cw1200_spi.c
+++ b/drivers/net/wireless/st/cw1200/cw1200_spi.c
@@ -81,6 +81,9 @@  static int cw1200_spi_memcpy_fromio(struct hwbus_priv *self,
 	pr_info("READ : %04d from 0x%02x (%04x)\n", count, addr, regaddr);
 #endif
 
+	/* Header is LE16 */
+	regaddr = (__force u16)cpu_to_le16(regaddr);
+
 	/* We have to byteswap if the SPI bus is limited to 8b operation
 	   or we are running on a Big Endian system
 	*/
@@ -143,6 +146,9 @@  static int cw1200_spi_memcpy_toio(struct hwbus_priv *self,
 	pr_info("WRITE: %04d  to  0x%02x (%04x)\n", count, addr, regaddr);
 #endif
 
+	/* Header is LE16 */
+	regaddr = (__force u16)cpu_to_le16(regaddr);
+
 	/* We have to byteswap if the SPI bus is limited to 8b operation
 	   or we are running on a Big Endian system
 	*/