diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2022-05-02 19:54:52 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-05-09 18:18:11 +0100 |
commit | dae336d0dca669143e0fdf6b82c333bf6a8d9e0a (patch) | |
tree | aefb394481723bda64801a9f8674e35ee4afbc3d /drivers/spi | |
parent | 1a23461a8a08c4a32972dec31a394eee3302511d (diff) | |
download | linux-dae336d0dca669143e0fdf6b82c333bf6a8d9e0a.tar.bz2 |
spi: spi-imx: spi_imx_buf_rx_swap_u32(): fix sparse warning: use swab32s() instead of cpu_to_be32()
This patch fixes the following sparse warning by using a swab32s()
instead of a cpu_to_be32(). The driver is used on little endian
systems only and we really want to swap the bytes.
| drivers/spi/spi-imx.c:305:29: warning: incorrect type in assignment (different base types)
| drivers/spi/spi-imx.c:305:29: expected unsigned int val
| drivers/spi/spi-imx.c:305:29: got restricted __be32 [usertype]
| drivers/spi/spi-imx.c:361:21: warning: incorrect type in assignment (different base types)
| drivers/spi/spi-imx.c:361:21: expected unsigned int [assigned] [usertype] val
| drivers/spi/spi-imx.c:361:21: got restricted __be32 [usertype]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20220502175457.1977983-5-mkl@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-imx.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 895c7514325b..86391f869444 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -298,7 +298,7 @@ static void spi_imx_buf_rx_swap_u32(struct spi_imx_data *spi_imx) #ifdef __LITTLE_ENDIAN bytes_per_word = spi_imx_bytes_per_word(spi_imx->bits_per_word); if (bytes_per_word == 1) - val = cpu_to_be32(val); + swab32s(&val); else if (bytes_per_word == 2) val = (val << 16) | (val >> 16); #endif @@ -354,7 +354,7 @@ static void spi_imx_buf_tx_swap_u32(struct spi_imx_data *spi_imx) bytes_per_word = spi_imx_bytes_per_word(spi_imx->bits_per_word); if (bytes_per_word == 1) - val = cpu_to_be32(val); + swab32s(&val); else if (bytes_per_word == 2) val = (val << 16) | (val >> 16); #endif |