[PATCH v4 1/1] mmc: use dmaengine_get_dma_device() instead of chan->device->dev

Frank Li Frank.li at oss.nxp.com
Wed Sep 23 14:40:08 PDT 2026


On Wed, Sep 23, 2026 at 02:33:35PM -0500, Frank Li wrote:
> On Wed, Sep 23, 2026 at 08:57:04PM +0200, Arnd Bergmann wrote:
> > On Wed, Sep 23, 2026, at 20:45, Frank.Li at oss.nxp.com wrote:
> > > @@ -214,7 +214,7 @@ config MMC_SDHCI_OF_AT91
> > >  config MMC_SDHCI_OF_ESDHC
> > >  	tristate "SDHCI OF support for the Freescale eSDHC controller"
> > >  	depends on MMC_SDHCI_PLTFM
> > > -	depends on PPC || ARCH_MXC || ARCH_LAYERSCAPE || COMPILE_TEST
> > > +	depends on PPC || ARCHMXC || ARCH_LAYERSCAPE || COMPILE_TEST
> > >  	select MMC_SDHCI_IO_ACCESSORS
> > >  	select FSL_GUTS
> >
> > This looks like an accidental bug that should be removed from the patch.
>
> It is accidently including my local change to build test. I found it when
> post it.
>
> >
> > > @@ -961,7 +961,7 @@ static void atmci_dma_cleanup(struct atmel_mci *host)
> > >  	struct mmc_data                 *data = host->data;
> > >
> > >  	if (data)
> > > -		dma_unmap_sg(host->dma.chan->device->dev,
> > > +		dma_unmap_sg(dmaengine_get_dma_device(host->dma.chan),
> > >  				data->sg, data->sg_len,
> > >  				mmc_get_dma_dir(data));
> >
> > Since you have the exact construct in a lot of drivers, would
> > it make sense to take this one step further and introduce
> > a new set of helpers in drivers/dma/dmaengine.h, such as
> >
> > unsigned int dmaengine_map_sg(struct dma_chan *chan, struct scatterlist *sg, ...);
>
> If add this, suppose should be set of map_*, like dmaengine_map_single(),
>
> Vinod:
> 	Is it add new APIs like thats?

Maybe we can enhence dmaengine_prep_slave_sg(),

Most patten like

	sglen = dma_map_sg(chan->device->dev, data->sg,
			data->sg_len, mmc_get_dma_dir(data));

	dmaengine_slave_config(chan, &host->dma_conf);
	desc = dmaengine_prep_slave_sg(chan,
			data->sg, sglen, slave_dirn,
			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);

let dmaengine_prep_slave_sg() include dma_map_sg(), which also reduce
error handle when return desc is NULL.

after call complete, auto ummap_sg(). We may add DMA_PREP_MAP flags to
keep back compatiblity.

after enhancement
	consumer just need call

	dmaengine_prep_slave_sg(chan, data->sg, data->sg_len, slave_dirn,
			        DMA_PREP_INTERRUPT | DMA_CTRL_ACK |
				DMA_PREP_MAP)

Frank
>
> Frank
>
> >
> >       Arnd



More information about the linux-arm-kernel mailing list