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

From: Wolfram Sang

Date: Wed Nov 04 2026 - 07:57:57 EST


Hi Frank,

On Tue, Nov 03, 2026 at 04:26:54PM -0500, Frank.Li@xxxxxxxxxxx wrote:
> From: Frank Li <Frank.Li@xxxxxxx>
>
> 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.

Thanks for this, looks useful.

> - dma_addr = dma_map_single(chan->device->dev, buf, len, dir);
> - if (dma_mapping_error(chan->device->dev, dma_addr)) {
> + dma_addr = dma_map_single(dmaengine_get_dma_device(chan), buf, len, dir);
> + if (dma_mapping_error(dmaengine_get_dma_device(chan), dma_addr)) {
> dev_dbg(dev, "dma map failed, using PIO\n");

I think we should populate a dma_dev-variable here and reuse it instead
of calling dmaengine_get_dma_device() twice.

Happy hacking,

Wolfram

Attachment: signature.asc
Description: PGP signature