]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
mmc: sh_mmcif: reset DMA completion immediately before starting DMA
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Wed, 12 Dec 2012 14:38:16 +0000 (15:38 +0100)
committerChris Ball <cjb@laptop.org>
Mon, 11 Feb 2013 18:28:35 +0000 (13:28 -0500)
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>
drivers/mmc/host/sh_mmcif.c

index 14fafafc12d38606e8b0b60458d4b3983de63dd6..1c37854c0f33840fd0828d2426457da387b0cf78 100644 (file)
@@ -419,8 +419,6 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
        if (ret < 0)
                goto ecfgrx;
 
-       init_completion(&host->dma_complete);
-
        return;
 
 ecfgrx:
@@ -1061,6 +1059,12 @@ static bool sh_mmcif_end_cmd(struct sh_mmcif_host *host)
        if (!data)
                return false;
 
+       /*
+        * Completion can be signalled from DMA callback and error, so, have to
+        * reset here, before setting .dma_active
+        */
+       init_completion(&host->dma_complete);
+
        if (data->flags & MMC_DATA_READ) {
                if (host->chan_rx)
                        sh_mmcif_start_dma_rx(host);