[PATCH 1/3] dmaengine: add dmaengine_prep_dma_pq(_val)() API
From: Frank . Li
Date: Mon Sep 21 2026 - 19:09:50 EST
From: Frank Li <Frank.Li@xxxxxxx>
Add dmaengine_prep_dma_pq() and dmaengine_prep_dma_pq_val as an inline
wrapper around the device_prep_dma_pq() and device_prep_dma_pq_val()
callback, consistent with how other dmaengine prep helpers like
dmaengine_prep_dma_memcpy() are structured.
Provide a clean public API that hides the direct callback access and add
proper NULL-checks on chan, chan->device, and the callback pointer.
Assisted-by: LLM
Signed-off-by: Frank Li <Frank.Li@xxxxxxx>
---
include/linux/dmaengine.h | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index c3a49a33307c6..e3b5c23d7cb0d 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -1232,6 +1232,31 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_memcpy(
len, flags);
}
+static inline struct dma_async_tx_descriptor *
+dmaengine_prep_dma_pq(struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src,
+ unsigned int src_cnt, const unsigned char *scf,
+ size_t len, unsigned long flags)
+{
+ if (!chan || !chan->device || !chan->device->device_prep_dma_pq)
+ return NULL;
+
+ return chan->device->device_prep_dma_pq(chan, dst, src,
+ src_cnt, scf, len, flags);
+}
+
+static inline struct dma_async_tx_descriptor *
+dmaengine_prep_dma_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
+ unsigned int src_cnt, const unsigned char *scf,
+ size_t len, enum sum_check_flags *pqres, unsigned long flags)
+{
+ if (!chan || !chan->device || !chan->device->device_prep_dma_pq_val)
+ return NULL;
+
+ return chan->device->device_prep_dma_pq_val(chan, pq, src,
+ src_cnt, scf, len,
+ pqres, flags);
+}
+
static inline bool dmaengine_is_metadata_mode_supported(struct dma_chan *chan,
enum dma_desc_metadata_mode mode)
{
--
2.43.0