wifi: cw1200: restore endian swapping
authorJohannes Berg <johannes.berg@intel.com>
Wed, 28 Feb 2024 11:11:56 +0000 (12:11 +0100)
committerKalle Valo <kvalo@kernel.org>
Tue, 5 Mar 2024 18:54:15 +0000 (20:54 +0200)
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>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240228121156.62f820aa6dfb.Ia63314e4d0ed1ee76f100846d68f0722abf6b793@changeid
drivers/net/wireless/st/cw1200/cw1200_spi.c

index fb3aafcafe185eab4b3e669d834a7b56d8d596ec..4f346fb977a98945adecc71ec61b2f2a49a442ab 100644 (file)
@@ -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
        */