aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2012-12-12 09:38:16 -0500
committerChris Ball <cjb@laptop.org>2013-02-11 13:28:35 -0500
commit90f1cb438e33bb88036649665c2165155561b54f (patch)
tree9bf9984f13bd4ceedd6acea51d62a1abc826f8f4
parentaba9d646785c8b1decb1a15ee157b0179a15bef9 (diff)
mmc: sh_mmcif: reset DMA completion immediately before starting DMA
DMA completion can be signalled from the DMA callback and from the error handler. If both are called, the completion struct can enter an inconsistent state. To prevent this move completion initialisation immediately before activating DMA. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/host/sh_mmcif.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 14fafafc12d3..1c37854c0f33 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -419,8 +419,6 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
419 if (ret < 0) 419 if (ret < 0)
420 goto ecfgrx; 420 goto ecfgrx;
421 421
422 init_completion(&host->dma_complete);
423
424 return; 422 return;
425 423
426ecfgrx: 424ecfgrx:
@@ -1061,6 +1059,12 @@ static bool sh_mmcif_end_cmd(struct sh_mmcif_host *host)
1061 if (!data) 1059 if (!data)
1062 return false; 1060 return false;
1063 1061
1062 /*
1063 * Completion can be signalled from DMA callback and error, so, have to
1064 * reset here, before setting .dma_active
1065 */
1066 init_completion(&host->dma_complete);
1067
1064 if (data->flags & MMC_DATA_READ) { 1068 if (data->flags & MMC_DATA_READ) {
1065 if (host->chan_rx) 1069 if (host->chan_rx)
1066 sh_mmcif_start_dma_rx(host); 1070 sh_mmcif_start_dma_rx(host);