Re: [PATCH v2 1/8] dmaengine: Add API to combine configuration and preparation (sg and single)

From: Vinod Koul

Date: Mon Mar 09 2026 - 07:09:24 EST


On 18-12-25, 10:56, Frank Li wrote:
> Previously, configuration and preparation required two separate calls. This
> works well when configuration is done only once during initialization.
>
> However, in cases where the burst length or source/destination address must
> be adjusted for each transfer, calling two functions is verbose and
> requires additional locking to ensure both steps complete atomically.
>
> Add a new API dmaengine_prep_config_single() and dmaengine_prep_config_sg()
> and callback device_prep_config_sg() that combines configuration and
> preparation into a single operation. If the configuration argument is
> passed as NULL, fall back to the existing implementation.
>
> Add a new API dmaengine_prep_config_single_safe() and
> dmaengine_prep_config_sg_safe() for re-entrancy, which require driver
> implement callback device_prep_config_sg().

Okay to add API

> + struct dma_async_tx_descriptor *(*device_prep_config_sg)(
> + struct dma_chan *chan, struct scatterlist *sgl,
> + unsigned int sg_len, enum dma_transfer_direction direction,
> + unsigned long flags, struct dma_slave_config *config,
> + void *context);

Do we want to have drivers implement one more callback. It does not make
sense to me. Why not handle this in framework and have it call the
respective lower level APIs.

Drivers should implement simple apis and collectively the functionality
can come from the framework.

Would you consider revising as such. Bonus all existing drivers can
start using this API, no change required for drivers in that case


--
~Vinod