[PATCH v5 07/10] dmaengine: dw: report residue for queued transfers
From: James Hilliard
Date: Mon Nov 02 2026 - 16:37:17 EST
A submitted transfer may still be queued behind the active transaction.
dwc_find_desc() only searches the active list, so a status query reports
zero residue for the queued cookie even though none of its data has been
transferred.
Search the queue as well. The status getter already reports total_len for
a descriptor that is not the active transaction, giving queued transfers
their full remaining length.
Fixes: 3bfb1d20b547 ("dmaengine: Driver for the Synopsys DesignWare DMA controller")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: James Hilliard <james.hilliard1@xxxxxxxxx>
---
Changelog RFC:
- Instead of just dropping the dwc_scan_descriptors() method invocation
calculate the residue in the Tx-status getter.
---
drivers/dma/dw/core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index e198c9f45f0b..0fd49ff9257f 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -901,6 +901,10 @@ static struct dw_desc *dwc_find_desc(struct dw_dma_chan *dwc, dma_cookie_t c)
if (desc->txd.cookie == c)
return desc;
+ list_for_each_entry(desc, &dwc->queue, desc_node)
+ if (desc->txd.cookie == c)
+ return desc;
+
return NULL;
}
--
2.53.0