diff options
author | Takashi Iwai | 2021-02-06 21:36:53 +0100 |
---|---|---|
committer | Takashi Iwai | 2021-02-08 16:00:28 +0100 |
commit | 29bb274e94974669acb5186a75538f20df1508b6 (patch) | |
tree | c7a38182f4688ff066763c2b545882d8dac43069 /sound/core/init.c | |
parent | 257d2d7e9e798305d65825cb82b0a7d1c0511e89 (diff) |
ALSA: pcm: Call sync_stop at disconnection
The PCM core should perform the sync for the pending stop operations
at disconnection. Otherwise it may lead to unexpected access.
Currently the old user of sync_stop, USB-audio driver, has its own
sync, so this isn't needed, but it's better to guarantee the sync in
the PCM core level.
This patch adds the missing sync_stop call at PCM disconnection
callback. It also assures the IRQ sync if it's specified in the
card. snd_pcm_sync_stop() is slightly modified to be called also for
any PCM substream object now.
Fixes: 1e850beea278 ("ALSA: pcm: Add the support for sync-stop operation")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210206203656.15959-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/init.c')
-rw-r--r-- | sound/core/init.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/core/init.c b/sound/core/init.c index 84b573e9c1f9..45f4b01de23f 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -15,6 +15,7 @@ #include <linux/pm.h> #include <linux/debugfs.h> #include <linux/completion.h> +#include <linux/interrupt.h> #include <sound/core.h> #include <sound/control.h> @@ -426,6 +427,9 @@ int snd_card_disconnect(struct snd_card *card) /* notify all devices that we are disconnected */ snd_device_disconnect_all(card); + if (card->sync_irq > 0) + synchronize_irq(card->sync_irq); + snd_info_card_disconnect(card); if (card->registered) { device_del(&card->card_dev); |