mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] dmaengine: Add dmaengine_prep_dma_pq(_val)() API to avoid call DMA Engine callback directly
@ 2026-09-21 23:09 Frank.Li
  2026-09-21 23:09 ` [PATCH 1/3] dmaengine: add dmaengine_prep_dma_pq(_val)() API Frank.Li
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Frank.Li @ 2026-09-21 23:09 UTC (permalink / raw)
  To: Vinod Koul, Frank Li, Dan Williams, Herbert Xu, David S. Miller
  Cc: dmaengine, linux-kernel, linux-crypto, imx, Frank Li, Frank Li

Add dmaengine_prep_dma_pq(_val)() APIs to avoid call DMA Engine callback
directly. Prepare to make dmaengine provider private.

Use dma_async_issue_pending() replace call callback.

Assisted-by: LLM
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Frank Li (3):
      dmaengine: add dmaengine_prep_dma_pq(_val)() API
      async_tx: use dmaengine_prep_dma_pq(_val)() instead of direct callback
      async_tx: use dma_async_issue_pending() instead of direct callback

 crypto/async_tx/async_pq.c          | 22 +++++++++++-----------
 crypto/async_tx/async_raid6_recov.c |  8 ++++----
 include/linux/async_tx.h            |  8 ++------
 include/linux/dmaengine.h           | 25 +++++++++++++++++++++++++
 4 files changed, 42 insertions(+), 21 deletions(-)
---
base-commit: 5c4d4169604b335c38bbc79bc1fc03042981fc6f
change-id: 20260921-dmaengine_prep_dma_pq-7eba91a609ed

Best regards,
--  
Frank Li <Frank.Li@nxp.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] dmaengine: add dmaengine_prep_dma_pq(_val)() API
  2026-09-21 23:09 [PATCH 0/3] dmaengine: Add dmaengine_prep_dma_pq(_val)() API to avoid call DMA Engine callback directly Frank.Li
@ 2026-09-21 23:09 ` Frank.Li
  2026-09-21 23:09 ` [PATCH 2/3] async_tx: use dmaengine_prep_dma_pq(_val)() instead of direct callback Frank.Li
  2026-09-21 23:09 ` [PATCH 3/3] async_tx: use dma_async_issue_pending() " Frank.Li
  2 siblings, 0 replies; 4+ messages in thread
From: Frank.Li @ 2026-09-21 23:09 UTC (permalink / raw)
  To: Vinod Koul, Frank Li, Dan Williams, Herbert Xu, David S. Miller
  Cc: dmaengine, linux-kernel, linux-crypto, imx, Frank Li

