summaryrefslogtreecommitdiff
path: root/sound/usb/pcm.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-09-18 14:49:31 +0200
committerTakashi Iwai <tiwai@suse.de>2012-09-19 08:08:16 +0200
commit384dc085c32285e6548511bf80c5d5a5b246ed24 (patch)
tree09d8c9b74426145ff754690d19a12ec2f8991ddb /sound/usb/pcm.c
parent61a709504b079110cd5b12ea9a4590ffea687a5c (diff)
downloadlinux-3.10-384dc085c32285e6548511bf80c5d5a5b246ed24.tar.gz
linux-3.10-384dc085c32285e6548511bf80c5d5a5b246ed24.tar.bz2
linux-3.10-384dc085c32285e6548511bf80c5d5a5b246ed24.zip
ALSA: usb-audio: Avoid unnecessary EP setups in prepare
The recent fix for USB suspend breakage moved the code to set up EP from hw_params to prepare, but it means also the EP setup might be called multiple times unnecessarily because the prepare callback can be called multiple times without starting the stream (e.g. OSS emulation). This patch adds a new flag to struct snd_usb_substream indicating whether the setup of EP is required, and do it only when necessary, i.e. right after hw_params or suspend. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/pcm.c')
-rw-r--r--sound/usb/pcm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index ae783d40f55..55e19e1b80e 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -510,6 +510,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
subs->interface = fmt->iface;
subs->altset_idx = fmt->altset_idx;
+ subs->need_setup_ep = true;
return 0;
}
@@ -568,9 +569,12 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
if (ret < 0)
return ret;
- ret = configure_endpoint(subs);
- if (ret < 0)
- return ret;
+ if (subs->need_setup_ep) {
+ ret = configure_endpoint(subs);
+ if (ret < 0)
+ return ret;
+ subs->need_setup_ep = false;
+ }
/* some unit conversions in runtime */
subs->data_endpoint->maxframesize =