Skip to content

Commit 068942e

Browse files
andy-shevvinodkoul
authored andcommitted
dmaengine: pxa-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-9-andriy.shevchenko@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent f9b0274 commit 068942e

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/dma/pxa_dma.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ pxad_prep_slave_sg(struct dma_chan *dchan, struct scatterlist *sgl,
970970
struct scatterlist *sg;
971971
dma_addr_t dma;
972972
u32 dcmd, dsadr = 0, dtadr = 0;
973-
unsigned int nb_desc = 0, i, j = 0;
973+
unsigned int nb_desc, i, j = 0;
974974

975975
if ((sgl == NULL) || (sg_len == 0))
976976
return NULL;
@@ -979,8 +979,7 @@ pxad_prep_slave_sg(struct dma_chan *dchan, struct scatterlist *sgl,
979979
dev_dbg(&chan->vc.chan.dev->device,
980980
"%s(): dir=%d flags=%lx\n", __func__, dir, flags);
981981

982-
for_each_sg(sgl, sg, sg_len, i)
983-
nb_desc += DIV_ROUND_UP(sg_dma_len(sg), PDMA_MAX_DESC_BYTES);
982+
nb_desc = sg_nents_for_dma(sgl, sg_len, PDMA_MAX_DESC_BYTES);
984983
sw_desc = pxad_alloc_desc(chan, nb_desc + 1);
985984
if (!sw_desc)
986985
return NULL;

0 commit comments

Comments
 (0)