aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/pcm.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-01-13 09:35:17 +0100
committerTakashi Iwai <tiwai@suse.de>2019-01-21 16:39:35 +0100
commit73365cb10b280e539bad14e129e0d8434418bb79 (patch)
tree578b57c2edbaafecc208d65fbb1518d5044a84c9 /sound/core/pcm.c
parentALSA: pcm: Call snd_card_unref() inside in_pcm_file() (diff)
downloadlinux-dev-73365cb10b280e539bad14e129e0d8434418bb79.tar.xz
linux-dev-73365cb10b280e539bad14e129e0d8434418bb79.zip
ALSA: pcm: Unify snd_pcm_group initialization
There are multiple open codes that initialize the same object. Create a common helper function instead. Also, use kzalloc() to be safer at creating a group object, and move the initialization out of the critical section. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm.c')
-rw-r--r--sound/core/pcm.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 01b9d62eef14..88a2998f4f9b 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -753,9 +753,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
}
}
substream->group = &substream->self_group;
- spin_lock_init(&substream->self_group.lock);
- mutex_init(&substream->self_group.mutex);
- INIT_LIST_HEAD(&substream->self_group.substreams);
+ snd_pcm_group_init(&substream->self_group);
list_add_tail(&substream->link_list, &substream->self_group.substreams);
atomic_set(&substream->mmap_count, 0);
prev = substream;