]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dmaengine: sh: use sg_nents_for_dma() helper
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 8 Jan 2026 10:50:23 +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-13-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/sh/shdma-base.c

index 1e4b4d6069c0e817d273a12446349f3eccaf5b7a..3ff2a8be8faafb4e66a8a414310173ac0ffbde13 100644 (file)
@@ -577,12 +577,11 @@ static struct dma_async_tx_descriptor *shdma_prep_sg(struct shdma_chan *schan,
        struct scatterlist *sg;
        struct shdma_desc *first = NULL, *new = NULL /* compiler... */;
        LIST_HEAD(tx_list);
-       int chunks = 0;
+       int chunks;
        unsigned long irq_flags;
        int i;
 
-       for_each_sg(sgl, sg, sg_len, i)
-               chunks += DIV_ROUND_UP(sg_dma_len(sg), schan->max_xfer_len);
+       chunks = sg_nents_for_dma(sgl, sg_len, schan->max_xfer_len);
 
        /* Have to lock the whole loop to protect against concurrent release */
        spin_lock_irqsave(&schan->chan_lock, irq_flags);