Skip to contentSkip to conversation

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

PATCH New Huang Shijie 3 participants 3 messages Apr 7, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mxs-dma : assign the dma cookie before we enable the dma channel

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.

---
 drivers/dma/mxs-dma.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/dma/mxs-dma.c +3 -1
index a1e2d00..1e16d0e 100644
@@ -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)
Signature · 1 line
1.7.4.4
#1 lore raw

PATCH 1/1 mxs-dma : assign the dma cookie before we enable the dma channel

Quoted 8 lines · Huang Shijie

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.

The mxs mmc and audio still works with the change.

Signature · 2 lines
Regards,
Shawn
#2 lore raw

PATCH 1/1 mxs-dma : assign the dma cookie before we enable the dma channel

Quoted 5 lines · Shawn Guo
Quoted 4 lines · Huang Shijie

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().

Quoted 9 lines
Quoted 4 lines

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

The mxs mmc and audio still works with the change.

Thanks, I will apply this on 4/18.
I am away till then :-)

Signature · 1 line
~Vinod