Skip to content

Commit 3c8a86e

Browse files
andy-shevvinodkoul
authored andcommitted
dmaengine: xilinx: xdma: use sg_nents_for_dma() helper
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>
1 parent ac326dc commit 3c8a86e

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/dma/xilinx/xdma.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,11 @@ xdma_prep_device_sg(struct dma_chan *chan, struct scatterlist *sgl,
605605
struct xdma_chan *xdma_chan = to_xdma_chan(chan);
606606
struct dma_async_tx_descriptor *tx_desc;
607607
struct xdma_desc *sw_desc;
608-
u32 desc_num = 0, i;
609608
u64 addr, dev_addr, *src, *dst;
609+
u32 desc_num, i;
610610
struct scatterlist *sg;
611611

612-
for_each_sg(sgl, sg, sg_len, i)
613-
desc_num += DIV_ROUND_UP(sg_dma_len(sg), XDMA_DESC_BLEN_MAX);
614-
612+
desc_num = sg_nents_for_dma(sgl, sg_len, XDMA_DESC_BLEN_MAX);
615613
sw_desc = xdma_alloc_desc(xdma_chan, desc_num, false);
616614
if (!sw_desc)
617615
return NULL;

0 commit comments

Comments
 (0)