Skip to content

Commit ac326dc

Browse files
andy-shevvinodkoul
authored andcommitted
dmaengine: sh: 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-13-andriy.shevchenko@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent d778566 commit ac326dc

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/dma/sh/shdma-base.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,12 +577,11 @@ static struct dma_async_tx_descriptor *shdma_prep_sg(struct shdma_chan *schan,
577577
struct scatterlist *sg;
578578
struct shdma_desc *first = NULL, *new = NULL /* compiler... */;
579579
LIST_HEAD(tx_list);
580-
int chunks = 0;
580+
int chunks;
581581
unsigned long irq_flags;
582582
int i;
583583

584-
for_each_sg(sgl, sg, sg_len, i)
585-
chunks += DIV_ROUND_UP(sg_dma_len(sg), schan->max_xfer_len);
584+
chunks = sg_nents_for_dma(sgl, sg_len, schan->max_xfer_len);
586585

587586
/* Have to lock the whole loop to protect against concurrent release */
588587
spin_lock_irqsave(&schan->chan_lock, irq_flags);

0 commit comments

Comments
 (0)