Re: [PATCH] net: dma: use dmaengine_desc_set_callback()

From
Joe Damato <hidden>
Date
2026-11-03 18:49:01
Also in
imx, linux-arm-kernel, linux-arm-msm, linux-sunxi, lkml
Reply to
Frank Li, 2026-11-03
On Tue, Nov 03, 2026 at 09:06:03AM -0600, Frank Li wrote:
On Mon, Nov 02, 2026 at 03:28:33PM -0800, Joe Damato wrote:
quoted
On Mon, Nov 02, 2026 at 02:19:16PM -0500, Frank.Li@oss.nxp.com wrote:
quoted
From: Frank Li <Frank.Li@nxp.com>

Replace open-coded assignments to callback and callback_param fields
of struct dma_async_tx_descriptor with calls to the
dmaengine_desc_set_callback() helper across net drivers.

No functional change intended. Prepare to make struct
dma_async_tx_descriptor private to the DMA engine.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/net/ethernet/allwinner/sun4i-emac.c       |  3 +--
 drivers/net/ethernet/micrel/ks8842.c              |  6 ++----
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c |  6 ++----
 drivers/net/wwan/qcom_bam_dmux.c                  | 10 ++++------
 4 files changed, 9 insertions(+), 16 deletions(-)
[...]
quoted
diff --git a/drivers/net/wwan/qcom_bam_dmux.c b/drivers/net/wwan/qcom_bam_dmux.c
index cc6ace8d64371..1479f8362e04e 100644
--- a/drivers/net/wwan/qcom_bam_dmux.c
+++ b/drivers/net/wwan/qcom_bam_dmux.c
@@ -195,9 +195,8 @@ static bool bam_dmux_skb_dma_submit_tx(struct bam_dmux_skb_dma *skb_dma)
 		return false;
 	}

-	desc->callback = bam_dmux_tx_callback;
-	desc->callback_param = skb_dma;
-	desc->cookie = dmaengine_submit(desc);
+	dmaengine_desc_set_callback(desc, bam_dmux_tx_callback, NULL, skb_dma);
+	dmaengine_submit(desc);
 	return true;
 }
@@ -477,9 +476,8 @@ static bool bam_dmux_skb_dma_submit_rx(struct bam_dmux_skb_dma *skb_dma)
 		return false;
 	}

-	desc->callback = bam_dmux_rx_callback;
-	desc->callback_param = skb_dma;
-	desc->cookie = dmaengine_submit(desc);
+	dmaengine_desc_set_callback(desc, bam_dmux_rx_callback, NULL, skb_dma);
+	dmaengine_submit(desc);
I noticed in the above that the return value of dmaengine_submit is discarded
instead of stored.

Is that intentional? I suppose it might be because AFAICT cookie is never
used and the commit message says "no functional change intended".
dma_cookie_assign() already set desc->cookie in dmaengine_submit(). Of couse
it is not obvious. Do you need me update commit message to descript it.
Ah, I see it now. In the tx_submit callback it looks like dma drivers set the
cookie.

So removing it here really is a no-op since it was getting set, as you said,
during submit.

My mistake. I don't think it's worth respinning just to fix the commit
message just because I didn't dig deep enough :)
Thread (6 messages) 6 messages, 4 authors, last reply 3d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help