aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/pcm.c')
-rw-r--r--sound/core/pcm.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index f2991940b27..030102caeee 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -1086,11 +1086,19 @@ static int snd_pcm_dev_disconnect(struct snd_device *device)
1086 if (list_empty(&pcm->list)) 1086 if (list_empty(&pcm->list))
1087 goto unlock; 1087 goto unlock;
1088 1088
1089 mutex_lock(&pcm->open_mutex);
1090 wake_up(&pcm->open_wait);
1089 list_del_init(&pcm->list); 1091 list_del_init(&pcm->list);
1090 for (cidx = 0; cidx < 2; cidx++) 1092 for (cidx = 0; cidx < 2; cidx++)
1091 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) 1093 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) {
1092 if (substream->runtime) 1094 snd_pcm_stream_lock_irq(substream);
1095 if (substream->runtime) {
1093 substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED; 1096 substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED;
1097 wake_up(&substream->runtime->sleep);
1098 wake_up(&substream->runtime->tsleep);
1099 }
1100 snd_pcm_stream_unlock_irq(substream);
1101 }
1094 list_for_each_entry(notify, &snd_pcm_notify_list, list) { 1102 list_for_each_entry(notify, &snd_pcm_notify_list, list) {
1095 notify->n_disconnect(pcm); 1103 notify->n_disconnect(pcm);
1096 } 1104 }
@@ -1110,6 +1118,7 @@ static int snd_pcm_dev_disconnect(struct snd_device *device)
1110 pcm->streams[cidx].chmap_kctl = NULL; 1118 pcm->streams[cidx].chmap_kctl = NULL;
1111 } 1119 }
1112 } 1120 }
1121 mutex_unlock(&pcm->open_mutex);
1113 unlock: 1122 unlock:
1114 mutex_unlock(&register_mutex); 1123 mutex_unlock(&register_mutex);
1115 return 0; 1124 return 0;