[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 11:50:06 PDT 2026


On Wed, Sep 23, 2026 at 02:45:47PM -0400, Frank.Li at oss.nxp.com wrote:
> From: Frank Li <Frank.Li at nxp.com>
>
> Replace direct dma_chan::device::dev access with the proper
> dmaengine_get_dma_device() for consumer API
>
> chan->device->dev is not always the device used for DMA mapping.
> Some DMA engines support per-channel IOMMU mappings, so different
> channels may use different DMA devices.  dmaengine_get_dma_device()
> returns the correct device for each channel.
>
> This also prepares for making the DMA engine provider data structures
> private. DMA consumers should not access DMA engine internals directly.
>
> mxs-mmc.c wrong use mmc host device when do DMA map. Fix it by use
> dmaengine_get_dma_device().
>
> Assisted-by: LLM
> Reviewed-by: Linus Walleij <linusw at kernel.org>
> Reviewed-by: Wolfram Sang <wsa+renesas at sang-engineering.com>
> Reviewed-by: Vinod Koul <vkoul at kernel.org>
> Signed-off-by: Frank Li <Frank.Li at nxp.com>
> ---
> Change in v4
> - Fix miss "R" at Reviewed-by tags.
> - Fix error path unmap dev at mxs-mmc.c (sashakio reported)
> - move dmaengine_get_dma_device(host->dma) after mxcmci_use_dma() to avoid
> defer host->dma if use pio mode (sashakio reported)
>
> Change in v3
> - add Linus Walleij and Vinod Koul's review by tags
> - Add missed omap and mxs-mmc.c (sashakio reported)
>
> Change in v2
> - find more place, which use device->dev for dma mapping. This time should
> clean all.
> - Reviewed-by: Linus Walleij <linusw at kernel.org>
>
> Cc: imx at lists.linux.dev
> Cc: vkoul at kernel.org
> ---
>  drivers/mmc/host/Kconfig                 |  2 +-

Please forget this version, I make misstake to include a debug code, sorry
for annoise.

Frank



More information about the linux-arm-kernel mailing list