Skip to content

Commit 3fc49d2

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

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

drivers/dma/k3dma.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -536,19 +536,14 @@ static struct dma_async_tx_descriptor *k3_dma_prep_slave_sg(
536536
size_t len, avail, total = 0;
537537
struct scatterlist *sg;
538538
dma_addr_t addr, src = 0, dst = 0;
539-
int num = sglen, i;
539+
int num, i;
540540

541541
if (sgl == NULL)
542542
return NULL;
543543

544544
c->cyclic = 0;
545545

546-
for_each_sg(sgl, sg, sglen, i) {
547-
avail = sg_dma_len(sg);
548-
if (avail > DMA_MAX_SIZE)
549-
num += DIV_ROUND_UP(avail, DMA_MAX_SIZE) - 1;
550-
}
551-
546+
num = sg_nents_for_dma(sgl, sglen, DMA_MAX_SIZE);
552547
ds = k3_dma_alloc_desc_resource(num, chan);
553548
if (!ds)
554549
return NULL;

0 commit comments

Comments
 (0)