linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/03] omap hsmmc: prevent race between dma and hsmmc callback
@ 2010-03-10 14:11 Venkatraman S
  2010-03-10 14:27 ` Shilimkar, Santosh
  2010-08-27 19:37 ` Chris Ball
  0 siblings, 2 replies; 8+ messages in thread
From: Venkatraman S @ 2010-03-10 14:11 UTC (permalink / raw)
  To: linux-arm-kernel

See previous post http://patchwork.kernel.org/patch/82907/
Rebased to 2.6.34-rc1 and fixed comment alignment.

CC: Adrian Hunter <adrian.hunter@nokia.com>
CC: Madhusudhan C <madhu.cr@ti.com>
CC: Tony Lindgren <tony@atomide.com>
Signed-off-by: Venkatraman S <svenkatr@ti.com>
---
 drivers/mmc/host/omap_hsmmc.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 83f0aff..ea2a082 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1046,8 +1046,18 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)

 	if (end_cmd || ((status & CC) && host->cmd))
 		omap_hsmmc_cmd_done(host, host->cmd);
-	if ((end_trans || (status & TC)) && host->mrq)
+	if ((end_trans || (status & TC)) && host->mrq) {
 		omap_hsmmc_xfer_done(host, data);
+		if (host->dma_ch != -1) {
+			omap_free_dma(host->dma_ch);
+			host->dma_ch = -1;
+			/*
+			 * Callback: run in interrupt context.
+			 * mutex_unlock will throw a kernel warning if used.
+			 */
+			up(&host->sem);
+		}
+	}

 	spin_unlock(&host->irq_lock);

@@ -1267,13 +1277,6 @@ static void omap_hsmmc_dma_cb(int lch, u16
ch_status, void *data)
 		return;
 	}

-	omap_free_dma(host->dma_ch);
-	host->dma_ch = -1;
-	/*
-	 * DMA Callback: run in interrupt context.
-	 * mutex_unlock will throw a kernel warning if used.
-	 */
-	up(&host->sem);
 }

 /*
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH 01/03] omap hsmmc: prevent race between dma and hsmmc callback
@ 2010-03-01 11:25 Venkatraman S
  2010-03-01 12:44 ` Sergei Shtylyov
  2010-03-10 16:47 ` Madhusudhan
  0 siblings, 2 replies; 8+ messages in thread
From: Venkatraman S @ 2010-03-01 11:25 UTC (permalink / raw)
  To: linux-arm-kernel

It is observed that sometimes the MMC Transfer Complete (TC) is not
received when DMA completion callback is processed (or takes too long
to process)
This patch moves the releasing of DMA channel from dma callback to the
mmc transfer complete handler.
This is observed consistently when descriptor loading is used (see the
rest of the series)

Signed-off-by: Venkatraman S <svenkatr@ti.com>
---
 drivers/mmc/host/omap_hsmmc.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 83f0aff..06337f6 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1046,8 +1046,18 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)

 	if (end_cmd || ((status & CC) && host->cmd))
 		omap_hsmmc_cmd_done(host, host->cmd);
-	if ((end_trans || (status & TC)) && host->mrq)
+	if ((end_trans || (status & TC)) && host->mrq) {
 		omap_hsmmc_xfer_done(host, data);
+		if (host->dma_ch != -1) {
+			omap_free_dma(host->dma_ch);
+			host->dma_ch = -1;
+		/*
+		 * Callback: run in interrupt context.
+		 * mutex_unlock will throw a kernel warning if used.
+		 */
+			up(&host->sem);
+		}
+	}

 	spin_unlock(&host->irq_lock);

@@ -1267,13 +1277,6 @@ static void omap_hsmmc_dma_cb(int lch, u16
ch_status, void *data)
 		return;
 	}

-	omap_free_dma(host->dma_ch);
-	host->dma_ch = -1;
-	/*
-	 * DMA Callback: run in interrupt context.
-	 * mutex_unlock will throw a kernel warning if used.
-	 */
-	up(&host->sem);
 }

 /*
-- 
1.6.3.3

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

end of thread, other threads:[~2010-08-27 19:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-10 14:11 [PATCH 01/03] omap hsmmc: prevent race between dma and hsmmc callback Venkatraman S
2010-03-10 14:27 ` Shilimkar, Santosh
2010-03-10 15:20   ` Venkatraman S
2010-03-10 17:07     ` Kevin Hilman
2010-08-27 19:37 ` Chris Ball
  -- strict thread matches above, loose matches on Subject: below --
2010-03-01 11:25 Venkatraman S
2010-03-01 12:44 ` Sergei Shtylyov
2010-03-10 16:47 ` Madhusudhan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).