Skip to content

Commit 5d6ceb2

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

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ dw_axi_dma_chan_prep_slave_sg(struct dma_chan *dchan, struct scatterlist *sgl,
850850
unsigned int loop = 0;
851851
struct scatterlist *sg;
852852
size_t axi_block_len;
853-
u32 len, num_sgs = 0;
853+
u32 len, num_sgs;
854854
unsigned int i;
855855
dma_addr_t mem;
856856
int status;
@@ -867,9 +867,7 @@ dw_axi_dma_chan_prep_slave_sg(struct dma_chan *dchan, struct scatterlist *sgl,
867867
if (axi_block_len == 0)
868868
return NULL;
869869

870-
for_each_sg(sgl, sg, sg_len, i)
871-
num_sgs += DIV_ROUND_UP(sg_dma_len(sg), axi_block_len);
872-
870+
num_sgs = sg_nents_for_dma(sgl, sg_len, axi_block_len);
873871
desc = axi_desc_alloc(num_sgs);
874872
if (unlikely(!desc))
875873
goto err_desc_get;

0 commit comments

Comments
 (0)