dmaengine: hisilicon: Fix CQ head update
[linux-2.6-microblaze.git] / drivers / dma / hisi_dma.c
index 98bc488..837f7e4 100644 (file)
@@ -436,12 +436,10 @@ static irqreturn_t hisi_dma_irq(int irq, void *data)
        desc = chan->desc;
        cqe = chan->cq + chan->cq_head;
        if (desc) {
+               chan->cq_head = (chan->cq_head + 1) % hdma_dev->chan_depth;
+               hisi_dma_chan_write(hdma_dev->base, HISI_DMA_CQ_HEAD_PTR,
+                                   chan->qp_num, chan->cq_head);
                if (FIELD_GET(STATUS_MASK, cqe->w0) == STATUS_SUCC) {
-                       chan->cq_head = (chan->cq_head + 1) %
-                                       hdma_dev->chan_depth;
-                       hisi_dma_chan_write(hdma_dev->base,
-                                           HISI_DMA_CQ_HEAD_PTR, chan->qp_num,
-                                           chan->cq_head);
                        vchan_cookie_complete(&desc->vd);
                } else {
                        dev_err(&hdma_dev->pdev->dev, "task error!\n");