Commit 4d0e6775 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: line6: Fix -EBUSY error during active monitoring

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: <stable@vger.kernel.org> # v4.0+
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d1f15e06
...@@ -186,12 +186,8 @@ static int line6_stream_start(struct snd_line6_pcm *line6pcm, int direction, ...@@ -186,12 +186,8 @@ static int line6_stream_start(struct snd_line6_pcm *line6pcm, int direction,
int ret = 0; int ret = 0;
spin_lock_irqsave(&pstr->lock, flags); spin_lock_irqsave(&pstr->lock, flags);
if (!test_and_set_bit(type, &pstr->running)) { if (!test_and_set_bit(type, &pstr->running) &&
if (pstr->active_urbs || pstr->unlink_urbs) { !(pstr->active_urbs || pstr->unlink_urbs)) {
ret = -EBUSY;
goto error;
}
pstr->count = 0; pstr->count = 0;
/* Submit all currently available URBs */ /* Submit all currently available URBs */
if (direction == SNDRV_PCM_STREAM_PLAYBACK) if (direction == SNDRV_PCM_STREAM_PLAYBACK)
...@@ -199,7 +195,6 @@ static int line6_stream_start(struct snd_line6_pcm *line6pcm, int direction, ...@@ -199,7 +195,6 @@ static int line6_stream_start(struct snd_line6_pcm *line6pcm, int direction,
else else
ret = line6_submit_audio_in_all_urbs(line6pcm); ret = line6_submit_audio_in_all_urbs(line6pcm);
} }
error:
if (ret < 0) if (ret < 0)
clear_bit(type, &pstr->running); clear_bit(type, &pstr->running);
spin_unlock_irqrestore(&pstr->lock, flags); spin_unlock_irqrestore(&pstr->lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment