]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dmaengine: xilinx: xdma: use sg_nents_for_dma() helper
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 8 Jan 2026 10:50:24 +0000 (11:50 +0100)
committerVinod Koul <vkoul@kernel.org>
Fri, 9 Jan 2026 03:06:01 +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-14-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/xilinx/xdma.c

index 0d88b1a670e142dac90d09c515809faa2476a816..be6c22e1020ad3c39e5a00dc206d704c9b18f1c1 100644 (file)
@@ -605,13 +605,11 @@ xdma_prep_device_sg(struct dma_chan *chan, struct scatterlist *sgl,
        struct xdma_chan *xdma_chan = to_xdma_chan(chan);
        struct dma_async_tx_descriptor *tx_desc;
        struct xdma_desc *sw_desc;
-       u32 desc_num = 0, i;
        u64 addr, dev_addr, *src, *dst;
+       u32 desc_num, i;
        struct scatterlist *sg;
 
-       for_each_sg(sgl, sg, sg_len, i)
-               desc_num += DIV_ROUND_UP(sg_dma_len(sg), XDMA_DESC_BLEN_MAX);
-
+       desc_num = sg_nents_for_dma(sgl, sg_len, XDMA_DESC_BLEN_MAX);
        sw_desc = xdma_alloc_desc(xdma_chan, desc_num, false);
        if (!sw_desc)
                return NULL;