mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: dan.j.williams@intel.com, linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, hong.xu@atmel.com,
	Nicolas Ferre <nicolas.ferre@atmel.com>
Subject: [PATCH 6/6] dmaengine: at_hdmac: fix race while monitoring channel status
Date: Wed, 12 Jan 2011 15:39:10 +0100	[thread overview]
Message-ID: <1294843150-6962-5-git-send-email-nicolas.ferre@atmel.com> (raw)
In-Reply-To: <1292435416-16927-1-git-send-email-nicolas.ferre@atmel.com>

We were reading channel status then taking a lock. This lead to a race because
this lock may delay us and then make this channel not idle anymore.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 99942a5..3d7d705 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -853,11 +853,11 @@ static void atc_issue_pending(struct dma_chan *chan)
 
 	dev_vdbg(chan2dev(chan), "issue_pending\n");
 
+	spin_lock_bh(&atchan->lock);
 	if (!atc_chan_is_enabled(atchan)) {
-		spin_lock_bh(&atchan->lock);
 		atc_advance_work(atchan);
-		spin_unlock_bh(&atchan->lock);
 	}
+	spin_unlock_bh(&atchan->lock);
 }
 
 /**
-- 
1.7.3


      parent reply	other threads:[~2011-01-12 13:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-15 17:50 [PATCH] dmaengine: at_hdmac: use dma_address to program DMA hardware Nicolas Ferre
2011-01-10 13:21 ` Nicolas Ferre
2011-01-15  0:14   ` Dan Williams
2011-01-12 14:39 ` [PATCH 2/6] dmaengine: at_hdmac: trivial add precision to unmapping comment Nicolas Ferre
2011-01-12 14:39 ` [PATCH 3/6] dmaengine: at_hdmac: no need set ACK in new descriptor Nicolas Ferre
2011-01-12 14:39 ` [PATCH 4/6] dmaengine: at_hdmac: use subsys_initcall instead of module_init Nicolas Ferre
2011-01-15  0:27   ` Dan Williams
2011-01-12 14:39 ` [PATCH 5/6] dmaengine: at_hdmac: flags located in first descriptor Nicolas Ferre
2011-01-12 14:39 ` Nicolas Ferre [this message]

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=1294843150-6962-5-git-send-email-nicolas.ferre@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=dan.j.williams@intel.com \
    --cc=hong.xu@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®