[PATCH v2 4/8] dmaengine: dw-edma: Pass dma_slave_config to dw_edma_device_transfer()

Damien Le Moal dlemoal at kernel.org
Fri Dec 19 02:38:07 PST 2025


On 12/19/25 00:56, Frank Li wrote:
> Pass dma_slave_config to dw_edma_device_transfer() to support atomic
> configuration and descriptor preparation when a non-NULL config is
> provided to device_prep_config_sg().
> 
> Tested-by: Niklas Cassel <cassel at kernel.org>
> Signed-off-by: Frank Li <Frank.Li at nxp.com>
> ---
>  drivers/dma/dw-edma/dw-edma-core.c | 22 ++++++++++++++++------
>  1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
> index e005b7bdaee156a3f4573b4734f50e3e47553dd2..1863254bf61eb892cb0cf8934e53b40d32027dfa 100644
> --- a/drivers/dma/dw-edma/dw-edma-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-core.c
> @@ -230,6 +230,15 @@ static int dw_edma_device_config(struct dma_chan *dchan,
>  	return 0;
>  }
>  
> +static struct dma_slave_config *
> +dw_edma_device_get_config(struct dma_chan *dchan,
> +			  struct dma_slave_config *config)
> +{
> +	struct dw_edma_chan *chan = dchan2dw_edma_chan(dchan);
> +
> +	return config ? config : &chan->config;
> +}

I would rewrite this as:

static struct dma_slave_config *
dw_edma_device_get_config(struct dma_chan *dchan,
			  struct dma_slave_config *config)
{
	struct dw_edma_chan *chan;

	if (config)
		return config;

	chan = dchan2dw_edma_chan(dchan);

	return &chan->config;
}

That avoids the call to dchan2dw_edma_chan() if config is specified.

-- 
Damien Le Moal
Western Digital Research



More information about the Linux-nvme mailing list