From: Joonho Lee <[email protected]>

Device recovery needs to suspend PCM streams even when CONFIG_PM is disabled. 
The no-op snd_pcm_suspend_all() stub leaves active streams running while 
virtio-snd resets their queues, so an application sees an I/O failure instead 
of the suspended state needed for prepare and recovery.

Build the logical stream suspension operation independently of power 
management. Keep system resume support conditional on CONFIG_PM.

Assisted-by: LLM
Signed-off-by: Joonho Lee <[email protected]>
---
 include/sound/pcm.h     | 7 -------
 sound/core/pcm_native.c | 2 +-
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 7150f8356dc8..cdbde0524dd4 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -628,14 +628,7 @@ int snd_pcm_start(struct snd_pcm_substream *substream);
 int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t status);
 int snd_pcm_drain_done(struct snd_pcm_substream *substream);
 int snd_pcm_stop_xrun(struct snd_pcm_substream *substream);
-#ifdef CONFIG_PM
 int snd_pcm_suspend_all(struct snd_pcm *pcm);
-#else
-static inline int snd_pcm_suspend_all(struct snd_pcm *pcm)
-{
-       return 0;
-}
-#endif
 int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int 
cmd, void *arg);
 int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct file *file,
                           struct snd_pcm_substream **rsubstream);
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 8131a7be5dfd..a1c13647a14c 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1828,7 +1828,6 @@ static int snd_pcm_pause_lock_irq(struct 
snd_pcm_substream *substream,
                                       (snd_pcm_state_t)push);
 }
 
-#ifdef CONFIG_PM
 /* suspend callback: state argument ignored */
 
 static int snd_pcm_pre_suspend(struct snd_pcm_substream *substream,
@@ -1939,6 +1938,7 @@ int snd_pcm_suspend_all(struct snd_pcm *pcm)
 }
 EXPORT_SYMBOL(snd_pcm_suspend_all);
 
+#ifdef CONFIG_PM
 /* resume callbacks: state argument ignored */
 
 static int snd_pcm_pre_resume(struct snd_pcm_substream *substream,

-- 
Git-157)



Reply via email to