public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Huang Shijie <shijie8@gmail.com>
To: vinod.koul@linux.intel.com
Cc: linux@arm.linux.org.uk, samgandhi9@gmail.com,
	w.sang@pengutronix.de, linux-mtd@lists.infradead.org,
	Huang Shijie <shijie8@gmail.com>,
	shawn.guo@linaro.org, festevam@gmail.com,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mxs-dma : assign the dma cookie before we enable the dma channel
Date: Sat,  7 Apr 2012 01:29:35 -0400	[thread overview]
Message-ID: <1333776575-3462-1-git-send-email-shijie8@gmail.com> (raw)

The dma chain may finished very fast, so an interrupt may arises before
we assign the dma cookie. In this case, the mxs_dma_int_handler() may
hit the BUG_ON() in dma_cookie_complete().

So assign the dma cookie before we enable the dma channel.

Acked-by: Sam Gandhi <samgandhi9@gmail.com>
Signed-off-by: Huang Shijie <shijie8@gmail.com>
---
 drivers/dma/mxs-dma.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index a1e2d00..1e16d0e 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -210,10 +210,12 @@ static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
 static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx)
 {
 	struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(tx->chan);
+	dma_cookie_t cookie;
 
+	cookie = dma_cookie_assign(tx);
 	mxs_dma_enable_chan(mxs_chan);
 
-	return dma_cookie_assign(tx);
+	return cookie;
 }
 
 static void mxs_dma_tasklet(unsigned long data)
-- 
1.7.4.4

             reply	other threads:[~2012-04-07  5:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-07  5:29 Huang Shijie [this message]
2012-04-07  8:14 ` [PATCH] mxs-dma : assign the dma cookie before we enable the dma channel Shawn Guo
2012-04-07 16:36   ` Vinod Koul

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=1333776575-3462-1-git-send-email-shijie8@gmail.com \
    --to=shijie8@gmail.com \
    --cc=festevam@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=samgandhi9@gmail.com \
    --cc=shawn.guo@linaro.org \
    --cc=vinod.koul@linux.intel.com \
    --cc=w.sang@pengutronix.de \
    /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