Fix Sparse warnings

Merge series from Hardevsinh Palaniya <hardevsinh.palaniya@siliconsignals.io>:

Fix casting warnings and other cleanups:

	- Use ioread32be instead of readl
	- Use iowrite32be instead of writel
This commit is contained in:
Mark Brown 2024-10-10 10:49:23 +01:00
commit e7ccaaadeb
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 6 additions and 7 deletions

View File

@ -280,25 +280,25 @@ static void dspi_native_dev_to_host(struct fsl_dspi *dspi, u32 rxdata)
static void dspi_8on32_host_to_dev(struct fsl_dspi *dspi, u32 *txdata) static void dspi_8on32_host_to_dev(struct fsl_dspi *dspi, u32 *txdata)
{ {
*txdata = cpu_to_be32(*(u32 *)dspi->tx); *txdata = (__force u32)cpu_to_be32(*(u32 *)dspi->tx);
dspi->tx += sizeof(u32); dspi->tx += sizeof(u32);
} }
static void dspi_8on32_dev_to_host(struct fsl_dspi *dspi, u32 rxdata) static void dspi_8on32_dev_to_host(struct fsl_dspi *dspi, u32 rxdata)
{ {
*(u32 *)dspi->rx = be32_to_cpu(rxdata); *(u32 *)dspi->rx = be32_to_cpu((__force __be32)rxdata);
dspi->rx += sizeof(u32); dspi->rx += sizeof(u32);
} }
static void dspi_8on16_host_to_dev(struct fsl_dspi *dspi, u32 *txdata) static void dspi_8on16_host_to_dev(struct fsl_dspi *dspi, u32 *txdata)
{ {
*txdata = cpu_to_be16(*(u16 *)dspi->tx); *txdata = (__force u32)cpu_to_be16(*(u16 *)dspi->tx);
dspi->tx += sizeof(u16); dspi->tx += sizeof(u16);
} }
static void dspi_8on16_dev_to_host(struct fsl_dspi *dspi, u32 rxdata) static void dspi_8on16_dev_to_host(struct fsl_dspi *dspi, u32 rxdata)
{ {
*(u16 *)dspi->rx = be16_to_cpu(rxdata); *(u16 *)dspi->rx = be16_to_cpu((__force __be16)rxdata);
dspi->rx += sizeof(u16); dspi->rx += sizeof(u16);
} }

View File

@ -407,7 +407,7 @@ static void spi_imx_buf_tx_swap(struct spi_imx_data *spi_imx)
static void mx53_ecspi_rx_target(struct spi_imx_data *spi_imx) static void mx53_ecspi_rx_target(struct spi_imx_data *spi_imx)
{ {
u32 val = be32_to_cpu(readl(spi_imx->base + MXC_CSPIRXDATA)); u32 val = ioread32be(spi_imx->base + MXC_CSPIRXDATA);
if (spi_imx->rx_buf) { if (spi_imx->rx_buf) {
int n_bytes = spi_imx->target_burst % sizeof(val); int n_bytes = spi_imx->target_burst % sizeof(val);
@ -436,13 +436,12 @@ static void mx53_ecspi_tx_target(struct spi_imx_data *spi_imx)
if (spi_imx->tx_buf) { if (spi_imx->tx_buf) {
memcpy(((u8 *)&val) + sizeof(val) - n_bytes, memcpy(((u8 *)&val) + sizeof(val) - n_bytes,
spi_imx->tx_buf, n_bytes); spi_imx->tx_buf, n_bytes);
val = cpu_to_be32(val);
spi_imx->tx_buf += n_bytes; spi_imx->tx_buf += n_bytes;
} }
spi_imx->count -= n_bytes; spi_imx->count -= n_bytes;
writel(val, spi_imx->base + MXC_CSPITXDATA); iowrite32be(val, spi_imx->base + MXC_CSPITXDATA);
} }
/* MX51 eCSPI */ /* MX51 eCSPI */