summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-05-23 12:09:20 +0300
committerTakashi Iwai <tiwai@suse.de>2021-05-25 09:49:55 +0300
commit534a427bface78d682482ad66ce1a517522acc1d (patch)
treed60d1e008e55bb00ad90cbbd3b23ed12a1b0549e
parentb6cc78da367cf9aac7ae77bbea73ecca43a70461 (diff)
downloadlinux-534a427bface78d682482ad66ce1a517522acc1d.tar.xz
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. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20210523090920.15345-7-tiwai@suse.de 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 82f80d0c068b..11acea02bc74 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2799,6 +2799,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);
+
mutex_lock(&pcm->open_mutex);
snd_pcm_release_substream(substream);
kfree(pcm_file);