dmaengine: qcom: bam_dma: Fix completed descriptors count
diff mbox series

Message ID 1561723786-22500-1-git-send-email-sricharan@codeaurora.org
State Accepted
Commit f6034225442c4a87906d36e975fd9e99a8f95487
Headers show
Series
  • dmaengine: qcom: bam_dma: Fix completed descriptors count
Related show

Commit Message

Sricharan R June 28, 2019, 12:09 p.m. UTC
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>
---
 drivers/dma/qcom/bam_dma.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Srinivas Kandagatla June 28, 2019, 12:26 p.m. UTC | #1
On 28/06/2019 13:09, Sricharan R wrote:
> 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>

Thanks for the patch, It works for me now!

Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

--srini

> ---
>   drivers/dma/qcom/bam_dma.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
> index 4b43844..8e90a40 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 */
>
Vinod Koul July 5, 2019, 7:49 a.m. UTC | #2
On 28-06-19, 17:39, Sricharan R wrote:
> 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

Applied, thanks

Patch
diff mbox series

diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 4b43844..8e90a40 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 */