linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: sh_flctl: Fix warnings due to improper casts
@ 2013-11-27  0:35 Laurent Pinchart
  2013-11-27  2:11 ` Brian Norris
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2013-11-27  0:35 UTC (permalink / raw)
  To: linux-sh; +Cc: linux-mtd, David Woodhouse

Cast pointers to unsigned long instead of unsigned int. This fixes
warnings on platforms where pointers have a different size than int.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/mtd/nand/sh_flctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
index a3c84eb..b1e2b13 100644
--- a/drivers/mtd/nand/sh_flctl.c
+++ b/drivers/mtd/nand/sh_flctl.c
@@ -151,7 +151,7 @@ static void flctl_setup_dma(struct sh_flctl *flctl)
 	dma_cap_set(DMA_SLAVE, mask);
 
 	flctl->chan_fifo0_tx = dma_request_channel(mask, shdma_chan_filter,
-					    (void *)pdata->slave_id_fifo0_tx);
+			(void *)(unsigned long)pdata->slave_id_fifo0_tx);
 	dev_dbg(&pdev->dev, "%s: TX: got channel %p\n", __func__,
 		flctl->chan_fifo0_tx);
 
@@ -168,7 +168,7 @@ static void flctl_setup_dma(struct sh_flctl *flctl)
 		goto err;
 
 	flctl->chan_fifo0_rx = dma_request_channel(mask, shdma_chan_filter,
-					    (void *)pdata->slave_id_fifo0_rx);
+			(void *)(unsigned long)pdata->slave_id_fifo0_rx);
 	dev_dbg(&pdev->dev, "%s: RX: got channel %p\n", __func__,
 		flctl->chan_fifo0_rx);
 
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: sh_flctl: Fix warnings due to improper casts
  2013-11-27  0:35 [PATCH] mtd: sh_flctl: Fix warnings due to improper casts Laurent Pinchart
@ 2013-11-27  2:11 ` Brian Norris
  2013-11-27 10:04   ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Norris @ 2013-11-27  2:11 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: David Woodhouse, linux-mtd, linux-sh

On Wed, Nov 27, 2013 at 01:35:11AM +0100, Laurent Pinchart wrote:
> Cast pointers to unsigned long instead of unsigned int. This fixes
> warnings on platforms where pointers have a different size than int.
> 
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: linux-mtd@lists.infradead.org
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  drivers/mtd/nand/sh_flctl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
> index a3c84eb..b1e2b13 100644
> --- a/drivers/mtd/nand/sh_flctl.c
> +++ b/drivers/mtd/nand/sh_flctl.c
> @@ -151,7 +151,7 @@ static void flctl_setup_dma(struct sh_flctl *flctl)
>  	dma_cap_set(DMA_SLAVE, mask);
>  
>  	flctl->chan_fifo0_tx = dma_request_channel(mask, shdma_chan_filter,
> -					    (void *)pdata->slave_id_fifo0_tx);
> +			(void *)(unsigned long)pdata->slave_id_fifo0_tx);

Perhaps the intermediate cast should be for uintptr_t instead of
unsigned long, just to be more exact? (I see that uintptr_t is just
typedef'd for unsigned long, but it still seems more precise.)

>  	dev_dbg(&pdev->dev, "%s: TX: got channel %p\n", __func__,
>  		flctl->chan_fifo0_tx);
>  
> @@ -168,7 +168,7 @@ static void flctl_setup_dma(struct sh_flctl *flctl)
>  		goto err;
>  
>  	flctl->chan_fifo0_rx = dma_request_channel(mask, shdma_chan_filter,
> -					    (void *)pdata->slave_id_fifo0_rx);
> +			(void *)(unsigned long)pdata->slave_id_fifo0_rx);

Ditto.

>  	dev_dbg(&pdev->dev, "%s: RX: got channel %p\n", __func__,
>  		flctl->chan_fifo0_rx);
>  

Brian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: sh_flctl: Fix warnings due to improper casts
  2013-11-27  2:11 ` Brian Norris
@ 2013-11-27 10:04   ` Laurent Pinchart
  0 siblings, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2013-11-27 10:04 UTC (permalink / raw)
  To: Brian Norris, linux-sh; +Cc: David Woodhouse, linux-mtd

Hi Brian,

On Tuesday 26 November 2013 18:11:40 Brian Norris wrote:
> On Wed, Nov 27, 2013 at 01:35:11AM +0100, Laurent Pinchart wrote:
> > Cast pointers to unsigned long instead of unsigned int. This fixes
> > warnings on platforms where pointers have a different size than int.
> > 
> > Cc: David Woodhouse <dwmw2@infradead.org>
> > Cc: linux-mtd@lists.infradead.org
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >  drivers/mtd/nand/sh_flctl.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
> > index a3c84eb..b1e2b13 100644
> > --- a/drivers/mtd/nand/sh_flctl.c
> > +++ b/drivers/mtd/nand/sh_flctl.c
> > @@ -151,7 +151,7 @@ static void flctl_setup_dma(struct sh_flctl *flctl)
> >  	dma_cap_set(DMA_SLAVE, mask);
> >  	
> >  	flctl->chan_fifo0_tx = dma_request_channel(mask, shdma_chan_filter,
> > -					    (void *)pdata->slave_id_fifo0_tx);
> > +			(void *)(unsigned long)pdata->slave_id_fifo0_tx);
> 
> Perhaps the intermediate cast should be for uintptr_t instead of
> unsigned long, just to be more exact? (I see that uintptr_t is just
> typedef'd for unsigned long, but it still seems more precise.)

Good point. I'll fix that and resubmit.

> >  	dev_dbg(&pdev->dev, "%s: TX: got channel %p\n", __func__,
> >  		flctl->chan_fifo0_tx);
> > 
> > @@ -168,7 +168,7 @@ static void flctl_setup_dma(struct sh_flctl *flctl)
> >  		goto err;
> >  	
> >  	flctl->chan_fifo0_rx = dma_request_channel(mask, shdma_chan_filter,
> > -					    (void *)pdata->slave_id_fifo0_rx);
> > +			(void *)(unsigned long)pdata->slave_id_fifo0_rx);
> 
> Ditto.
> 
> >  	dev_dbg(&pdev->dev, "%s: RX: got channel %p\n", __func__,
> >  		flctl->chan_fifo0_rx);

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-27 10:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-27  0:35 [PATCH] mtd: sh_flctl: Fix warnings due to improper casts Laurent Pinchart
2013-11-27  2:11 ` Brian Norris
2013-11-27 10:04   ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).