summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-03-24 09:05:25 +0100
committerAndrey Grodzovsky <andrey.grodzovsky@amd.com>2021-03-29 10:34:13 -0400
commit553390b067bf77062fbc86a57246c5d37445eba5 (patch)
treebd2277fbc0964f199d11ae2ea0fd414c24274081
parentcbaa324799718e2b828a8c7b5b001dd896748497 (diff)
ALSA: pcm: Block the release until the system resume finishes
The normal PCM operations are already blocked during the card power off state in the PCM common ioctl handler, but the release isn't covered. As the PCM stream release may also access the hardware, let's block the release until the card power turns on. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/core/pcm_native.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 9f3f8e953ff0..1976ec309ac0 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2797,6 +2797,10 @@ static int snd_pcm_release(struct inode *inode, struct file *file)
if (snd_BUG_ON(!substream))
return -ENXIO;
pcm = substream->pcm;
+
+ /* block until the device gets woken up as it may touch the hardware */
+ snd_power_wait(pcm->card, SNDRV_CTL_POWER_D0);
+
mutex_lock(&pcm->open_mutex);
snd_pcm_release_substream(substream);
kfree(pcm_file);