Skip to content

Commit

Permalink
dma/imx-sdma: save irq flags when use spin_lock in sdma_tx_submit
Browse files Browse the repository at this point in the history
mx53_loco: fix deadlock report from sdma_tx_submit() during boot

BugLink: http://bugs.launchpad.net/bugs/878701

Adjust to use spin_lock_irqsave()/spin_unlock_irqresotre(), so to
make it safe when called from interrupt context.

Signed-off-by: Haitao Zhang <haitao.zhang@linaro.org>
Signed-off-by: Eric Miao <eric.miao@linaro.org>
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
  • Loading branch information
Haitao Zhang authored and Vinod Koul committed Jan 6, 2012
1 parent e9f3a49 commit f69f2e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/dma/imx-sdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,17 +836,18 @@ static struct sdma_channel *to_sdma_chan(struct dma_chan *chan)

static dma_cookie_t sdma_tx_submit(struct dma_async_tx_descriptor *tx)
{
unsigned long flags;
struct sdma_channel *sdmac = to_sdma_chan(tx->chan);
struct sdma_engine *sdma = sdmac->sdma;
dma_cookie_t cookie;

spin_lock_irq(&sdmac->lock);
spin_lock_irqsave(&sdmac->lock, flags);

cookie = sdma_assign_cookie(sdmac);

sdma_enable_channel(sdma, sdmac->channel);

spin_unlock_irq(&sdmac->lock);
spin_unlock_irqrestore(&sdmac->lock, flags);

return cookie;
}
Expand Down

0 comments on commit f69f2e2

Please sign in to comment.