From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Fei Yang <AFY095@motorola.com>,
linux-omap@vger.kernel.org, Tao Hu <taohu@motorola.com>
Subject: [PATCH 1/8] omap: Fix race condition in omap dma driver
Date: Tue, 10 Nov 2009 19:00:32 -0800 [thread overview]
Message-ID: <20091111030032.31793.59189.stgit@localhost> (raw)
In-Reply-To: <20091111025907.31793.84134.stgit@localhost>
From: Tao Hu <taohu@motorola.com>
The bug could cause irq enable bit of one DMA channel is
cleared/set unexpectedly when 2 (or more) drivers are calling
omap_request_dma()/omap_free_dma() simultaneously
Signed-off-by: Fei Yang <AFY095@motorola.com>
Signed-off-by: Tao Hu <taohu@motorola.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/plat-omap/dma.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index b53125f..02ed945 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -691,13 +691,16 @@ static inline void disable_lnk(int lch)
static inline void omap2_enable_irq_lch(int lch)
{
u32 val;
+ unsigned long flags;
if (!cpu_class_is_omap2())
return;
+ spin_lock_irqsave(&dma_chan_lock, flags);
val = dma_read(IRQENABLE_L0);
val |= 1 << lch;
dma_write(val, IRQENABLE_L0);
+ spin_unlock_irqrestore(&dma_chan_lock, flags);
}
int omap_request_dma(int dev_id, const char *dev_name,
@@ -799,10 +802,13 @@ void omap_free_dma(int lch)
if (cpu_class_is_omap2()) {
u32 val;
+
+ spin_lock_irqsave(&dma_chan_lock, flags);
/* Disable interrupts */
val = dma_read(IRQENABLE_L0);
val &= ~(1 << lch);
dma_write(val, IRQENABLE_L0);
+ spin_unlock_irqrestore(&dma_chan_lock, flags);
/* Clear the CSR register and IRQ status register */
dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(lch));
WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/8] omap: Fix race condition in omap dma driver
Date: Tue, 10 Nov 2009 19:00:32 -0800 [thread overview]
Message-ID: <20091111030032.31793.59189.stgit@localhost> (raw)
In-Reply-To: <20091111025907.31793.84134.stgit@localhost>
From: Tao Hu <taohu@motorola.com>
The bug could cause irq enable bit of one DMA channel is
cleared/set unexpectedly when 2 (or more) drivers are calling
omap_request_dma()/omap_free_dma() simultaneously
Signed-off-by: Fei Yang <AFY095@motorola.com>
Signed-off-by: Tao Hu <taohu@motorola.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/plat-omap/dma.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index b53125f..02ed945 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -691,13 +691,16 @@ static inline void disable_lnk(int lch)
static inline void omap2_enable_irq_lch(int lch)
{
u32 val;
+ unsigned long flags;
if (!cpu_class_is_omap2())
return;
+ spin_lock_irqsave(&dma_chan_lock, flags);
val = dma_read(IRQENABLE_L0);
val |= 1 << lch;
dma_write(val, IRQENABLE_L0);
+ spin_unlock_irqrestore(&dma_chan_lock, flags);
}
int omap_request_dma(int dev_id, const char *dev_name,
@@ -799,10 +802,13 @@ void omap_free_dma(int lch)
if (cpu_class_is_omap2()) {
u32 val;
+
+ spin_lock_irqsave(&dma_chan_lock, flags);
/* Disable interrupts */
val = dma_read(IRQENABLE_L0);
val &= ~(1 << lch);
dma_write(val, IRQENABLE_L0);
+ spin_unlock_irqrestore(&dma_chan_lock, flags);
/* Clear the CSR register and IRQ status register */
dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(lch));
next prev parent reply other threads:[~2009-11-11 3:00 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-11 3:00 [PATCH 0/8] Omap fixes for v2.6.32-rc6 Tony Lindgren
2009-11-11 3:00 ` Tony Lindgren
2009-11-11 3:00 ` Tony Lindgren [this message]
2009-11-11 3:00 ` [PATCH 1/8] omap: Fix race condition in omap dma driver Tony Lindgren
2009-11-11 3:00 ` [PATCH 2/8] omap: Use resource_size Tony Lindgren
2009-11-11 3:00 ` Tony Lindgren
2009-11-11 19:06 ` [PATCH 2.5/8] omap: Fix omapfb/lcdc on OMAP1510 broken when PM set Tony Lindgren
2009-11-11 19:06 ` Tony Lindgren
2009-11-11 3:00 ` [PATCH 3/8] omap1: Amstrad Delta defconfig fixes Tony Lindgren
2009-11-11 3:00 ` Tony Lindgren
2009-11-11 17:24 ` Janusz Krzysztofik
2009-11-11 17:24 ` Janusz Krzysztofik
2009-11-11 18:56 ` Tony Lindgren
2009-11-11 18:56 ` Tony Lindgren
2009-11-11 3:01 ` [PATCH 4/8] omap3: pandora: Fix keypad keymap Tony Lindgren
2009-11-11 3:01 ` Tony Lindgren
2009-11-11 3:01 ` [PATCH 5/8] omap3: beagle: Fix USB host port power control Tony Lindgren
2009-11-11 3:01 ` Tony Lindgren
2009-11-11 3:01 ` [PATCH 6/8] omap3: 3430sdp: Enable Linux Regulator framework Tony Lindgren
2009-11-11 3:01 ` Tony Lindgren
2009-11-11 3:01 ` [PATCH 7/8] omap: update Pandora defconfig Tony Lindgren
2009-11-11 3:01 ` Tony Lindgren
2009-11-11 3:01 ` [PATCH 8/8] omap3: Decrease cpufreq transition latency Tony Lindgren
2009-11-11 3:01 ` Tony Lindgren
2009-11-11 3:16 ` [PATCH 0/8] Omap fixes for v2.6.32-rc6 Sid Boyce
2009-11-11 19:08 ` Tony Lindgren
2009-11-11 23:20 ` Sid Boyce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091111030032.31793.59189.stgit@localhost \
--to=tony@atomide.com \
--cc=AFY095@motorola.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=taohu@motorola.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.