2024-02-28 11:12:06

by Johannes Berg

[permalink] [raw]
Subject: [PATCH] wifi: cw1200: restore endian swapping

From: Johannes Berg <[email protected]>

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 <[email protected]>
---
drivers/net/wireless/st/cw1200/cw1200_spi.c | 6 ++++++
1 file changed, 6 insertions(+)

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
*/
--
2.43.2



2024-03-05 19:23:07

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] wifi: cw1200: restore endian swapping

Johannes Berg <[email protected]> wrote:

> From: Johannes Berg <[email protected]>
>
> 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 <[email protected]>

Patch applied to wireless-next.git, thanks.

81e060584f1d wifi: cw1200: restore endian swapping

--
https://patchwork.kernel.org/project/linux-wireless/patch/20240228121156.62f820aa6dfb.Ia63314e4d0ed1ee76f100846d68f0722abf6b793@changeid/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches