[PATCH v2 09/13] dmaengine: qcom: adm: use sg_nents_for_dma() helper
Bjorn Andersson
andersson at kernel.org
Mon Nov 10 07:07:16 PST 2025
On Mon, Nov 10, 2025 at 11:23:36AM +0100, Andy Shevchenko wrote:
> Instead of open coded variant let's use recently introduced helper.
>
Reviewed-by: Bjorn Andersson <andersson at kernel.org>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
> ---
> drivers/dma/qcom/qcom_adm.c | 9 ++++-----
> 1 file 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);
> --
> 2.50.1
>
>
More information about the linux-arm-kernel
mailing list