All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi: rspi: use correct enum for DMA transfer direction
@ 2018-03-19 21:42 Stefan Agner
  2018-03-19 22:14 ` Stefan Agner
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Agner @ 2018-03-19 21:42 UTC (permalink / raw)
  To: broonie; +Cc: geert+renesas, linux-spi, linux-kernel, Stefan Agner

Use enum dma_transfer_direction as required by dmaengine_prep_slave_sg
instead of enum dma_data_direction.

This fixes two warnings when building with clang:
  drivers/spi/spi-rspi.c:538:26: warning: implicit conversion from enumeration
      type 'enum dma_data_direction' to different enumeration type
      'enum dma_transfer_direction' [-Wenum-conversion]
                                        rx->sgl, rx->nents, DMA_FROM_DEVICE,
                                                            ^~~~~~~~~~~~~~~
  drivers/spi/spi-rspi.c:558:26: warning: implicit conversion from enumeration
      type 'enum dma_data_direction' to different enumeration type
      'enum dma_transfer_direction' [-Wenum-conversion]
                                        tx->sgl, tx->nents, DMA_TO_DEVICE,
                                                            ^~~~~~~~~~~~~

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 drivers/spi/spi-rspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index 0835a8d88fb8..3e5a31d338fe 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -535,7 +535,7 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx,
 	/* First prepare and submit the DMA request(s), as this may fail */
 	if (rx) {
 		desc_rx = dmaengine_prep_slave_sg(rspi->master->dma_rx,
-					rx->sgl, rx->nents, DMA_FROM_DEVICE,
+					rx->sgl, rx->nents, DMA_MEM_TO_DEV,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 		if (!desc_rx) {
 			ret = -EAGAIN;
@@ -555,7 +555,7 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx,
 
 	if (tx) {
 		desc_tx = dmaengine_prep_slave_sg(rspi->master->dma_tx,
-					tx->sgl, tx->nents, DMA_TO_DEVICE,
+					tx->sgl, tx->nents, DMA_DEV_TO_MEM,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 		if (!desc_tx) {
 			ret = -EAGAIN;
-- 
2.16.2

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

* Re: [PATCH] spi: rspi: use correct enum for DMA transfer direction
  2018-03-19 21:42 [PATCH] spi: rspi: use correct enum for DMA transfer direction Stefan Agner
@ 2018-03-19 22:14 ` Stefan Agner
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Agner @ 2018-03-19 22:14 UTC (permalink / raw)
  To: broonie; +Cc: geert+renesas, linux-spi, linux-kernel

On 19.03.2018 22:42, Stefan Agner wrote:
> Use enum dma_transfer_direction as required by dmaengine_prep_slave_sg
> instead of enum dma_data_direction.
> 
> This fixes two warnings when building with clang:
>   drivers/spi/spi-rspi.c:538:26: warning: implicit conversion from enumeration
>       type 'enum dma_data_direction' to different enumeration type
>       'enum dma_transfer_direction' [-Wenum-conversion]
>                                         rx->sgl, rx->nents, DMA_FROM_DEVICE,
>                                                             ^~~~~~~~~~~~~~~
>   drivers/spi/spi-rspi.c:558:26: warning: implicit conversion from enumeration
>       type 'enum dma_data_direction' to different enumeration type
>       'enum dma_transfer_direction' [-Wenum-conversion]
>                                         tx->sgl, tx->nents, DMA_TO_DEVICE,
>                                                             ^~~~~~~~~~~~~
> 

Please ignore this patch, I managed to mix up the direction. Will send a
v2.

--
Stefan

> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
>  drivers/spi/spi-rspi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
> index 0835a8d88fb8..3e5a31d338fe 100644
> --- a/drivers/spi/spi-rspi.c
> +++ b/drivers/spi/spi-rspi.c
> @@ -535,7 +535,7 @@ static int rspi_dma_transfer(struct rspi_data
> *rspi, struct sg_table *tx,
>  	/* First prepare and submit the DMA request(s), as this may fail */
>  	if (rx) {
>  		desc_rx = dmaengine_prep_slave_sg(rspi->master->dma_rx,
> -					rx->sgl, rx->nents, DMA_FROM_DEVICE,
> +					rx->sgl, rx->nents, DMA_MEM_TO_DEV,
>  					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
>  		if (!desc_rx) {
>  			ret = -EAGAIN;
> @@ -555,7 +555,7 @@ static int rspi_dma_transfer(struct rspi_data
> *rspi, struct sg_table *tx,
>  
>  	if (tx) {
>  		desc_tx = dmaengine_prep_slave_sg(rspi->master->dma_tx,
> -					tx->sgl, tx->nents, DMA_TO_DEVICE,
> +					tx->sgl, tx->nents, DMA_DEV_TO_MEM,
>  					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
>  		if (!desc_tx) {
>  			ret = -EAGAIN;

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

end of thread, other threads:[~2018-03-19 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-19 21:42 [PATCH] spi: rspi: use correct enum for DMA transfer direction Stefan Agner
2018-03-19 22:14 ` Stefan Agner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.