]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dmaengine: dw-axi-dmac: use sg_nents_for_dma() helper
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 8 Jan 2026 10:50:16 +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>
Link: https://patch.msgid.link/20260108105619.3513561-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c

index b23536645ff7ccb59fa1363f500f742a41b7631f..493c2a32b0fe126d0729340461a00f63cf0c9636 100644 (file)
@@ -850,7 +850,7 @@ dw_axi_dma_chan_prep_slave_sg(struct dma_chan *dchan, struct scatterlist *sgl,
        unsigned int loop = 0;
        struct scatterlist *sg;
        size_t axi_block_len;
-       u32 len, num_sgs = 0;
+       u32 len, num_sgs;
        unsigned int i;
        dma_addr_t mem;
        int status;
@@ -867,9 +867,7 @@ dw_axi_dma_chan_prep_slave_sg(struct dma_chan *dchan, struct scatterlist *sgl,
        if (axi_block_len == 0)
                return NULL;
 
-       for_each_sg(sgl, sg, sg_len, i)
-               num_sgs += DIV_ROUND_UP(sg_dma_len(sg), axi_block_len);
-
+       num_sgs = sg_nents_for_dma(sgl, sg_len, axi_block_len);
        desc = axi_desc_alloc(num_sgs);
        if (unlikely(!desc))
                goto err_desc_get;