[RFC PATCH v2] ASoC: report component resume callback errors

Pengpeng Hou posted 1 patch 1 month ago
sound/soc/soc-component.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
[RFC PATCH v2] ASoC: report component resume callback errors
Posted by Pengpeng Hou 1 month ago
snd_soc_component_driver::resume() returns an int, but
snd_soc_component_resume() discards it. In the deferred resume path,
snd_soc_resume() has already returned success to the PM core, so an error
cannot be propagated back to that caller.

Pass the callback result through the existing ASoC component error helper.
This reports negative results with component context while preserving the
established best-effort behavior: the component is still marked resumed
and the worker continues DAPM resume, digital unmute and card power
publication.

There are existing callbacks, including tas2562_resume() and
atmel_classd_component_resume(), which directly return regcache_sync()
errors. Those errors currently disappear at the component wrapper.

This only makes errors already returned by component callbacks observable.
It does not expose operations that individual callbacks ignore, and it
does not add rollback or retry semantics. Callbacks which already report
an error may retain their driver-specific message in addition to the
common ASoC component context, as with other ASoC component wrappers.

This is an RFC to confirm that reporting and continuing is the intended
contract for deferred component resume failures.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
Changes since the RFC:
- provide a concrete core patch instead of only asking a policy question
- select centralized reporting while retaining asynchronous best-effort
  resume and all existing state transitions
- use the existing ASoC component error helper
- keep driver-local restore transactions out of scope; the 33 sites listed
  previously remain an audit population, not 33 claimed fixes

Previous RFC:
https://lore.kernel.org/all/20260721055807.85110-1-pengpeng@iscas.ac.cn/

 sound/soc/soc-component.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index dc7d203cb76af..463ea227cac81 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -315,8 +315,12 @@ void snd_soc_component_suspend(struct snd_soc_component *component)
 
 void snd_soc_component_resume(struct snd_soc_component *component)
 {
-	if (component->driver->resume)
-		component->driver->resume(component);
+	int ret;
+
+	if (component->driver->resume) {
+		ret = component->driver->resume(component);
+		soc_component_ret(component, ret);
+	}
 	component->suspended = 0;
 }
 

base-commit: 2be02a7c996aa733bb36e29e07715621b0de9736
-- 
2.50.1 (Apple Git-155)
Re: [RFC PATCH v2] ASoC: report component resume callback errors
Posted by Mark Brown 3 weeks, 5 days ago
On Tue, 25 Aug 2026 16:52:39 +0800, Pengpeng Hou wrote:
> ASoC: report component resume callback errors

Applied to

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

Thanks!

[1/1] ASoC: report component resume callback errors
      https://git.kernel.org/broonie/sound/c/951af101c730

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
Re: [RFC PATCH v2] ASoC: report component resume callback errors
Posted by Kuninori Morimoto 3 weeks, 6 days ago
Hi

> snd_soc_component_driver::resume() returns an int, but
> snd_soc_component_resume() discards it. In the deferred resume path,
> snd_soc_resume() has already returned success to the PM core, so an error
> cannot be propagated back to that caller.
> 
> Pass the callback result through the existing ASoC component error helper.
> This reports negative results with component context while preserving the
> established best-effort behavior: the component is still marked resumed
> and the worker continues DAPM resume, digital unmute and card power
> publication.
> 
> There are existing callbacks, including tas2562_resume() and
> atmel_classd_component_resume(), which directly return regcache_sync()
> errors. Those errors currently disappear at the component wrapper.
> 
> This only makes errors already returned by component callbacks observable.
> It does not expose operations that individual callbacks ignore, and it
> does not add rollback or retry semantics. Callbacks which already report
> an error may retain their driver-specific message in addition to the
> common ASoC component context, as with other ASoC component wrappers.
> 
> This is an RFC to confirm that reporting and continuing is the intended
> contract for deferred component resume failures.
> 
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---

Indeed we can do nothing for resume case error.

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thank you for your help !!

Best regards
---
Kuninori Morimoto