Patch "dmaengine: tegra186: Fix residual calculation" has been added to the 6.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    dmaengine: tegra186: Fix residual calculation

to the 6.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     dmaengine-tegra186-fix-residual-calculation.patch
and it can be found in the queue-6.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3ac245bebc257371d5218d580e58a4665a9c20d8
Author: Akhil R <akhilrajeev@xxxxxxxxxx>
Date:   Fri Mar 15 18:14:11 2024 +0530

    dmaengine: tegra186: Fix residual calculation
    
    [ Upstream commit 30f0ced9971b2d8c8c24ae75786f9079489a012d ]
    
    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@xxxxxxxxxx>
    Reviewed-by: Jon Hunter <jonathanh@xxxxxxxxxx>
    Acked-by: Thierry Reding <treding@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240315124411.17582-1-akhilrajeev@xxxxxxxxxx
    Signed-off-by: Vinod Koul <vkoul@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c
index 88547a23825b1..3642508e88bb2 100644
--- a/drivers/dma/tegra186-gpc-dma.c
+++ b/drivers/dma/tegra186-gpc-dma.c
@@ -746,6 +746,9 @@ static int tegra_dma_get_residual(struct tegra_dma_channel *tdc)
 	bytes_xfer = dma_desc->bytes_xfer +
 		     sg_req[dma_desc->sg_idx].len - (wcount * 4);
 
+	if (dma_desc->bytes_req == bytes_xfer)
+		return 0;
+
 	residual = dma_desc->bytes_req - (bytes_xfer % dma_desc->bytes_req);
 
 	return residual;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux