mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
dmaengine: add dmaengine_get_provider_device() API
Add dmaengine_get_provider_device() API and kernel doc for dmaengine_get_dma_device() to describe the difference. dmaengine_get_dma_device() is used for DMA mapping because some DMA engines provide per-channel iommu mapping. dmaengine_get_provider_device() is used to find a DMA engine channel by a filter function. In most cases they return the same value, but they have different semantic meanings. Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20261002202341.253152-1-Frank.Li@oss.nxp.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
bff69558d6
commit
61527d7e69
|
|
@ -59,8 +59,10 @@ struct imx_dma_data {
|
|||
|
||||
static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
|
||||
{
|
||||
return !strcmp(chan->device->dev->driver->name, "imx-sdma") ||
|
||||
!strcmp(chan->device->dev->driver->name, "imx-dma");
|
||||
struct device *dev = dmaengine_get_provider_device(chan);
|
||||
|
||||
return !strcmp(dev->driver->name, "imx-sdma") ||
|
||||
!strcmp(dev->driver->name, "imx-dma");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2122,12 +2122,31 @@ static inline struct device *dmaengine_chan_dev(struct dma_chan *chan)
|
|||
return &chan->chan_dev->device;
|
||||
}
|
||||
|
||||
/*
|
||||
* dmaengine_get_provider_device() - Get DMA engine provider device. Typical
|
||||
* use is to find a DMA channel by filter.
|
||||
* @chan: DMA channel
|
||||
*
|
||||
* Return: Pointer to the DMA engine provider device.
|
||||
*/
|
||||
static inline struct device *dmaengine_get_provider_device(struct dma_chan *chan)
|
||||
{
|
||||
return chan->device->dev;
|
||||
}
|
||||
|
||||
/*
|
||||
* dmaengine_get_dma_device() - Get DMA device used for DMA mapping. Some
|
||||
* DMA engines provide per-channel iommu mapping.
|
||||
* @chan: DMA channel
|
||||
*
|
||||
* Return: Pointer to the device used for DMA mapping.
|
||||
*/
|
||||
static inline struct device *dmaengine_get_dma_device(struct dma_chan *chan)
|
||||
{
|
||||
if (chan->chan_dev->chan_dma_dev)
|
||||
return dmaengine_chan_dev(chan);
|
||||
|
||||
return chan->device->dev;
|
||||
return dmaengine_get_provider_device(chan);
|
||||
}
|
||||
|
||||
#endif /* DMAENGINE_H */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user