From: Andy Shevchenko Date: Thu, 8 Jan 2026 10:50:20 +0000 (+0100) Subject: dmaengine: qcom: adm: use sg_nents_for_dma() helper X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=425f871d7acdb521d67c2578e6ae688a751d1e80;p=thirdparty%2Flinux.git dmaengine: qcom: adm: use sg_nents_for_dma() helper Instead of open coded variant let's use recently introduced helper. Reviewed-by: Bjorn Andersson Signed-off-by: Andy Shevchenko Link: https://patch.msgid.link/20260108105619.3513561-10-andriy.shevchenko@linux.intel.com Signed-off-by: Vinod Koul --- diff --git a/drivers/dma/qcom/qcom_adm.c b/drivers/dma/qcom/qcom_adm.c index 6be54fddcee1..490edad20ae6 100644 --- a/drivers/dma/qcom/qcom_adm.c +++ b/drivers/dma/qcom/qcom_adm.c @@ -390,16 +390,15 @@ static struct dma_async_tx_descriptor *adm_prep_slave_sg(struct dma_chan *chan, } /* iterate through sgs and compute allocation size of structures */ - for_each_sg(sgl, sg, sg_len, i) { - if (achan->slave.device_fc) { + if (achan->slave.device_fc) { + for_each_sg(sgl, sg, sg_len, i) { box_count += DIV_ROUND_UP(sg_dma_len(sg) / burst, ADM_MAX_ROWS); if (sg_dma_len(sg) % burst) single_count++; - } else { - single_count += DIV_ROUND_UP(sg_dma_len(sg), - ADM_MAX_XFER); } + } else { + single_count = sg_nents_for_dma(sgl, sg_len, ADM_MAX_XFER); } async_desc = kzalloc(sizeof(*async_desc), GFP_NOWAIT);