Skip to content

Commit 39110c6

Browse files
andy-shevvinodkoul
authored andcommitted
dmaengine: bcm2835-dma: 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-5-andriy.shevchenko@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 024ae9d commit 39110c6

1 file changed

Lines changed: 1 addition & 18 deletions

File tree

drivers/dma/bcm2835-dma.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -260,23 +260,6 @@ static void bcm2835_dma_create_cb_set_length(
260260
control_block->info |= finalextrainfo;
261261
}
262262

263-
static inline size_t bcm2835_dma_count_frames_for_sg(
264-
struct bcm2835_chan *c,
265-
struct scatterlist *sgl,
266-
unsigned int sg_len)
267-
{
268-
size_t frames = 0;
269-
struct scatterlist *sgent;
270-
unsigned int i;
271-
size_t plength = bcm2835_dma_max_frame_length(c);
272-
273-
for_each_sg(sgl, sgent, sg_len, i)
274-
frames += bcm2835_dma_frames_for_length(
275-
sg_dma_len(sgent), plength);
276-
277-
return frames;
278-
}
279-
280263
/**
281264
* bcm2835_dma_create_cb_chain - create a control block and fills data in
282265
*
@@ -672,7 +655,7 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_slave_sg(
672655
}
673656

674657
/* count frames in sg list */
675-
frames = bcm2835_dma_count_frames_for_sg(c, sgl, sg_len);
658+
frames = sg_nents_for_dma(sgl, sg_len, bcm2835_dma_max_frame_length(c));
676659

677660
/* allocate the CB chain */
678661
d = bcm2835_dma_create_cb_chain(chan, direction, false,

0 commit comments

Comments
 (0)