Skip to contentSkip to conversation

ASoC/sound: use dmaengine_desc_set_callback()

PATCH In review [email protected] 4 participants 4 messages Nov 2 – Nov 8

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

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

From: Frank Li <[email protected]>

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.

---
 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(-)
sound/core/pcm_dmaengine.c +1 -2
index 1306b04be171a..41feb5312ffec 100644
@@ -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;
sound/soc/fsl/fsl_asrc_dma.c +1 -2
index b417de6abebe4..cd3bf6340b650 100644
@@ -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]);
 
sound/soc/fsl/fsl_asrc_m2m.c +1 -2
index 58101ce07c9f9..c6970a7e88f3f 100644
@@ -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;
 }
sound/soc/renesas/fsi.c +1 -2
index 74e2ea002fbb1..fa21cf47befff 100644
@@ -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");
sound/soc/renesas/siu_pcm.c +2 -4
index fd5b20b469a4a..7208514e16a43 100644
@@ -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");
sound/soc/sprd/sprd-pcm-compress.c +3 -2
index f790b959cd4e4..a810c9c8a0b5b 100644
@@ -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);
sound/soc/sprd/sprd-pcm-dma.c +3 -2
index bbd7516f81954..968901ae4c335 100644
@@ -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);
 		}
 	}
 
sound/soc/stm/stm32_spdifrx.c +1 -2
index 88863dbd05d9b..44467a25fb69a 100644
@@ -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)
Signature · 1 line
2.43.0
maintainer Acked-by on v1 1/1
#1 lore raw

Hi

Quoted 9 lines

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.

---

For Renesas part

Thank you for your help !!

Best regards
---
Kuninori Morimoto

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 11 lines · On Tue, Nov 3, 2026 at 2:09 AM <[email protected]> wrote:

From: Frank Li <[email protected]>

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.

For fsl part

Best regards
Shengjiu Wang

Quoted 140 lines
---
 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(-)
sound/core/pcm_dmaengine.c +1 -2
index 1306b04be171a..41feb5312ffec 100644
@@ -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;
sound/soc/fsl/fsl_asrc_dma.c +1 -2
index b417de6abebe4..cd3bf6340b650 100644
@@ -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]);
 
sound/soc/fsl/fsl_asrc_m2m.c +1 -2
index 58101ce07c9f9..c6970a7e88f3f 100644
@@ -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;
 }
sound/soc/renesas/fsi.c +1 -2
index 74e2ea002fbb1..fa21cf47befff 100644
@@ -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");
sound/soc/renesas/siu_pcm.c +2 -4
index fd5b20b469a4a..7208514e16a43 100644
@@ -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");
sound/soc/sprd/sprd-pcm-compress.c +3 -2
index f790b959cd4e4..a810c9c8a0b5b 100644
@@ -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);
sound/soc/sprd/sprd-pcm-dma.c +3 -2
index bbd7516f81954..968901ae4c335 100644
@@ -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);
                }
        }
 
sound/soc/stm/stm32_spdifrx.c +1 -3
index 88863dbd05d9b..44467a25fb69a 100644
@@ -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

maintainer
#3 lore raw
In reply to [email protected]
Quoted 1 line · On Mon, 02 Nov 2026 13:09:08 -0500, [email protected] wrote:

ASoC/sound: use dmaengine_desc_set_callback()

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.5

Thanks!

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

      https://git.kernel.org/broonie/sound/c/bd9d1df5a856

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark