]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dmaengine: bcm2835-dma: use sg_nents_for_dma() helper
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 8 Jan 2026 10:50:15 +0000 (11:50 +0100)
committerVinod Koul <vkoul@kernel.org>
Fri, 9 Jan 2026 03:06:00 +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-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/bcm2835-dma.c

index 321748e2983e5d1a912cadb9c33cbab1151cb83a..3f638c3e81cda2b822b2ac21a9247d95d5d3c58c 100644 (file)
@@ -260,23 +260,6 @@ static void bcm2835_dma_create_cb_set_length(
        control_block->info |= finalextrainfo;
 }
 
-static inline size_t bcm2835_dma_count_frames_for_sg(
-       struct bcm2835_chan *c,
-       struct scatterlist *sgl,
-       unsigned int sg_len)
-{
-       size_t frames = 0;
-       struct scatterlist *sgent;
-       unsigned int i;
-       size_t plength = bcm2835_dma_max_frame_length(c);
-
-       for_each_sg(sgl, sgent, sg_len, i)
-               frames += bcm2835_dma_frames_for_length(
-                       sg_dma_len(sgent), plength);
-
-       return frames;
-}
-
 /**
  * bcm2835_dma_create_cb_chain - create a control block and fills data in
  *
@@ -672,7 +655,7 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_slave_sg(
        }
 
        /* count frames in sg list */
-       frames = bcm2835_dma_count_frames_for_sg(c, sgl, sg_len);
+       frames = sg_nents_for_dma(sgl, sg_len, bcm2835_dma_max_frame_length(c));
 
        /* allocate the CB chain */
        d = bcm2835_dma_create_cb_chain(chan, direction, false,