dmaengine: tegra186: Fix residual calculation
authorAkhil R <akhilrajeev@nvidia.com>
Fri, 15 Mar 2024 12:44:11 +0000 (18:14 +0530)
committerVinod Koul <vkoul@kernel.org>
Thu, 28 Mar 2024 07:01:42 +0000 (12:31 +0530)
commit30f0ced9971b2d8c8c24ae75786f9079489a012d
treed184f6052fdde008d985acd3f226bcfa9152acca
parent43c633ef93a5d293c96ebcedb40130df13128428
dmaengine: tegra186: Fix residual calculation

The existing residual calculation returns an incorrect value when
bytes_xfer == bytes_req. This scenario occurs particularly with drivers
like UART where DMA is scheduled for maximum number of bytes and is
terminated when the bytes inflow stops. At higher baud rates, it could
request the tx_status while there is no bytes left to transfer. This will
lead to incorrect residual being set. Hence return residual as '0' when
bytes transferred equals to the bytes requested.

Fixes: ee17028009d4 ("dmaengine: tegra: Add tegra gpcdma driver")
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20240315124411.17582-1-akhilrajeev@nvidia.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/tegra186-gpc-dma.c