summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFrank Li <Frank.Li@nxp.com>2026-10-05 05:37:17 -0400
committerVinod Koul <vkoul@kernel.org>2026-10-09 11:41:33 +0200
commitbbc109e0e686266d784483df108af206bc52e120 (patch)
tree9cc4528524ce9ad9b0923c8cca288eddc64d8053 /include
parent072975a8a578a62ea68ec1ceb8d2d7dcfb5dfefa (diff)
downloadlinux-next-bbc109e0e686266d784483df108af206bc52e120.tar.gz
linux-next-bbc109e0e686266d784483df108af206bc52e120.zip
dmaengine: add dmaengine_get_cap_mask() and dmaengine_has_cap() helpers
Add two new inline helpers to query DMA channel capabilities without directly accessing the internal dma_device pointer: dmaengine_get_cap_mask(chan) - returns a const pointer to the capability mask of the DMA device backing the channel. dmaengine_has_cap(chan, tx_type) - returns true if the channel supports the given transaction type. These complement the existing dma_has_cap() macro which operates on a dma_cap_mask_t directly. Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20261005-dmaengine_prep_dma_pq-v3-4-a4a241f26fa7@nxp.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/dmaengine.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index efe421503501..4e4e1cc22b9a 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -1606,6 +1606,18 @@ dmaengine_get_fill_align(struct dma_chan *chan)
}
/**
+ * dmaengine_get_cap_mask - get capability mask of a DMA channel
+ * @chan: DMA channel
+ *
+ * Return a pointer to the capability mask of the DMA device backing @chan.
+ */
+static inline const dma_cap_mask_t *
+dmaengine_get_cap_mask(struct dma_chan *chan)
+{
+ return &chan->device->cap_mask;
+}
+
+/**
* dmaengine_is_copy_aligned - test copy alignment
* @chan: DMA channel
* @off1: first buffer offset
@@ -1830,6 +1842,19 @@ __dma_has_cap(enum dma_transaction_type tx_type, dma_cap_mask_t *srcp)
return test_bit(tx_type, srcp->bits);
}
+/**
+ * dmaengine_has_cap - test whether a DMA channel supports a transaction type
+ * @chan: DMA channel
+ * @tx_type: transaction type to test
+ *
+ * Return true if @chan supports @tx_type, false otherwise.
+ */
+static inline bool
+dmaengine_has_cap(struct dma_chan *chan, enum dma_transaction_type tx_type)
+{
+ return dma_has_cap(tx_type, chan->device->cap_mask);
+}
+
#define for_each_dma_cap_mask(cap, mask) \
for_each_set_bit(cap, mask.bits, DMA_TX_TYPE_END)