* [PATCH v2 1/2] spi: spi-fsl-dspi: Fix casting warnings
2024-10-08 5:55 Fix Sparse warnings Hardevsinh Palaniya
@ 2024-10-08 5:55 ` Hardevsinh Palaniya
2024-10-08 13:13 ` Vladimir Oltean
2024-10-08 5:55 ` [PATCH v2 2/2] spi: spi-imx: " Hardevsinh Palaniya
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Hardevsinh Palaniya @ 2024-10-08 5:55 UTC (permalink / raw)
To: olteanv, broonie, frank.li, shawnguo
Cc: Hardevsinh Palaniya, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, linux-spi, imx, linux-kernel, linux-arm-kernel
Sparse warnings:
drivers/spi/spi-fsl-dspi.c:283:17: warning: incorrect type in assignment (different base types)
drivers/spi/spi-fsl-dspi.c:283:17: expected unsigned int [usertype]
drivers/spi/spi-fsl-dspi.c:283:17: got restricted __be32 [usertype]
drivers/spi/spi-fsl-dspi.c:289:28: warning: cast to restricted __be32
drivers/spi/spi-fsl-dspi.c:289:28: warning: cast to restricted __be32
drivers/spi/spi-fsl-dspi.c:289:28: warning: cast to restricted __be32
drivers/spi/spi-fsl-dspi.c:289:28: warning: cast to restricted __be32
drivers/spi/spi-fsl-dspi.c:289:28: warning: cast to restricted __be32
drivers/spi/spi-fsl-dspi.c:289:28: warning: cast to restricted __be32
drivers/spi/spi-fsl-dspi.c:295:17: warning: incorrect type in assignment (different base types)
drivers/spi/spi-fsl-dspi.c:295:17: expected unsigned int [usertype]
drivers/spi/spi-fsl-dspi.c:295:17: got restricted __be16 [usertype]
drivers/spi/spi-fsl-dspi.c:301:28: warning: cast to restricted __be16
drivers/spi/spi-fsl-dspi.c:301:28: warning: cast to restricted __be16
drivers/spi/spi-fsl-dspi.c:301:28: warning: cast to restricted __be16
drivers/spi/spi-fsl-dspi.c:301:28: warning: cast to restricted __be16
Signed-off-by: Hardevsinh Palaniya <hardevsinh.palaniya@siliconsignals.io>
---
drivers/spi/spi-fsl-dspi.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index 191de1917f83..e34588679514 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -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)
{
- *txdata = cpu_to_be32(*(u32 *)dspi->tx);
+ *txdata = (__force u32)cpu_to_be32(*(u32 *)dspi->tx);
dspi->tx += sizeof(u32);
}
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);
}
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);
}
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);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v2 1/2] spi: spi-fsl-dspi: Fix casting warnings
2024-10-08 5:55 ` [PATCH v2 1/2] spi: spi-fsl-dspi: Fix casting warnings Hardevsinh Palaniya
@ 2024-10-08 13:13 ` Vladimir Oltean
0 siblings, 0 replies; 9+ messages in thread
From: Vladimir Oltean @ 2024-10-08 13:13 UTC (permalink / raw)
To: Hardevsinh Palaniya
Cc: broonie, frank.li, shawnguo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, linux-spi, imx,
linux-kernel, linux-arm-kernel
On Tue, Oct 08, 2024 at 11:25:45AM +0530, Hardevsinh Palaniya wrote:
> Sparse warnings:
>
> drivers/spi/spi-fsl-dspi.c:283:17: warning: incorrect type in assignment (different base types)
> drivers/spi/spi-fsl-dspi.c:283:17: expected unsigned int [usertype]
> drivers/spi/spi-fsl-dspi.c:283:17: got restricted __be32 [usertype]
> drivers/spi/spi-fsl-dspi.c:289:28: warning: cast to restricted __be32
> drivers/spi/spi-fsl-dspi.c:289:28: warning: cast to restricted __be32
> drivers/spi/spi-fsl-dspi.c:289:28: warning: cast to restricted __be32
> drivers/spi/spi-fsl-dspi.c:289:28: warning: cast to restricted __be32
> drivers/spi/spi-fsl-dspi.c:289:28: warning: cast to restricted __be32
> drivers/spi/spi-fsl-dspi.c:289:28: warning: cast to restricted __be32
> drivers/spi/spi-fsl-dspi.c:295:17: warning: incorrect type in assignment (different base types)
> drivers/spi/spi-fsl-dspi.c:295:17: expected unsigned int [usertype]
> drivers/spi/spi-fsl-dspi.c:295:17: got restricted __be16 [usertype]
> drivers/spi/spi-fsl-dspi.c:301:28: warning: cast to restricted __be16
> drivers/spi/spi-fsl-dspi.c:301:28: warning: cast to restricted __be16
> drivers/spi/spi-fsl-dspi.c:301:28: warning: cast to restricted __be16
> drivers/spi/spi-fsl-dspi.c:301:28: warning: cast to restricted __be16
>
> Signed-off-by: Hardevsinh Palaniya <hardevsinh.palaniya@siliconsignals.io>
> ---
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/2] spi: spi-imx: Fix casting warnings
2024-10-08 5:55 Fix Sparse warnings Hardevsinh Palaniya
2024-10-08 5:55 ` [PATCH v2 1/2] spi: spi-fsl-dspi: Fix casting warnings Hardevsinh Palaniya
@ 2024-10-08 5:55 ` Hardevsinh Palaniya
2024-10-08 15:29 ` Frank Li
2024-10-08 6:25 ` Fix Sparse warnings Marc Kleine-Budde
2024-10-10 11:14 ` Mark Brown
3 siblings, 1 reply; 9+ messages in thread
From: Hardevsinh Palaniya @ 2024-10-08 5:55 UTC (permalink / raw)
To: olteanv, broonie, frank.li, shawnguo
Cc: Hardevsinh Palaniya, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, linux-spi, imx, linux-kernel, linux-arm-kernel
Sparse warnings:
drivers/spi/spi-imx.c:410:19: warning: cast to restricted __be32
drivers/spi/spi-imx.c:410:19: warning: cast to restricted __be32
drivers/spi/spi-imx.c:410:19: warning: cast to restricted __be32
drivers/spi/spi-imx.c:410:19: warning: cast to restricted __be32
drivers/spi/spi-imx.c:410:19: warning: cast to restricted __be32
drivers/spi/spi-imx.c:410:19: warning: cast to restricted __be32
drivers/spi/spi-imx.c:439:21: warning: incorrect type in assignment (different base types)
drivers/spi/spi-imx.c:439:21: expected unsigned int [addressable] [usertype] val
drivers/spi/spi-imx.c:439:21: got restricted __be32 [usertype]
Signed-off-by: Hardevsinh Palaniya <hardevsinh.palaniya@siliconsignals.io>
---
drivers/spi/spi-imx.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 4c31d36f3130..fefee771b042 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -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)
{
- u32 val = be32_to_cpu(readl(spi_imx->base + MXC_CSPIRXDATA));
+ u32 val = ioread32be(spi_imx->base + MXC_CSPIRXDATA);
if (spi_imx->rx_buf) {
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) {
memcpy(((u8 *)&val) + sizeof(val) - n_bytes,
spi_imx->tx_buf, n_bytes);
- val = cpu_to_be32(val);
spi_imx->tx_buf += n_bytes;
}
spi_imx->count -= n_bytes;
- writel(val, spi_imx->base + MXC_CSPITXDATA);
+ iowrite32be(val, spi_imx->base + MXC_CSPITXDATA);
}
/* MX51 eCSPI */
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v2 2/2] spi: spi-imx: Fix casting warnings
2024-10-08 5:55 ` [PATCH v2 2/2] spi: spi-imx: " Hardevsinh Palaniya
@ 2024-10-08 15:29 ` Frank Li
0 siblings, 0 replies; 9+ messages in thread
From: Frank Li @ 2024-10-08 15:29 UTC (permalink / raw)
To: Hardevsinh Palaniya
Cc: olteanv, broonie, shawnguo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, linux-spi, imx, linux-kernel, linux-arm-kernel
On Tue, Oct 08, 2024 at 11:25:46AM +0530, Hardevsinh Palaniya wrote:
> Sparse warnings:
>
> drivers/spi/spi-imx.c:410:19: warning: cast to restricted __be32
> drivers/spi/spi-imx.c:410:19: warning: cast to restricted __be32
> drivers/spi/spi-imx.c:410:19: warning: cast to restricted __be32
> drivers/spi/spi-imx.c:410:19: warning: cast to restricted __be32
> drivers/spi/spi-imx.c:410:19: warning: cast to restricted __be32
> drivers/spi/spi-imx.c:410:19: warning: cast to restricted __be32
> drivers/spi/spi-imx.c:439:21: warning: incorrect type in assignment (different base types)
> drivers/spi/spi-imx.c:439:21: expected unsigned int [addressable] [usertype] val
> drivers/spi/spi-imx.c:439:21: got restricted __be32 [usertype]
>
> Signed-off-by: Hardevsinh Palaniya <hardevsinh.palaniya@siliconsignals.io>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/spi/spi-imx.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
> index 4c31d36f3130..fefee771b042 100644
> --- a/drivers/spi/spi-imx.c
> +++ b/drivers/spi/spi-imx.c
> @@ -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)
> {
> - u32 val = be32_to_cpu(readl(spi_imx->base + MXC_CSPIRXDATA));
> + u32 val = ioread32be(spi_imx->base + MXC_CSPIRXDATA);
>
> if (spi_imx->rx_buf) {
> 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) {
> memcpy(((u8 *)&val) + sizeof(val) - n_bytes,
> spi_imx->tx_buf, n_bytes);
> - val = cpu_to_be32(val);
> spi_imx->tx_buf += n_bytes;
> }
>
> spi_imx->count -= n_bytes;
>
> - writel(val, spi_imx->base + MXC_CSPITXDATA);
> + iowrite32be(val, spi_imx->base + MXC_CSPITXDATA);
> }
>
> /* MX51 eCSPI */
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Fix Sparse warnings
2024-10-08 5:55 Fix Sparse warnings Hardevsinh Palaniya
2024-10-08 5:55 ` [PATCH v2 1/2] spi: spi-fsl-dspi: Fix casting warnings Hardevsinh Palaniya
2024-10-08 5:55 ` [PATCH v2 2/2] spi: spi-imx: " Hardevsinh Palaniya
@ 2024-10-08 6:25 ` Marc Kleine-Budde
2024-10-08 8:43 ` Hardevsinh Palaniya
2024-10-10 11:14 ` Mark Brown
3 siblings, 1 reply; 9+ messages in thread
From: Marc Kleine-Budde @ 2024-10-08 6:25 UTC (permalink / raw)
To: Hardevsinh Palaniya
Cc: olteanv, broonie, frank.li, shawnguo, imx, Sascha Hauer,
linux-kernel, linux-spi, linux-arm-kernel,
Pengutronix Kernel Team, Fabio Estevam
[-- Attachment #1: Type: text/plain, Size: 732 bytes --]
On 08.10.2024 11:25:44, Hardevsinh Palaniya wrote:
> Change in v2:
>
> in patch 2/2:
> - Use ioread32be instead of readl
> - Use iowrite32be instead of writel
>
> Note: Drop 2 patches(patch 2/4 & 4/4) from the last version
> link to v1: https://lore.kernel.org/linux-spi/20240927132944.19285-1-hardevsinh.palaniya@siliconsignals.io/T/#t
Have you checked the code on real hardware or compared the generated
code on the asm level?
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Fix Sparse warnings
2024-10-08 6:25 ` Fix Sparse warnings Marc Kleine-Budde
@ 2024-10-08 8:43 ` Hardevsinh Palaniya
2024-10-09 11:08 ` Vladimir Oltean
0 siblings, 1 reply; 9+ messages in thread
From: Hardevsinh Palaniya @ 2024-10-08 8:43 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: olteanv@gmail.com, broonie@kernel.org, frank.li@nxp.com,
shawnguo@kernel.org, imx@lists.linux.dev, Sascha Hauer,
linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, Pengutronix Kernel Team,
Fabio Estevam
Hi Marc,
>> in patch 2/2:
>> - Use ioread32be instead of readl
>> - Use iowrite32be instead of writel
>>
>> Note: Drop 2 patches(patch 2/4 & 4/4) from the last version
>> link to v1: https://lore.kernel.org/linux-spi/20240927132944.19285-1-hardevsinh.palaniya@siliconsignals.io/T/#t
>
>Have you checked the code on real hardware or compared the generated
>code on the asm level?
it's just resolve casting warnings so....
No, I haven’t tested the code on real hardware.
Are there alternative methods to verify it without using hardware?
Best Regards,
Hardev
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Fix Sparse warnings
2024-10-08 8:43 ` Hardevsinh Palaniya
@ 2024-10-09 11:08 ` Vladimir Oltean
0 siblings, 0 replies; 9+ messages in thread
From: Vladimir Oltean @ 2024-10-09 11:08 UTC (permalink / raw)
To: Hardevsinh Palaniya
Cc: Marc Kleine-Budde, broonie@kernel.org, frank.li@nxp.com,
shawnguo@kernel.org, imx@lists.linux.dev, Sascha Hauer,
linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, Pengutronix Kernel Team,
Fabio Estevam
On Tue, Oct 08, 2024 at 08:43:51AM +0000, Hardevsinh Palaniya wrote:
> >Have you checked the code on real hardware or compared the generated
> >code on the asm level?
>
> it's just resolve casting warnings so....
>
> No, I haven’t tested the code on real hardware.
>
> Are there alternative methods to verify it without using hardware?
"Comparing the generated code on the asm level" means running
"make drivers/spi/spi-imx.lst" before and after the patch, FWIW.
It's about the most you can do in absence of hardware to test on.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Fix Sparse warnings
2024-10-08 5:55 Fix Sparse warnings Hardevsinh Palaniya
` (2 preceding siblings ...)
2024-10-08 6:25 ` Fix Sparse warnings Marc Kleine-Budde
@ 2024-10-10 11:14 ` Mark Brown
3 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2024-10-10 11:14 UTC (permalink / raw)
To: olteanv, frank.li, shawnguo, Hardevsinh Palaniya
Cc: Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, linux-spi,
imx, linux-kernel, linux-arm-kernel
On Tue, 08 Oct 2024 11:25:44 +0530, Hardevsinh Palaniya wrote:
> Change in v2:
>
> in patch 2/2:
> - Use ioread32be instead of readl
> - Use iowrite32be instead of writel
>
> Note: Drop 2 patches(patch 2/4 & 4/4) from the last version
> link to v1: https://lore.kernel.org/linux-spi/20240927132944.19285-1-hardevsinh.palaniya@siliconsignals.io/T/#t
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/2] spi: spi-fsl-dspi: Fix casting warnings
commit: 66c1c4175bbdfcf1cb1411b1ea62e7e0b5571594
[2/2] spi: spi-imx: Fix casting warnings
commit: f3a59ab98cfc18c7b2fb1d8164bedbb1569a7e76
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 9+ messages in thread