spi: s3c64xx: fix casting warning
Subsystems (3)
PATCH v2 1/1 spi: s3c64xx: fix casting warning
sdd->ops->request is unsigned int, not unsigned long. Also, sdd->rx_dma.ch is a 'struct dma_chan *'.
Thus, (void *) is converted to (struct dma_chan *)(unsigned long), in order to fix possible sparse warnings.
---
Changes since v1:
- Replaced (unsigned long *) with (struct dma_chan *) to match the type of sdd->rx_dma.ch.
drivers/spi/spi-s3c64xx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/spi/spi-s3c64xx.c +4 -4
@@ -336,10 +336,10 @@ static int acquire_dma(struct s3c64xx_spi_driver_data *sdd) req.cap =DMA_SLAVE ; req.client = &s3c64xx_spi_dma_client; - sdd->rx_dma.ch = (void *)sdd->ops->request (sdd->rx_dma.dmach, - &req, dev,"rx" ); - sdd->tx_dma.ch = (void *)sdd->ops->request (sdd->tx_dma.dmach, - &req, dev,"tx" ); + sdd->rx_dma.ch = (struct dma_chan *)(unsigned long )sdd->ops->request ( + sdd->rx_dma.dmach, &req, dev,"rx" ); + sdd->tx_dma.ch = (struct dma_chan *)(unsigned long )sdd->ops->request ( + sdd->tx_dma.dmach, &req, dev,"tx" );return 1 ; }
Signature · 1 line
1.7.10.4
Mark Brown
maintainerQuoted 4 lines · Jingoo Han
sdd->ops->requestis unsigned int, not unsigned long. Also,sdd->rx_dma.chis a 'structdma_chan*'.
Thus, (void *) is converted to (structdma_chan*)(unsigned long), in order to fix possible sparse warnings.
Applied, though only the cast to unsigned long should actually be needed
- casting to void * should be good for any pointer so changing to the specific struct shouldn't be essential (might catch issues due to future API changes though).
Quoted 10 lines · On Wednesday 17 of July 2013 11:08:16 Mark Brown wrote:
Quoted 4 lines · Jingoo Han
sdd->ops->requestis unsigned int, not unsigned long. Also,sdd->rx_dma.chis a 'structdma_chan*'.
Thus, (void *) is converted to (structdma_chan*)(unsigned long), in order to fix possible sparse warnings.Applied, though only the cast to unsigned long should actually be needed
- casting to void * should be good for any pointer so changing to the specific struct shouldn't be essential (might catch issues due to future API changes though).
Well, hopefully the old S3C DMA API with all its brokenness will get removed soon and we switch to generic DMA engine API. (I already have patches to migrate Samsung ASoC and SPI is being worked on.)
Best regards,
Tomasz
Mark Brown
maintainerQuoted 10 lines · Tomasz Figa
Quoted 4 lines · On Wednesday 17 of July 2013 11:08:16 Mark Brown wrote:
Applied, though only the cast to unsigned long should actually be needed
- casting to void * should be good for any pointer so changing to the specific struct shouldn't be essential (might catch issues due to future API changes though).Well, hopefully the old S3C DMA API with all its brokenness will get removed soon and we switch to generic DMA engine API. (I already have patches to migrate Samsung ASoC and SPI is being worked on.)
If you've done patches for ASoC note that there is generic dmaengine helper code which should be used.
Quoted 8 lines · On Tuesday 23 of July 2013 14:27:53 Mark Brown wrote:
Quoted 7 lines · Tomasz Figa
Quoted 5 lines · On Wednesday 17 of July 2013 11:08:16 Mark Brown wrote:
Applied, though only the cast to unsigned long should actually be needed
- casting to void * should be good for any pointer so changing to the specific struct shouldn't be essential (might catch issues due to future API changes though).
Quoted 6 lines
Quoted 3 lines
Well, hopefully the old S3C DMA API with all its brokenness will get removed soon and we switch to generic DMA engine API. (I already have patches to migrate Samsung ASoC and SPI is being worked on.)
If you've done patches for ASoC note that there is generic dmaengine helper code which should be used.
Hmm, good to know. Let me see if I can adapt my patches to use this. There is no hurry, though, as we can't merge the conversion before s3c24xx DMA engine driver and my patches for s3c64xx support in PL08x driver get merged.
Best regards,
Tomasz