Commit 313d9f28 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: x86: Properly manage PCM substream lifetype

The PCM substream is referred not only in the PCM callbacks but also
in the irq handler and in the hotplug/unplug codes.  The latter code
paths don't take the PCM lock, thus the PCM may be released
unexpectedly while calling PCM helper functions or accessing
pcm->runtime fields.

This patch implements a simple refcount to assure the PCM substream
accessibility while the other codes are accessing.  It needed some
code refactoring in the relevant functions for avoiding the doubly
spinlocks.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 7d9e7986
This diff is collapsed.
......@@ -72,9 +72,10 @@
#define AUD_CONFIG_CH_MASK 0x70
struct pcm_stream_info {
struct snd_pcm_substream *had_substream;
struct snd_pcm_substream *substream;
u64 buffer_rendered;
u32 ring_buf_size;
int substream_refcount;
};
struct ring_buf_info {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment