public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix race condition in omap_request_dma()
@ 2009-10-30  3:30 HU TAO-TGHK48
  2009-10-30 17:22 ` Venkatraman S
  0 siblings, 1 reply; 8+ messages in thread
From: HU TAO-TGHK48 @ 2009-10-30  3:30 UTC (permalink / raw)
  To: linux-omap, Tony Lindgren
  Cc: Yang Fei-AFY095, jon-hunter, Zhou Ming-a17711, Ye Yuan.Bo-A22116

>From a36dac7ee6140ffa23f0adc024964aaf3e266e5f Mon Sep 17 00:00:00 2001
From: Tao Hu <taohu@motorola.com>
Date: Thu, 29 Oct 2009 17:17:21 -0500
Subject: [PATCH] Fix race condition in omap_request_dma()

The bug could cause irq enable bit of one DMA channel is
cleared unexpectedly when 2 (or more) drivers are calling
omap_request_dma() simultaneously

Signed-off-by: Fei Yang <AFY095@motorola.com>
Signed-off-by: Tao Hu  <taohu@motorola.com>
---
 arch/arm/plat-omap/dma.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index cd53b28..6895484 100755
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -749,11 +749,13 @@ int omap_request_dma(int dev_id, const char
*dev_name,
 	}
 
 	if (cpu_class_is_omap2()) {
+		spin_lock_irqsave(&dma_chan_lock, flags);
 		omap2_enable_irq_lch(free_ch);
 		omap_enable_channel_irq(free_ch);
 		/* Clear the CSR register and IRQ status register */
 		dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(free_ch));
 		dma_write(1 << free_ch, IRQSTATUS_L0);
+		spin_unlock_irqrestore(&dma_chan_lock, flags);
 	}
 
 	*dma_ch_out = free_ch;
-- 
1.5.4.3



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

end of thread, other threads:[~2009-11-10  0:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-30  3:30 [PATCH] Fix race condition in omap_request_dma() HU TAO-TGHK48
2009-10-30 17:22 ` Venkatraman S
2009-10-30 21:33   ` HU TAO-TGHK48
2009-11-05 19:15     ` HU TAO-TGHK48
2009-11-06 12:22       ` Venkatraman S
2009-11-06 16:45         ` HU TAO-TGHK48
2009-11-10  0:40           ` Tony Lindgren
2009-11-10  0:31     ` [APPLIED] >> > > " Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox