Linux Kernels

mmc: sh-mmcif: reset DMA completion immediately before starting DMA

This change “mmc: sh-mmcif: reset DMA completion immediately before starting DMA” (commit 1fcfebf) in Linux kernel is authored by Guennadi Liakhovetski <g.liakhovetski [at] gmx.de> on Wed Dec 12 15:38:16 2012 +0100.

Description of "mmc: sh-mmcif: reset DMA completion immediately before starting DMA"

The change “mmc: sh-mmcif: reset DMA completion immediately before starting DMA” introduces changes as follows.

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>

Linux kernel releases containing commit 1fcfebf

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "mmc: sh-mmcif: reset DMA completion immediately before starting DMA"

There are 8 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/mmc/host/sh_mmcif.c | 8 ++++++--
 1 file 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,
 	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);

The commit for this change in Linux stable tree is 1fcfebf (patch).

Last modified: 2020/01/11 09:35