dmaengine: add dmaengine_get_max_xor() helper

Add a new inline helper dmaengine_get_max_xor() that returns the maximum
number of XOR source buffers supported by the DMA channel's device.
Returns 0 if the channel is NULL or does not support XOR operations.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20261005-dmaengine_prep_dma_pq-v3-5-a4a241f26fa7@nxp.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
Frank Li 2026-10-05 05:37:18 -04:00 committed by Vinod Koul
parent bbc109e0e6
commit bff69558d6

View File

@ -1252,6 +1252,21 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_memcpy(
len, flags);
}
/**
* dmaengine_get_max_xor - get the maximum number of XOR sources for a channel
* @chan: DMA channel
*
* Returns the maximum number of source buffers supported by the XOR engine
* behind @chan, or 0 if the channel does not support XOR operations.
*/
static inline unsigned int dmaengine_get_max_xor(struct dma_chan *chan)
{
if (!chan || !chan->device)
return 0;
return chan->device->max_xor;
}
/**
* dmaengine_prep_dma_xor - prepare a DMA XOR operation
* @chan: the channel to use for this operation