summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2026-01-08 11:50:20 +0100
committerVinod Koul <vkoul@kernel.org>2026-01-09 08:36:00 +0530
commit425f871d7acdb521d67c2578e6ae688a751d1e80 (patch)
treec2e3ace0e661c9863b0526b5e518563db8e504da /drivers/dma
parent068942eaa232ba752b744d98ff8ab22b26c8bff4 (diff)
dmaengine: qcom: adm: 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-10-andriy.shevchenko@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/qcom/qcom_adm.c9
1 files changed, 4 insertions, 5 deletions
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);