[PATCH 1/3] dmaengine: ti: k3-udma: Correct completed descriptor's residue value

From: Peter Ujfalusi
Date: Mon Dec 02 2019 - 15:31:45 EST


The residue should show the number of _not_ completed bytes, so it has to
be 0 when the full transfer is completed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxx>
---
drivers/dma/ti/k3-udma.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index c1450b0a8224..1b929f7a84d4 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -2784,13 +2784,14 @@ static void udma_desc_pre_callback(struct virt_dma_chan *vc,

if (cppi5_desc_get_type(desc_vaddr) ==
CPPI5_INFO0_DESC_TYPE_VAL_HOST) {
- result->residue = cppi5_hdesc_get_pktlen(desc_vaddr);
- if (result->residue == d->residue)
- result->result = DMA_TRANS_NOERROR;
- else
+ result->residue = d->residue -
+ cppi5_hdesc_get_pktlen(desc_vaddr);
+ if (result->residue)
result->result = DMA_TRANS_ABORTED;
+ else
+ result->result = DMA_TRANS_NOERROR;
} else {
- result->residue = d->residue;
+ result->residue = 0;
result->result = DMA_TRANS_NOERROR;
}
}
--
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki