mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 04:04:43 +01:00
dmaengine: lgm: 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-8-andriy.shevchenko@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
3fc49d21f3
commit
f9b0274f53
1 changed files with 2 additions and 7 deletions
|
|
@ -1164,8 +1164,8 @@ ldma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
|
|||
struct dw2_desc *hw_ds;
|
||||
struct dw2_desc_sw *ds;
|
||||
struct scatterlist *sg;
|
||||
int num = sglen, i;
|
||||
dma_addr_t addr;
|
||||
int num, i;
|
||||
|
||||
if (!sgl)
|
||||
return NULL;
|
||||
|
|
@ -1173,12 +1173,7 @@ ldma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
|
|||
if (d->ver > DMA_VER22)
|
||||
return ldma_chan_desc_cfg(chan, sgl->dma_address, sglen);
|
||||
|
||||
for_each_sg(sgl, sg, sglen, i) {
|
||||
avail = sg_dma_len(sg);
|
||||
if (avail > DMA_MAX_SIZE)
|
||||
num += DIV_ROUND_UP(avail, DMA_MAX_SIZE) - 1;
|
||||
}
|
||||
|
||||
num = sg_nents_for_dma(sgl, sglen, DMA_MAX_SIZE);
|
||||
ds = dma_alloc_desc_resource(num, c);
|
||||
if (!ds)
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue