Skip to content

Commit

Permalink
ALSA: line6: Fix -EBUSY error during active monitoring
Browse files Browse the repository at this point in the history
When a monitor stream is active, the next PCM stream access results in
EBUSY error because of the check in line6_stream_start().  Fix this by
just skipping the submission of pending URBs when the stream is
already running instead.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=101431
Cc: <[email protected]> # v4.0+
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Jul 14, 2015
1 parent d1f15e0 commit 4d0e677
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions sound/usb/line6/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,15 @@ static int line6_stream_start(struct snd_line6_pcm *line6pcm, int direction,
int ret = 0;

spin_lock_irqsave(&pstr->lock, flags);
if (!test_and_set_bit(type, &pstr->running)) {
if (pstr->active_urbs || pstr->unlink_urbs) {
ret = -EBUSY;
goto error;
}

if (!test_and_set_bit(type, &pstr->running) &&
!(pstr->active_urbs || pstr->unlink_urbs)) {
pstr->count = 0;
/* Submit all currently available URBs */
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
ret = line6_submit_audio_out_all_urbs(line6pcm);
else
ret = line6_submit_audio_in_all_urbs(line6pcm);
}
error:
if (ret < 0)
clear_bit(type, &pstr->running);
spin_unlock_irqrestore(&pstr->lock, flags);
Expand Down

0 comments on commit 4d0e677

Please sign in to comment.