Skip to content

Commit

Permalink
staging: line6: wait for urbs in snd_line6_prepare()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stefan Hajnoczi authored and Greg Kroah-Hartman committed Dec 10, 2011
1 parent 188e664 commit 665f3f5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/staging/line6/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 665f3f5

Please sign in to comment.