@@ -836,6 +836,8 @@ int cpdma_chan_stop(struct cpdma_chan *chan)
/* trigger teardown */
dma_reg_write(ctlr, chan->td, chan_linear(chan));
+ spin_unlock_irqrestore(&chan->lock, flags);
+
/* wait for teardown complete */
timeout = jiffies + HZ/10; /* 100 msec */
while (time_before(jiffies, timeout)) {
@@ -845,6 +847,8 @@ int cpdma_chan_stop(struct cpdma_chan *chan)
cpu_relax();
}
WARN_ON(!time_before(jiffies, timeout));
+
+ spin_lock_irqsave(&chan->lock, flags);
chan_write(chan, cp, CPDMA_TEARDOWN_VALUE);
/* handle completed packets */