--- zzzz-none-000/linux-4.4.271/sound/core/pcm.c 2021-06-03 06:22:09.000000000 +0000 +++ dakota-7530ac-750/linux-4.4.271/sound/core/pcm.c 2023-01-11 09:25:44.000000000 +0000 @@ -747,6 +747,9 @@ } substream->group = &substream->self_group; spin_lock_init(&substream->self_group.lock); +#ifdef CONFIG_AUDIO_QGKI + spin_lock_init(&substream->runtime_lock); +#endif mutex_init(&substream->self_group.mutex); INIT_LIST_HEAD(&substream->self_group.substreams); list_add_tail(&substream->link_list, &substream->self_group.substreams); @@ -1017,9 +1020,15 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime; +#ifdef CONFIG_AUDIO_QGKI + unsigned long flags = 0; +#endif if (PCM_RUNTIME_CHECK(substream)) return; +#ifdef CONFIG_AUDIO_QGKI + spin_lock_irqsave(&substream->runtime_lock, flags); +#endif runtime = substream->runtime; if (runtime->private_free != NULL) runtime->private_free(runtime); @@ -1038,6 +1047,9 @@ put_pid(substream->pid); substream->pid = NULL; substream->pstr->substream_opened--; +#ifdef CONFIG_AUDIO_QGKI + spin_unlock_irqrestore(&substream->runtime_lock, flags); +#endif } static ssize_t show_pcm_class(struct device *dev,