diff options
Diffstat (limited to 'sound/core/pcm.c')
-rw-r--r-- | sound/core/pcm.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index f2991940b271..993b2405fdfe 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -1086,11 +1086,15 @@ 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); | ||
1089 | list_del_init(&pcm->list); | 1090 | list_del_init(&pcm->list); |
1090 | for (cidx = 0; cidx < 2; cidx++) | 1091 | for (cidx = 0; cidx < 2; cidx++) |
1091 | for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) | 1092 | for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) { |
1093 | snd_pcm_stream_lock_irq(substream); | ||
1092 | if (substream->runtime) | 1094 | if (substream->runtime) |
1093 | substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED; | 1095 | substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED; |
1096 | snd_pcm_stream_unlock_irq(substream); | ||
1097 | } | ||
1094 | list_for_each_entry(notify, &snd_pcm_notify_list, list) { | 1098 | list_for_each_entry(notify, &snd_pcm_notify_list, list) { |
1095 | notify->n_disconnect(pcm); | 1099 | notify->n_disconnect(pcm); |
1096 | } | 1100 | } |
@@ -1110,6 +1114,7 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) | |||
1110 | pcm->streams[cidx].chmap_kctl = NULL; | 1114 | pcm->streams[cidx].chmap_kctl = NULL; |
1111 | } | 1115 | } |
1112 | } | 1116 | } |
1117 | mutex_unlock(&pcm->open_mutex); | ||
1113 | unlock: | 1118 | unlock: |
1114 | mutex_unlock(®ister_mutex); | 1119 | mutex_unlock(®ister_mutex); |
1115 | return 0; | 1120 | return 0; |