From: Frank Li <Frank.Li@nxp.com>

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@nxp.com>
---
 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] async_tx: use dmaengine_prep_dma_pq(_val)() instead of direct callback
  2026-09-21 23:09 [PATCH 0/3] dmaengine: Add dmaengine_prep_dma_pq(_val)() API to avoid call DMA Engine callback directly Frank.Li
  2026-09-21 23:09 ` [PATCH 1/3] dmaengine: add dmaengine_prep_dma_pq(_val)() API Frank.Li
@ 2026-09-21 23:09 ` Frank.Li
  2026-09-21 23:09 ` [PATCH 3/3] async_tx: use dma_async_issue_pending() " Frank.Li
  2 siblings, 0 replies; 4+ messages in thread
From: Frank.Li @ 2026-09-21 23:09 UTC (permalink / raw)
  To: Vinod Koul, Frank Li, Dan Williams, Herbert Xu, David S. Miller
  Cc: dmaengine, linux-kernel, linux-crypto, imx, Frank Li, Frank Li

From: Frank Li <Frank.Li@nxp.com>

Replace direct device_prep_dma_pq() and device_prep_dma_pq_val() callback
invocations with the new dmaengine_prep_dma_pq() and
dmaengine_prep_dma_pq_val() wrapper API, consistent with how other
dmaengine operations use their wrapper helpers.

Assisted-by: LLM
Signed-off-by: Frank Li <frank.li@nxp.com>
---
 crypto/async_tx/async_pq.c          | 22 +++++++++++-----------
 crypto/async_tx/async_raid6_recov.c |  8 ++++----
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/crypto/async_tx/async_pq.c b/crypto/async_tx/async_pq.c
index 27f99349e310b..1087a478447ce 100644
--- a/crypto/async_tx/async_pq.c
+++ b/crypto/async_tx/async_pq.c
@@ -76,11 +76,11 @@ do_async_gen_syndrome(struct dma_chan *chan,
 		for (;;) {
 			dma_dest[0] = unmap->addr[disks - 2];
 			dma_dest[1] = unmap->addr[disks - 1];
-			tx = dma->device_prep_dma_pq(chan, dma_dest,
-						     &unmap->addr[src_off],
-						     pq_src_cnt,
-						     &scfs[src_off], unmap->len,
-						     dma_flags);
+			tx = dmaengine_prep_dma_pq(chan, dma_dest,
+						   &unmap->addr[src_off],
+						   pq_src_cnt,
+						   &scfs[src_off], unmap->len,
+						   dma_flags);
 			if (likely(tx))
 				break;
 			async_tx_quiesce(&submit->depend_tx);
@@ -357,12 +357,12 @@ async_syndrome_val(struct page **blocks, unsigned int *offsets, int disks,
 		if (submit->flags & ASYNC_TX_FENCE)
 			dma_flags |= DMA_PREP_FENCE;
 		for (;;) {
-			tx = device->device_prep_dma_pq_val(chan, pq,
-							    unmap->addr,
-							    src_cnt,
-							    coefs,
-							    len, pqres,
-							    dma_flags);
+			tx = dmaengine_prep_dma_pq_val(chan, pq,
+						       unmap->addr,
+						       src_cnt,
+						       coefs,
+						       len, pqres,
+						       dma_flags);
 			if (likely(tx))
 				break;
 			async_tx_quiesce(&submit->depend_tx);
diff --git a/crypto/async_tx/async_raid6_recov.c b/crypto/async_tx/async_raid6_recov.c
index e53870d84bc55..27909afda694a 100644
--- a/crypto/async_tx/async_raid6_recov.c
+++ b/crypto/async_tx/async_raid6_recov.c
@@ -52,8 +52,8 @@ async_sum_product(struct page *dest, unsigned int d_off,
 		pq[1] = unmap->addr[2];
 
 		unmap->len = len;
-		tx = dma->device_prep_dma_pq(chan, pq, unmap->addr, 2, coef,
-					     len, dma_flags);
+		tx = dmaengine_prep_dma_pq(chan, pq, unmap->addr, 2, coef,
+					   len, dma_flags);
 		if (tx) {
 			dma_set_unmap(tx, unmap);
 			async_tx_submit(chan, tx, submit);
@@ -120,8 +120,8 @@ async_mult(struct page *dest, unsigned int d_off, struct page *src,
 		 * dma_dest[1] and ignores dma_dest[0] as a dest
 		 * due to DMA_PREP_PQ_DISABLE_P
 		 */
-		tx = dma->device_prep_dma_pq(chan, dma_dest, unmap->addr,
-					     1, &coef, len, dma_flags);
+		tx = dmaengine_prep_dma_pq(chan, dma_dest, unmap->addr,
+					   1, &coef, len, dma_flags);
 
 		if (tx) {
 			dma_set_unmap(tx, unmap);

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] async_tx: use dma_async_issue_pending() instead of direct callback
  2026-09-21 23:09 [PATCH 0/3] dmaengine: Add dmaengine_prep_dma_pq(_val)() API to avoid call DMA Engine callback directly Frank.Li
  2026-09-21 23:09 ` [PATCH 1/3] dmaengine: add dmaengine_prep_dma_pq(_val)() API Frank.Li
  2026-09-21 23:09 ` [PATCH 2/3] async_tx: use dmaengine_prep_dma_pq(_val)() instead of direct callback Frank.Li
@ 2026-09-21 23:09 ` Frank.Li
  2 siblings, 0 replies; 4+ messages in thread
From: Frank.Li @ 2026-09-21 23:09 UTC (permalink / raw)
  To: Vinod Koul, Frank Li, Dan Williams, Herbert Xu, David S. Miller
  Cc: dmaengine, linux-kernel, linux-crypto, imx, Frank Li

From: Frank Li <Frank.Li@nxp.com>

Replace direct device_issue_pending() callback invocation in
async_tx_issue_pending() with the dma_async_issue_pending() wrapper API.

Assisted-by: LLM
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 include/linux/async_tx.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index 1ca9f9e05f4f1..9f7fef19f2142 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -87,12 +87,8 @@ struct async_submit_ctl {
  */
 static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx)
 {
-	if (likely(tx)) {
-		struct dma_chan *chan = tx->chan;
-		struct dma_device *dma = chan->device;
-
-		dma->device_issue_pending(chan);
-	}
+	if (likely(tx))
+		dma_async_issue_pending(tx->chan);
 }
 #ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL
 #include <asm/async_tx.h>

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-21 23:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-21 23:09 [PATCH 0/3] dmaengine: Add dmaengine_prep_dma_pq(_val)() API to avoid call DMA Engine callback directly Frank.Li
2026-09-21 23:09 ` [PATCH 1/3] dmaengine: add dmaengine_prep_dma_pq(_val)() API Frank.Li
2026-09-21 23:09 ` [PATCH 2/3] async_tx: use dmaengine_prep_dma_pq(_val)() instead of direct callback Frank.Li
2026-09-21 23:09 ` [PATCH 3/3] async_tx: use dma_async_issue_pending() " Frank.Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®