linux/debian/patches/features/all/line6/0016-staging-line6-wait-for...

52 lines
1.7 KiB
Diff

From: Stefan Hajnoczi <stefanha@gmail.com>
Date: Sat, 10 Dec 2011 02:12:31 +0100
Subject: [016/106] staging: line6: wait for urbs in snd_line6_prepare()
commit 665f3f506b1c2684d6f78d6d03c038d1712e561d upstream.
The .trigger() pcm callbacks are not allowed to block and cannot wait
until urbs have completed. We need to ensure that stopping, preparing,
and then restarting a stream always works.
Currently the driver will sometimes return -EBUSY when restarting the
stream because urbs have not completed yet. This can be triggered by
jackd from userspace.
The solution is to wait on urbs in the .prepare() pcm callback since
blocking is allowed in that callback. This guarantees that all urbs are
quiesced and ready to be submitted when the start trigger callback is
invoked.
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Markus Grabner <grabner@icg.tugraz.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/staging/line6/pcm.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c
index c3e5002..68727b2 100644
--- a/drivers/staging/line6/pcm.c
+++ b/drivers/staging/line6/pcm.c
@@ -474,6 +474,20 @@ int snd_line6_prepare(struct snd_pcm_substream *substream)
{
struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
+ switch (substream->stream) {
+ case SNDRV_PCM_STREAM_PLAYBACK:
+ line6_unlink_wait_clear_audio_out_urbs(line6pcm);
+ break;
+
+ case SNDRV_PCM_STREAM_CAPTURE:
+ line6_unlink_wait_clear_audio_in_urbs(line6pcm);
+ break;
+
+ default:
+ MISSING_CASE;
+ }
+
+
if (!test_and_set_bit(BIT_PREPARED, &line6pcm->flags)) {
line6pcm->count_out = 0;
line6pcm->pos_out = 0;