aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2011-02-10 10:08:16 -0500
committerChris Ball <cjb@laptop.org>2011-03-15 13:49:05 -0400
commit88ce4db313bca1e4e6ef3b448471f85d3e14a854 (patch)
tree1d028208211c7dc7af14a79828494ade9c97cf5d
parent266ac3f297adb72fb6c34949a38337c6fad4c7a6 (diff)
mmc: atmel-mci: conform to DMA-API
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> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/host/atmel-mci.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 045bdbbe3720..df5a13542370 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)
687 687
688 sglen = dma_map_sg(chan->device->dev, data->sg, 688 sglen = dma_map_sg(chan->device->dev, data->sg,
689 data->sg_len, direction); 689 data->sg_len, direction);
690 if (sglen != data->sg_len) 690
691 goto unmap_exit;
692 desc = chan->device->device_prep_slave_sg(chan, 691 desc = chan->device->device_prep_slave_sg(chan,
693 data->sg, data->sg_len, direction, 692 data->sg, sglen, direction,
694 DMA_PREP_INTERRUPT | DMA_CTRL_ACK); 693 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
695 if (!desc) 694 if (!desc)
696 goto unmap_exit; 695 goto unmap_exit;
@@ -701,7 +700,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
701 700
702 return 0; 701 return 0;
703unmap_exit: 702unmap_exit:
704 dma_unmap_sg(chan->device->dev, data->sg, sglen, direction); 703 dma_unmap_sg(chan->device->dev, data->sg, data->sg_len, direction);
705 return -ENOMEM; 704 return -ENOMEM;
706} 705}
707 706