Skip to content

Commit

Permalink
dma/hisilicon: fix index returned when no DMA completed
Browse files Browse the repository at this point in the history
[ upstream commit 2301dee ]

If no DMA request is completed, the ring_idx of the last completed
operation need returned by last_idx parameter. This patch fixes it.

Fixes: 2db4f0b ("dma/hisilicon: add data path")

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
  • Loading branch information
fengchengwen authored and kevintraynor committed Jun 8, 2022
1 parent 6681d13 commit 2f31401
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/dma/hisilicon/hisi_dmadev.c
Expand Up @@ -649,12 +649,12 @@ hisi_dma_completed(void *dev_private,
}
sq_head = (sq_head + 1) & hw->sq_depth_mask;
}
*last_idx = hw->cridx + i - 1;
if (i > 0) {
hw->cridx += i;
*last_idx = hw->cridx - 1;
hw->sq_head = sq_head;
hw->completed += i;
}
hw->completed += i;

return i;
}
Expand Down Expand Up @@ -708,12 +708,12 @@ hisi_dma_completed_status(void *dev_private,
hw->status[sq_head] = HISI_DMA_STATUS_SUCCESS;
sq_head = (sq_head + 1) & hw->sq_depth_mask;
}
*last_idx = hw->cridx + cpl_num - 1;
if (likely(cpl_num > 0)) {
hw->cridx += cpl_num;
*last_idx = hw->cridx - 1;
hw->sq_head = sq_head;
hw->completed += cpl_num;
}
hw->completed += cpl_num;

return cpl_num;
}
Expand Down

0 comments on commit 2f31401

Please sign in to comment.