]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dmaengine: axi-dmac: use sg_nents_for_dma() helper
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 8 Jan 2026 10:50:14 +0000 (11:50 +0100)
committerVinod Koul <vkoul@kernel.org>
Fri, 9 Jan 2026 03:06:00 +0000 (08:36 +0530)
Instead of open coded variant let's use recently introduced helper.

Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20260108105619.3513561-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/dma-axi-dmac.c

index 045e9b9a90df562073c078835584a23f26d47350..f5caf75dc0e7801e417bc1becdf2dbdf146b2cdd 100644 (file)
@@ -677,10 +677,7 @@ static struct dma_async_tx_descriptor *axi_dmac_prep_slave_sg(
        if (direction != chan->direction)
                return NULL;
 
-       num_sgs = 0;
-       for_each_sg(sgl, sg, sg_len, i)
-               num_sgs += DIV_ROUND_UP(sg_dma_len(sg), chan->max_length);
-
+       num_sgs = sg_nents_for_dma(sgl, sg_len, chan->max_length);
        desc = axi_dmac_alloc_desc(chan, num_sgs);
        if (!desc)
                return NULL;