summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSricharan R <sricharan@codeaurora.org>2019-06-28 15:09:46 +0300
committerVinod Koul <vkoul@kernel.org>2019-07-05 10:48:27 +0300
commitf6034225442c4a87906d36e975fd9e99a8f95487 (patch)
tree10b9387054c280c946bbe8c504a6441e71e73b75
parent3f93a4f297961c12bb17aa16cb3a4d1291823cae (diff)
downloadlinux-f6034225442c4a87906d36e975fd9e99a8f95487.tar.xz
dmaengine: qcom: bam_dma: Fix completed descriptors count
One space is left unused in circular FIFO to differentiate 'full' and 'empty' cases. So take that in to account while counting for the descriptors completed. Fixes the issue reported here, https://lkml.org/lkml/2019/6/18/669 Cc: stable@vger.kernel.org Reported-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Vinod Koul <vkoul@kernel.org>
-rw-r--r--drivers/dma/qcom/bam_dma.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 4b43844f6af5..8e90a405939d 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -799,6 +799,9 @@ static u32 process_channel_irqs(struct bam_device *bdev)
/* Number of bytes available to read */
avail = CIRC_CNT(offset, bchan->head, MAX_DESCRIPTORS + 1);
+ if (offset < bchan->head)
+ avail--;
+
list_for_each_entry_safe(async_desc, tmp,
&bchan->desc_list, desc_node) {
/* Not enough data to read */