Skip to content

Commit f9b0274

Browse files
andy-shevvinodkoul
authored andcommitted
dmaengine: lgm: 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-8-andriy.shevchenko@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 3fc49d2 commit f9b0274

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

drivers/dma/lgm/lgm-dma.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,21 +1164,16 @@ ldma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
11641164
struct dw2_desc *hw_ds;
11651165
struct dw2_desc_sw *ds;
11661166
struct scatterlist *sg;
1167-
int num = sglen, i;
11681167
dma_addr_t addr;
1168+
int num, i;
11691169

11701170
if (!sgl)
11711171
return NULL;
11721172

11731173
if (d->ver > DMA_VER22)
11741174
return ldma_chan_desc_cfg(chan, sgl->dma_address, sglen);
11751175

1176-
for_each_sg(sgl, sg, sglen, i) {
1177-
avail = sg_dma_len(sg);
1178-
if (avail > DMA_MAX_SIZE)
1179-
num += DIV_ROUND_UP(avail, DMA_MAX_SIZE) - 1;
1180-
}
1181-
1176+
num = sg_nents_for_dma(sgl, sglen, DMA_MAX_SIZE);
11821177
ds = dma_alloc_desc_resource(num, c);
11831178
if (!ds)
11841179
return NULL;

0 commit comments

Comments
 (0)