Skip to content

Commit

Permalink
dmaengine: qcom: bam_dma: Fix completed descriptors count
Browse files Browse the repository at this point in the history
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: [email protected]
Reported-by: Srinivas Kandagatla <[email protected]>
Signed-off-by: Sricharan R <[email protected]>
Tested-by: Srinivas Kandagatla <[email protected]>
Signed-off-by: Vinod Koul <[email protected]>
  • Loading branch information
Sricharan R authored and vinodkoul committed Jul 5, 2019
1 parent 3f93a4f commit f603422
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/dma/qcom/bam_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit f603422

Please sign in to comment.