Skip to content

Commit 425f871

Browse files
andy-shevvinodkoul
authored andcommitted
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>
1 parent 068942e commit 425f871

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

drivers/dma/qcom/qcom_adm.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,16 +390,15 @@ static struct dma_async_tx_descriptor *adm_prep_slave_sg(struct dma_chan *chan,
390390
}
391391

392392
/* iterate through sgs and compute allocation size of structures */
393-
for_each_sg(sgl, sg, sg_len, i) {
394-
if (achan->slave.device_fc) {
393+
if (achan->slave.device_fc) {
394+
for_each_sg(sgl, sg, sg_len, i) {
395395
box_count += DIV_ROUND_UP(sg_dma_len(sg) / burst,
396396
ADM_MAX_ROWS);
397397
if (sg_dma_len(sg) % burst)
398398
single_count++;
399-
} else {
400-
single_count += DIV_ROUND_UP(sg_dma_len(sg),
401-
ADM_MAX_XFER);
402399
}
400+
} else {
401+
single_count = sg_nents_for_dma(sgl, sg_len, ADM_MAX_XFER);
403402
}
404403

405404
async_desc = kzalloc(sizeof(*async_desc), GFP_NOWAIT);

0 commit comments

Comments
 (0)