Re: [PATCH v6 7/9] dmaengine: fsl-edma: use dmaengine_get_dma_device()
From: Frank Li
Date: Thu Nov 12 2026 - 11:17:47 EST
On Thu, Nov 12, 2026 at 03:53:10PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@xxxxxxx>
>
> Use dmaengine_get_dma_device() instead of chan->device->dev when creating
> the TCD pool and when mapping the slave resource. This lets the driver use
> the per-channel device once per-channel IOMMU support enables it, without
> changing behaviour for existing users.
>
> Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
> ---
Reviewed-by: Frank Li <Frank.Li@xxxxxxx>
> drivers/dma/fsl-edma-common.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
> index 513b0f4e5be2..62cd60179bc6 100644
> --- a/drivers/dma/fsl-edma-common.c
> +++ b/drivers/dma/fsl-edma-common.c
> @@ -310,10 +310,10 @@ int fsl_edma_resume(struct dma_chan *chan)
>
> static void fsl_edma_unprep_slave_dma(struct fsl_edma_chan *fsl_chan)
> {
> + struct device *dev = dmaengine_get_dma_device(&fsl_chan->vchan.chan);
> +
> if (fsl_chan->dma_dir != DMA_NONE)
> - dma_unmap_resource(fsl_chan->vchan.chan.device->dev,
> - fsl_chan->dma_dev_addr,
> - fsl_chan->dma_dev_size,
> + dma_unmap_resource(dev, fsl_chan->dma_dev_addr, fsl_chan->dma_dev_size,
> fsl_chan->dma_dir, 0);
> fsl_chan->dma_dir = DMA_NONE;
> }
> @@ -321,7 +321,7 @@ static void fsl_edma_unprep_slave_dma(struct fsl_edma_chan *fsl_chan)
> static bool fsl_edma_prep_slave_dma(struct fsl_edma_chan *fsl_chan,
> enum dma_transfer_direction dir)
> {
> - struct device *dev = fsl_chan->vchan.chan.device->dev;
> + struct device *dev = dmaengine_get_dma_device(&fsl_chan->vchan.chan);
> enum dma_data_direction dma_dir;
> phys_addr_t addr = 0;
> u32 size = 0;
> @@ -1090,7 +1090,7 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan)
> if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK)
> clk_prepare_enable(fsl_chan->clk);
>
> - fsl_chan->tcd_pool = dma_pool_create("tcd_pool", chan->device->dev,
> + fsl_chan->tcd_pool = dma_pool_create("tcd_pool", dmaengine_get_dma_device(chan),
> fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_TCD64 ?
> sizeof(struct fsl_edma_hw_tcd64) : sizeof(struct fsl_edma_hw_tcd),
> 32, 0);
>
> --
> 2.34.1
>