[PATCH 1/1] ASoC/sound: use dmaengine_desc_set_callback()

Frank.Li at oss.nxp.com Frank.Li at oss.nxp.com
Mon Nov 2 10:09:08 PST 2026


From: Frank Li <Frank.Li at 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 sound 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 at nxp.com>
---
 sound/core/pcm_dmaengine.c         | 3 +--
 sound/soc/fsl/fsl_asrc_dma.c       | 3 +--
 sound/soc/fsl/fsl_asrc_m2m.c       | 3 +--
 sound/soc/renesas/fsi.c            | 3 +--
 sound/soc/renesas/siu_pcm.c        | 6 ++----
 sound/soc/sprd/sprd-pcm-compress.c | 5 +++--
 sound/soc/sprd/sprd-pcm-dma.c      | 5 +++--
 sound/soc/stm/stm32_spdifrx.c      | 3 +--
 8 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c
index 1306b04be171a..41feb5312ffec 100644
--- a/sound/core/pcm_dmaengine.c
+++ b/sound/core/pcm_dmaengine.c
@@ -169,8 +169,7 @@ static int dmaengine_pcm_prepare_and_submit(struct snd_pcm_substream *substream)
 	if (!desc)
 		return -ENOMEM;
 
-	desc->callback = dmaengine_pcm_dma_complete;
-	desc->callback_param = substream;
+	dmaengine_desc_set_callback(desc, dmaengine_pcm_dma_complete, NULL, substream);
 	prtd->cookie = dmaengine_submit(desc);
 
 	return 0;
diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c
index b417de6abebe4..cd3bf6340b650 100644
--- a/sound/soc/fsl/fsl_asrc_dma.c
+++ b/sound/soc/fsl/fsl_asrc_dma.c
@@ -76,8 +76,7 @@ static int fsl_asrc_dma_prepare_and_submit(struct snd_pcm_substream *substream,
 		return -ENOMEM;
 	}
 
-	pair->desc[!dir]->callback = fsl_asrc_dma_complete;
-	pair->desc[!dir]->callback_param = substream;
+	dmaengine_desc_set_callback(pair->desc[!dir], fsl_asrc_dma_complete, NULL, substream);
 
 	dmaengine_submit(pair->desc[!dir]);
 
diff --git a/sound/soc/fsl/fsl_asrc_m2m.c b/sound/soc/fsl/fsl_asrc_m2m.c
index 58101ce07c9f9..c6970a7e88f3f 100644
--- a/sound/soc/fsl/fsl_asrc_m2m.c
+++ b/sound/soc/fsl/fsl_asrc_m2m.c
@@ -176,8 +176,7 @@ static int asrc_dmaconfig(struct fsl_asrc_pair *pair,
 		return -EINVAL;
 	}
 
-	pair->desc[dir]->callback = ASRC_xPUT_DMA_CALLBACK(dir);
-	pair->desc[dir]->callback_param = pair;
+	dmaengine_desc_set_callback(pair->desc[dir], ASRC_xPUT_DMA_CALLBACK(dir), NULL, pair);
 
 	return 0;
 }
diff --git a/sound/soc/renesas/fsi.c b/sound/soc/renesas/fsi.c
index 74e2ea002fbb1..fa21cf47befff 100644
--- a/sound/soc/renesas/fsi.c
+++ b/sound/soc/renesas/fsi.c
@@ -1375,8 +1375,7 @@ static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io)
 		goto fsi_dma_transfer_err;
 	}
 
-	desc->callback		= fsi_dma_complete;
-	desc->callback_param	= io;
+	dmaengine_desc_set_callback(desc, fsi_dma_complete, NULL, io);
 
 	if (dmaengine_submit(desc) < 0) {
 		dev_err(dai->dev, "tx_submit() fail\n");
diff --git a/sound/soc/renesas/siu_pcm.c b/sound/soc/renesas/siu_pcm.c
index fd5b20b469a4a..7208514e16a43 100644
--- a/sound/soc/renesas/siu_pcm.c
+++ b/sound/soc/renesas/siu_pcm.c
@@ -125,8 +125,7 @@ static int siu_pcm_wr_set(struct siu_port *port_info,
 		return -ENOMEM;
 	}
 
-	desc->callback = siu_dma_tx_complete;
-	desc->callback_param = siu_stream;
+	dmaengine_desc_set_callback(desc, siu_dma_tx_complete, NULL, siu_stream);
 	cookie = dmaengine_submit(desc);
 	if (cookie < 0) {
 		dev_err(dev, "Failed to submit a dma transfer\n");
@@ -175,8 +174,7 @@ static int siu_pcm_rd_set(struct siu_port *port_info,
 		return -ENOMEM;
 	}
 
-	desc->callback = siu_dma_tx_complete;
-	desc->callback_param = siu_stream;
+	dmaengine_desc_set_callback(desc, siu_dma_tx_complete, NULL, siu_stream);
 	cookie = dmaengine_submit(desc);
 	if (cookie < 0) {
 		dev_err(dev, "Failed to submit dma descriptor\n");
diff --git a/sound/soc/sprd/sprd-pcm-compress.c b/sound/soc/sprd/sprd-pcm-compress.c
index f790b959cd4e4..a810c9c8a0b5b 100644
--- a/sound/soc/sprd/sprd-pcm-compress.c
+++ b/sound/soc/sprd/sprd-pcm-compress.c
@@ -247,8 +247,9 @@ static int sprd_platform_compr_dma_config(struct snd_soc_component *component,
 
 	/* Only channel 1 transfer can wake up the AP system. */
 	if (!params->no_wake_mode && channel == 1) {
-		dma->desc->callback = sprd_platform_compr_dma_complete;
-		dma->desc->callback_param = cstream;
+		dmaengine_desc_set_callback(dma->desc,
+					    sprd_platform_compr_dma_complete,
+					    NULL, cstream);
 	}
 
 	kfree(sg);
diff --git a/sound/soc/sprd/sprd-pcm-dma.c b/sound/soc/sprd/sprd-pcm-dma.c
index bbd7516f81954..968901ae4c335 100644
--- a/sound/soc/sprd/sprd-pcm-dma.c
+++ b/sound/soc/sprd/sprd-pcm-dma.c
@@ -287,8 +287,9 @@ static int sprd_pcm_hw_params(struct snd_soc_component *component,
 		}
 
 		if (!runtime->no_period_wakeup) {
-			data->desc->callback = sprd_pcm_dma_complete;
-			data->desc->callback_param = dma_private;
+			dmaengine_desc_set_callback(data->desc,
+						    sprd_pcm_dma_complete,
+						    NULL, dma_private);
 		}
 	}
 
diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c
index 88863dbd05d9b..44467a25fb69a 100644
--- a/sound/soc/stm/stm32_spdifrx.c
+++ b/sound/soc/stm/stm32_spdifrx.c
@@ -302,8 +302,7 @@ static int stm32_spdifrx_dma_ctrl_start(struct stm32_spdifrx_data *spdifrx)
 	if (!spdifrx->desc)
 		return -EINVAL;
 
-	spdifrx->desc->callback = stm32_spdifrx_dma_complete;
-	spdifrx->desc->callback_param = spdifrx;
+	dmaengine_desc_set_callback(spdifrx->desc, stm32_spdifrx_dma_complete, NULL, spdifrx);
 	cookie = dmaengine_submit(spdifrx->desc);
 	err = dma_submit_error(cookie);
 	if (err)
-- 
2.43.0




More information about the linux-arm-kernel mailing list