* [PATCH] ASoC: stm32: i2s: Use devm helpers and drop remove callback
@ 2026-11-25 10:48 phucduc.bui
2026-11-30 17:04 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: phucduc.bui @ 2026-11-25 10:48 UTC (permalink / raw)
To: Mark Brown, Olivier Moysan
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Arnaud Pouliquen,
Maxime Coquelin, linux-sound, linux-stm32, linux-arm-kernel,
linux-kernel, Alexandre Torgue, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Commit caff4ce8cc58 ("ASoC: stm32: i2s: manage rebind issue") switched
to explicit registration and unregistration to address a sound card
rebind issue.
Commit 58f30150ffd6 ("ASoC: core: Remove only the registered component
in devm functions") fixed the underlying issue in the ASoC core, so
devm helpers can now be used again.
Also use devm_pm_runtime_enable(), which fixes the unbalanced
pm_runtime_disable() in the probe error path.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
Note: Compile-tested only.
sound/soc/stm/stm32_i2s.c | 42 +++++++++++++--------------------------
1 file changed, 14 insertions(+), 28 deletions(-)
diff --git a/sound/soc/stm/stm32_i2s.c b/sound/soc/stm/stm32_i2s.c
index 79465be82cb8..e6e861a957dc 100644
--- a/sound/soc/stm/stm32_i2s.c
+++ b/sound/soc/stm/stm32_i2s.c
@@ -1255,13 +1255,6 @@ static int stm32_i2s_parse_dt(struct platform_device *pdev,
return 0;
}
-static void stm32_i2s_remove(struct platform_device *pdev)
-{
- snd_dmaengine_pcm_unregister(&pdev->dev);
- snd_soc_unregister_component(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
-}
-
static int stm32_i2s_probe(struct platform_device *pdev)
{
struct stm32_i2s_data *i2s;
@@ -1301,56 +1294,50 @@ static int stm32_i2s_probe(struct platform_device *pdev)
if (ret)
return ret;
- ret = snd_dmaengine_pcm_register(&pdev->dev, &stm32_i2s_pcm_config, 0);
+ ret = devm_pm_runtime_enable(&pdev->dev);
if (ret)
return ret;
- ret = snd_soc_register_component(&pdev->dev, &stm32_i2s_component,
- i2s->dai_drv, 1);
- if (ret) {
- snd_dmaengine_pcm_unregister(&pdev->dev);
+ ret = devm_snd_dmaengine_pcm_register(&pdev->dev, &stm32_i2s_pcm_config, 0);
+ if (ret)
+ return ret;
+
+ ret = devm_snd_soc_register_component(&pdev->dev, &stm32_i2s_component,
+ i2s->dai_drv, 1);
+ if (ret)
return ret;
- }
/* Set SPI/I2S in i2s mode */
ret = regmap_update_bits(i2s->regmap, STM32_I2S_CGFR_REG,
I2S_CGFR_I2SMOD, I2S_CGFR_I2SMOD);
if (ret)
- goto error;
+ return ret;
ret = regmap_read(i2s->regmap, STM32_I2S_IPIDR_REG, &val);
if (ret)
- goto error;
+ return ret;
if (val == I2S_IPIDR_NUMBER) {
ret = regmap_read(i2s->regmap, STM32_I2S_HWCFGR_REG, &val);
if (ret)
- goto error;
+ return ret;
if (!FIELD_GET(I2S_HWCFGR_I2S_SUPPORT_MASK, val)) {
dev_err(&pdev->dev,
"Device does not support i2s mode\n");
- ret = -EPERM;
- goto error;
+ return -EPERM;
}
ret = regmap_read(i2s->regmap, STM32_I2S_VERR_REG, &val);
if (ret)
- goto error;
+ return ret;
dev_dbg(&pdev->dev, "I2S version: %lu.%lu registered\n",
FIELD_GET(I2S_VERR_MAJ_MASK, val),
FIELD_GET(I2S_VERR_MIN_MASK, val));
}
- pm_runtime_enable(&pdev->dev);
-
- return ret;
-
-error:
- stm32_i2s_remove(pdev);
-
- return ret;
+ return 0;
}
MODULE_DEVICE_TABLE(of, stm32_i2s_ids);
@@ -1384,7 +1371,6 @@ static struct platform_driver stm32_i2s_driver = {
.pm = pm_ptr(&stm32_i2s_pm_ops),
},
.probe = stm32_i2s_probe,
- .remove = stm32_i2s_remove,
};
module_platform_driver(stm32_i2s_driver);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ASoC: stm32: i2s: Use devm helpers and drop remove callback
2026-11-25 10:48 [PATCH] ASoC: stm32: i2s: Use devm helpers and drop remove callback phucduc.bui
@ 2026-11-30 17:04 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-11-30 17:04 UTC (permalink / raw)
To: Olivier Moysan, phucduc.bui
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Arnaud Pouliquen,
Maxime Coquelin, linux-sound, linux-stm32, linux-arm-kernel,
linux-kernel, Alexandre Torgue
On Wed, 25 Nov 2026 17:48:33 +0700, phucduc.bui@gmail.com wrote:
> ASoC: stm32: i2s: Use devm helpers and drop remove callback
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.5
Thanks!
[1/1] ASoC: stm32: i2s: Use devm helpers and drop remove callback
https://git.kernel.org/broonie/sound/c/e6c245ad5524
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-01 12:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 10:48 [PATCH] ASoC: stm32: i2s: Use devm helpers and drop remove callback phucduc.bui
2026-11-30 17:04 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.