ALSA: firewire-speakers: fix hang when unplugging a running device
authorClemens Ladisch <clemens@ladisch.de>
Wed, 30 Mar 2011 06:24:00 +0000 (08:24 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 30 Mar 2011 06:56:57 +0000 (08:56 +0200)
When aborting a PCM stream, the xrun is signaled only if the stream is
running.  When disconnecting a PCM stream, calling snd_card_disconnect()
too early would change the stream into a non-running state and thus
prevent the xrun from being noticed by user space.

To prevent this, move the snd_card_disconnect() call after the xrun.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/speakers.c

index 0fce9218abb1676bf8e259be50bfd6d5d65090d2..5466de8527bd19082bf9163e0ff88824e2fc4061 100644 (file)
@@ -778,10 +778,9 @@ static int __devexit fwspk_remove(struct device *dev)
 {
        struct fwspk *fwspk = dev_get_drvdata(dev);
 
-       snd_card_disconnect(fwspk->card);
-
        mutex_lock(&fwspk->mutex);
        amdtp_out_stream_pcm_abort(&fwspk->stream);
+       snd_card_disconnect(fwspk->card);
        fwspk_stop_stream(fwspk);
        mutex_unlock(&fwspk->mutex);