diff mbox

mxs-dma : assign the dma cookie before we enable the dma channel

Message ID 1333776575-3462-1-git-send-email-shijie8@gmail.com
State New, archived
Headers show

Commit Message

Huang Shijie April 7, 2012, 5:29 a.m. UTC
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(-)

Comments

Shawn Guo April 7, 2012, 8:14 a.m. UTC | #1
On Sat, Apr 07, 2012 at 01:29:35AM -0400, Huang Shijie wrote:
> 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>

Acked-by: Shawn Guo <shawn.guo@linaor.org>

The mxs mmc and audio still works with the change.
Vinod Koul April 7, 2012, 4:36 p.m. UTC | #2
On Sat, 2012-04-07 at 16:14 +0800, Shawn Guo wrote:
> On Sat, Apr 07, 2012 at 01:29:35AM -0400, Huang Shijie wrote:
> > 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>
> 
> Acked-by: Shawn Guo <shawn.guo@linaor.org>
> 
> The mxs mmc and audio still works with the change.
> 
Thanks, I will apply this on 4/18.
I am away till then :-)
diff mbox

Patch

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)