aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/line6
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-01-19 10:15:54 -0500
committerTakashi Iwai <tiwai@suse.de>2015-01-20 02:18:44 -0500
commit5a4753112afc4d418ec6023bac757a9ec3eb7a32 (patch)
tree10c14a44a9d96003746c68968d2006ae98d10a49 /sound/usb/line6
parent31ca192139a152fcc550b9ebfb0e2d2d6247585e (diff)
ALSA: line6: Sync PCM stop at disconnect
Call line6_pcm_disconnect() at disconnect to make sure that all URBs are cleared. Also reduce the superfluous snd_pcm_stop() calls from the function (and remove the unused function) since the streams are guaranteed to be stopped at this point via snd_card_disconnect(). Tested-by: Chris Rorvick <chris@rorvick.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/line6')
-rw-r--r--sound/usb/line6/driver.c2
-rw-r--r--sound/usb/line6/pcm.c19
2 files changed, 3 insertions, 18 deletions
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index f222d9ffeca5..1193d16396a0 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -670,6 +670,8 @@ void line6_disconnect(struct usb_interface *interface)
670 dev_err(line6->ifcdev, "driver bug: inconsistent usb device\n"); 670 dev_err(line6->ifcdev, "driver bug: inconsistent usb device\n");
671 671
672 snd_card_disconnect(line6->card); 672 snd_card_disconnect(line6->card);
673 if (line6->line6pcm)
674 line6_pcm_disconnect(line6->line6pcm);
673 if (line6->disconnect) 675 if (line6->disconnect)
674 line6->disconnect(interface); 676 line6->disconnect(interface);
675 677
diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c
index 39034c7681da..08fa9753a680 100644
--- a/sound/usb/line6/pcm.c
+++ b/sound/usb/line6/pcm.c
@@ -379,30 +379,13 @@ static int snd_line6_new_pcm(struct usb_line6 *line6, struct snd_pcm **pcm_ret)
379} 379}
380 380
381/* 381/*
382 Stop substream if still running. 382 Sync with PCM stream stops.
383*/
384static void pcm_disconnect_substream(struct snd_pcm_substream *substream)
385{
386 if (substream->runtime && snd_pcm_running(substream)) {
387 snd_pcm_stream_lock_irq(substream);
388 snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED);
389 snd_pcm_stream_unlock_irq(substream);
390 }
391}
392
393/*
394 Stop PCM stream.
395*/ 383*/
396void line6_pcm_disconnect(struct snd_line6_pcm *line6pcm) 384void line6_pcm_disconnect(struct snd_line6_pcm *line6pcm)
397{ 385{
398 pcm_disconnect_substream(get_substream
399 (line6pcm, SNDRV_PCM_STREAM_CAPTURE));
400 pcm_disconnect_substream(get_substream
401 (line6pcm, SNDRV_PCM_STREAM_PLAYBACK));
402 line6_unlink_wait_clear_audio_out_urbs(line6pcm); 386 line6_unlink_wait_clear_audio_out_urbs(line6pcm);
403 line6_unlink_wait_clear_audio_in_urbs(line6pcm); 387 line6_unlink_wait_clear_audio_in_urbs(line6pcm);
404} 388}
405EXPORT_SYMBOL_GPL(line6_pcm_disconnect);
406 389
407/* 390/*
408 Create and register the PCM device and mixer entries. 391 Create and register the PCM device and mixer entries.