diff mbox

[v2] spi: s3c64xx: fix casting warning

Message ID 008101ce82cb$34f0eea0$9ed2cbe0$@samsung.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Jingoo Han July 17, 2013, 8:54 a.m. UTC
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.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Joe Perches <joe@perches.com>
---
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(-)

Comments

Mark Brown July 17, 2013, 10:08 a.m. UTC | #1
On Wed, Jul 17, 2013 at 05:54:11PM +0900, Jingoo Han wrote:
> 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.

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).
Tomasz Figa July 22, 2013, 5:09 p.m. UTC | #2
On Wednesday 17 of July 2013 11:08:16 Mark Brown wrote:
> On Wed, Jul 17, 2013 at 05:54:11PM +0900, Jingoo Han wrote:
> > 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.
> 
> 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

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown July 23, 2013, 1:27 p.m. UTC | #3
On Mon, Jul 22, 2013 at 07:09:27PM +0200, Tomasz Figa wrote:
> 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.
Tomasz Figa July 23, 2013, 2:08 p.m. UTC | #4
On Tuesday 23 of July 2013 14:27:53 Mark Brown wrote:
> On Mon, Jul 22, 2013 at 07:09:27PM +0200, Tomasz Figa wrote:
> > 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.

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

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 702a536..c9d0b12 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -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;
 }