linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 6/6] atmel_spi: fix warning In function 'atmel_spi_dma_map_xfer'
       [not found] ` <1290247733-17834-6-git-send-email-plagnioj@jcrosoft.com>
@ 2010-11-20 21:48   ` Uwe Kleine-König
  2010-11-20 22:59     ` David Brownell
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2010-11-20 21:48 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: linux-arm-kernel, Patrice Vilchez, Nicolas Ferre,
	spi-devel-general, linux-kernel

Hello,

[adding spi-devel-general and lkml to Cc:]

On Sat, Nov 20, 2010 at 11:08:53AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> passing argument 2 of 'dma_map_single' discards qualifiers from pointer target type
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  drivers/spi/atmel_spi.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
> index 154529a..2cf6abd 100644
> --- a/drivers/spi/atmel_spi.c
> +++ b/drivers/spi/atmel_spi.c
> @@ -352,8 +352,10 @@ atmel_spi_dma_map_xfer(struct atmel_spi *as, struct spi_transfer *xfer)
>  
>  	xfer->tx_dma = xfer->rx_dma = INVALID_DMA_ADDRESS;
>  	if (xfer->tx_buf) {
> +		void *nonconst_tx = (void *)xfer->tx_buf; /* shut up gcc */
> +
>  		xfer->tx_dma = dma_map_single(dev,
> -				(void *) xfer->tx_buf, xfer->len,
> +				nonconst_tx, xfer->len,
>  				DMA_TO_DEVICE);
Hmm, I wonder if this is the right approach to do this.  I'd prefer to
have something like:

	dma_map_single_to_device(struct device *, const void *, ...)

don't know if that's sensible though.

And I wonder about gcc that your patch makes a difference.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* Re: [PATCH 6/6] atmel_spi: fix warning In function 'atmel_spi_dma_map_xfer'
  2010-11-20 21:48   ` [PATCH 6/6] atmel_spi: fix warning In function 'atmel_spi_dma_map_xfer' Uwe Kleine-König
@ 2010-11-20 22:59     ` David Brownell
  2010-11-21  2:19       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 3+ messages in thread
From: David Brownell @ 2010-11-20 22:59 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD, Uwe Kleine-König
  Cc: Nicolas Ferre, Patrice Vilchez, linux-kernel, linux-arm-kernel,
	spi-devel-general



--- On Sat, 11/20/10, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> > +        void
> *nonconst_tx = (void *)xfer->tx_buf; /* shut up gcc */

Reads like a bad patch to me. Fix the bug,
don't just silence GCC.  Or at least use
a better comment mentioning a constness
cast problems).

- Dave

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

* Re: [PATCH 6/6] atmel_spi: fix warning In function 'atmel_spi_dma_map_xfer'
  2010-11-20 22:59     ` David Brownell
@ 2010-11-21  2:19       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-11-21  2:19 UTC (permalink / raw)
  To: David Brownell
  Cc: Nicolas Ferre, Patrice Vilchez, linux-kernel,
	Uwe Kleine-König, spi-devel-general, linux-arm-kernel

On 14:59 Sat 20 Nov     , David Brownell wrote:
> 
> 
> --- On Sat, 11/20/10, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> 
> > > +        void
> > *nonconst_tx = (void *)xfer->tx_buf; /* shut up gcc */
> 
> Reads like a bad patch to me. Fix the bug,
> don't just silence GCC.  Or at least use
> a better comment mentioning a constness
> cast problems).

ok I change the comment

Best Regards,
J.

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

end of thread, other threads:[~2010-11-21  2:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20101120095906.GD4216@game.jcrosoft.org>
     [not found] ` <1290247733-17834-6-git-send-email-plagnioj@jcrosoft.com>
2010-11-20 21:48   ` [PATCH 6/6] atmel_spi: fix warning In function 'atmel_spi_dma_map_xfer' Uwe Kleine-König
2010-11-20 22:59     ` David Brownell
2010-11-21  2:19       ` Jean-Christophe PLAGNIOL-VILLARD

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).