diff options
author | Takashi Iwai <tiwai@suse.de> | 2006-11-08 09:41:29 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-11-28 07:46:38 -0500 |
commit | de1b8b93a0ba016b07d13086a15ad692536e6995 (patch) | |
tree | 840f0b486009d1ddd5c38fd57bc49e2f749253a1 | |
parent | 282e0c87f223afbe8b182197eb06c127a66353ce (diff) |
[ALSA] Fix hang-up at disconnection of usb-audio
Fix hang-up at disconnection of usb-audio devices while accessing PCM.
Don't handle PCM operations any more after shutdown flag is set.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r-- | sound/core/oss/pcm_oss.c | 3 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 6 | ||||
-rw-r--r-- | sound/usb/usbaudio.c | 3 |
3 files changed, 8 insertions, 4 deletions
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 505b23ec4058..e0821eb3d851 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -2359,7 +2359,8 @@ static int snd_pcm_oss_release(struct inode *inode, struct file *file) | |||
2359 | substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; | 2359 | substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; |
2360 | snd_assert(substream != NULL, return -ENXIO); | 2360 | snd_assert(substream != NULL, return -ENXIO); |
2361 | pcm = substream->pcm; | 2361 | pcm = substream->pcm; |
2362 | snd_pcm_oss_sync(pcm_oss_file); | 2362 | if (!pcm->card->shutdown) |
2363 | snd_pcm_oss_sync(pcm_oss_file); | ||
2363 | mutex_lock(&pcm->open_mutex); | 2364 | mutex_lock(&pcm->open_mutex); |
2364 | snd_pcm_oss_release_file(pcm_oss_file); | 2365 | snd_pcm_oss_release_file(pcm_oss_file); |
2365 | mutex_unlock(&pcm->open_mutex); | 2366 | mutex_unlock(&pcm->open_mutex); |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 37b4b10850ae..66e24b5da469 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1310,7 +1310,8 @@ static int snd_pcm_pre_prepare(struct snd_pcm_substream *substream, | |||
1310 | int f_flags) | 1310 | int f_flags) |
1311 | { | 1311 | { |
1312 | struct snd_pcm_runtime *runtime = substream->runtime; | 1312 | struct snd_pcm_runtime *runtime = substream->runtime; |
1313 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN) | 1313 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN || |
1314 | runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) | ||
1314 | return -EBADFD; | 1315 | return -EBADFD; |
1315 | if (snd_pcm_running(substream)) | 1316 | if (snd_pcm_running(substream)) |
1316 | return -EBUSY; | 1317 | return -EBUSY; |
@@ -1568,7 +1569,8 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream) | |||
1568 | runtime = substream->runtime; | 1569 | runtime = substream->runtime; |
1569 | card = substream->pcm->card; | 1570 | card = substream->pcm->card; |
1570 | 1571 | ||
1571 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN) | 1572 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN || |
1573 | runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) | ||
1572 | return -EBADFD; | 1574 | return -EBADFD; |
1573 | 1575 | ||
1574 | snd_power_lock(card); | 1576 | snd_power_lock(card); |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c82b01c7ad3a..67202b9eeb77 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -1469,7 +1469,8 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream) | |||
1469 | subs->cur_audiofmt = NULL; | 1469 | subs->cur_audiofmt = NULL; |
1470 | subs->cur_rate = 0; | 1470 | subs->cur_rate = 0; |
1471 | subs->period_bytes = 0; | 1471 | subs->period_bytes = 0; |
1472 | release_substream_urbs(subs, 0); | 1472 | if (!subs->stream->chip->shutdown) |
1473 | release_substream_urbs(subs, 0); | ||
1473 | return snd_pcm_free_vmalloc_buffer(substream); | 1474 | return snd_pcm_free_vmalloc_buffer(substream); |
1474 | } | 1475 | } |
1475 | 1476 | ||