diff options
| author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2026-01-08 11:50:21 +0100 |
|---|---|---|
| committer | Vinod Koul <vkoul@kernel.org> | 2026-01-09 08:36:00 +0530 |
| commit | 107fdf0c4e944030bf544aea98e8ae8537914177 (patch) | |
| tree | 537979fc3ec7755b268d703f8c0d27dec52b00a7 /drivers | |
| parent | 425f871d7acdb521d67c2578e6ae688a751d1e80 (diff) | |
dmaengine: qcom: bam_dma: 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-11-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/dma/qcom/bam_dma.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index bcd8de9a9a12..e184cebbface 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -653,22 +653,17 @@ static struct dma_async_tx_descriptor *bam_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sg; u32 i; struct bam_desc_hw *desc; - unsigned int num_alloc = 0; - + unsigned int num_alloc; if (!is_slave_direction(direction)) { dev_err(bdev->dev, "invalid dma direction\n"); return NULL; } - /* calculate number of required entries */ - for_each_sg(sgl, sg, sg_len, i) - num_alloc += DIV_ROUND_UP(sg_dma_len(sg), BAM_FIFO_SIZE); - /* allocate enough room to accommodate the number of entries */ + num_alloc = sg_nents_for_dma(sgl, sg_len, BAM_FIFO_SIZE); async_desc = kzalloc(struct_size(async_desc, desc, num_alloc), GFP_NOWAIT); - if (!async_desc) return NULL; |
