Skip to contentSkip to conversation

usb: renesas_usbhs: use dmaengine_get_dma_device() instead of chan->device->dev

PATCH New [email protected] 2 participants 2 messages Nov 3

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 usb: renesas_usbhs: use dmaengine_get_dma_device() instead of chan->device->dev

From: Frank Li <[email protected]>

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.

Assisted-by LLM

---
change in v2
- Update subject
- v1 https://lore.kernel.org/all/[email protected]/

---
 drivers/usb/renesas_usbhs/fifo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/renesas_usbhs/fifo.c +1 -1
index bac6f8fd0055e..d6fa436112aba 100644
@@ -810,7 +810,7 @@ static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map)
 	struct usbhs_fifo *fifo = usbhs_pipe_to_fifo(pipe);
 	struct dma_chan *chan = usbhsf_dma_chan_get(fifo, pkt);
 
-	return info->dma_map_ctrl(chan->device->dev, pkt, map);
+	return info->dma_map_ctrl(dmaengine_get_dma_device(chan), pkt, map);
 }
 
 static void usbhsf_dma_complete(void *arg,
Signature · 1 line
2.43.0
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 10 lines

From: Frank Li <[email protected]>

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.

Quoted 5 lines

This also prepares for making the DMA engine provider data structures private. DMA consumers should not access DMA engine internals directly.

Assisted-by LLM

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1