aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-08-15 06:32:00 -0400
committerTakashi Iwai <tiwai@suse.de>2012-08-16 02:04:07 -0400
commite9ba389c5ffc4dd29dfe17e00e48877302111135 (patch)
treea103bde320260cd42172a9171af0d3fe7da889c4 /sound/usb
parent3bdcff70b6cd049e6f4437b955850f5db83653cc (diff)
ALSA: usb-audio: Fix scheduling-while-atomic bug in PCM capture stream
A PCM capture stream on usb-audio causes a scheduling-while-atomic BUG, as reported in the bugzilla entry below. It's because snd_usb_endpoint_start() is called at first at trigger START for a capture stream, and this function contains the left-over EP deactivation codes. The problem doesn't happen for a playback stream because the function is called at PCM prepare time, which can sleep. This patch fixes the BUG by moving the EP deactivation code into the PCM prepare callback. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=46011 Cc: <stable@vger.kernel.org> [v3.5+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/endpoint.c4
-rw-r--r--sound/usb/pcm.c3
2 files changed, 3 insertions, 4 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 0f647d22cb4a..c41181202688 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -821,10 +821,6 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
821 if (++ep->use_count != 1) 821 if (++ep->use_count != 1)
822 return 0; 822 return 0;
823 823
824 /* just to be sure */
825 deactivate_urbs(ep, 0, 1);
826 wait_clear_urbs(ep);
827
828 ep->active_mask = 0; 824 ep->active_mask = 0;
829 ep->unlink_mask = 0; 825 ep->unlink_mask = 0;
830 ep->phase = 0; 826 ep->phase = 0;
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index a1298f379428..62ec808ed792 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -544,6 +544,9 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
544 subs->last_frame_number = 0; 544 subs->last_frame_number = 0;
545 runtime->delay = 0; 545 runtime->delay = 0;
546 546
547 /* clear the pending deactivation on the target EPs */
548 deactivate_endpoints(subs);
549
547 /* for playback, submit the URBs now; otherwise, the first hwptr_done 550 /* for playback, submit the URBs now; otherwise, the first hwptr_done
548 * updates for all URBs would happen at the same time when starting */ 551 * updates for all URBs would happen at the same time when starting */
549 if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) 552 if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK)