[PATCH v2 07/13] dmaengine: lgm: use sg_nents_for_dma() helper
Vinod Koul
vkoul at kernel.org
Sat Nov 22 01:28:05 PST 2025
On 10-11-25, 11:23, Andy Shevchenko wrote:
> Instead of open coded variant let's use recently introduced helper.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
> ---
> drivers/dma/lgm/lgm-dma.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/dma/lgm/lgm-dma.c b/drivers/dma/lgm/lgm-dma.c
> index 8173c3f1075a..7d4d3dde6d88 100644
> --- a/drivers/dma/lgm/lgm-dma.c
> +++ b/drivers/dma/lgm/lgm-dma.c
> @@ -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, sg_len, DMA_MAX_SIZE);
drivers/dma/lgm/lgm-dma.c:1176:37: error: ‘sg_len’ undeclared (first use in this function); did you mean ‘sglen’?
num = sg_nents_for_dma(sgl, sg_len, DMA_MAX_SIZE);
I am getting the build failure, as well as few unused warning with this,
pls fix
--
~Vinod
More information about the linux-arm-kernel
mailing list