public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 02/11] atmel-mci: conform to DMA-API
@ 2011-02-10 15:08 Linus Walleij
  2011-02-10 15:18 ` Nicolas Ferre
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2011-02-10 15:08 UTC (permalink / raw)
  To: linux-mmc, Chris Ball; +Cc: Dan Williams, Nicolas Ferre, Linus Walleij

Fixes the following:
- It is perfectly legal for the dma_map_sg() to return fewer
  entries than were passed in.
- Supply the returned numer of (possibly coalesced) entries to
  the device_pre_slave_sg() function.
- Use the proper original sg_len when unmapping the sglist
  in the error path.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mmc/host/atmel-mci.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 045bdbb..df5a135 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -687,10 +687,9 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
 
 	sglen = dma_map_sg(chan->device->dev, data->sg,
 			   data->sg_len, direction);
-	if (sglen != data->sg_len)
-		goto unmap_exit;
+
 	desc = chan->device->device_prep_slave_sg(chan,
-			data->sg, data->sg_len, direction,
+			data->sg, sglen, direction,
 			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc)
 		goto unmap_exit;
@@ -701,7 +700,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
 
 	return 0;
 unmap_exit:
-	dma_unmap_sg(chan->device->dev, data->sg, sglen, direction);
+	dma_unmap_sg(chan->device->dev, data->sg, data->sg_len, direction);
 	return -ENOMEM;
 }
 
-- 
1.7.4


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

* Re: [PATCH 02/11] atmel-mci: conform to DMA-API
  2011-02-10 15:08 [PATCH 02/11] atmel-mci: conform to DMA-API Linus Walleij
@ 2011-02-10 15:18 ` Nicolas Ferre
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Ferre @ 2011-02-10 15:18 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-mmc, Chris Ball, Dan Williams

Le 10/02/2011 16:08, Linus Walleij :
> Fixes the following:
> - It is perfectly legal for the dma_map_sg() to return fewer
>   entries than were passed in.
> - Supply the returned numer of (possibly coalesced) entries to
>   the device_pre_slave_sg() function.
> - Use the proper original sg_len when unmapping the sglist
>   in the error path.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  drivers/mmc/host/atmel-mci.c |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 045bdbb..df5a135 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -687,10 +687,9 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
>  
>  	sglen = dma_map_sg(chan->device->dev, data->sg,
>  			   data->sg_len, direction);
> -	if (sglen != data->sg_len)
> -		goto unmap_exit;
> +
>  	desc = chan->device->device_prep_slave_sg(chan,
> -			data->sg, data->sg_len, direction,
> +			data->sg, sglen, direction,
>  			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
>  	if (!desc)
>  		goto unmap_exit;
> @@ -701,7 +700,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
>  
>  	return 0;
>  unmap_exit:
> -	dma_unmap_sg(chan->device->dev, data->sg, sglen, direction);
> +	dma_unmap_sg(chan->device->dev, data->sg, data->sg_len, direction);
>  	return -ENOMEM;
>  }
>  


-- 
Nicolas Ferre

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

end of thread, other threads:[~2011-02-10 15:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-10 15:08 [PATCH 02/11] atmel-mci: conform to DMA-API Linus Walleij
2011-02-10 15:18 ` Nicolas Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox