diff options
author | Takashi Iwai <tiwai@suse.de> | 2022-09-20 14:42:43 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2022-09-20 14:42:48 +0300 |
commit | 01a72aefbacca4d6e169caa776c87d3c1f6faf4a (patch) | |
tree | 9a9456d4aff278783ec035893fc1d60115fb36ac | |
parent | 96ecdc718649fe01940e7f5dc4fc15dacd18cada (diff) | |
download | linux-01a72aefbacca4d6e169caa776c87d3c1f6faf4a.tar.xz |
Revert "ALSA: usb-audio: Clean up endpoint setups at PCM prepare"
This reverts commit 32eeeed963ad4f41b422b3e314d96ded7283b201.
As the fix for endpoint configuration split is reverted at next, do
another revert here for a clean patch application.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/usb/pcm.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 4ed53a3dc922..b604f7e95e82 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -433,6 +433,35 @@ static void close_endpoints(struct snd_usb_audio *chip, } } +static int configure_endpoints(struct snd_usb_audio *chip, + struct snd_usb_substream *subs) +{ + int err; + + if (subs->data_endpoint->need_setup) { + /* stop any running stream beforehand */ + if (stop_endpoints(subs, false)) + sync_pending_stops(subs); + if (subs->sync_endpoint) { + err = snd_usb_endpoint_prepare(chip, subs->sync_endpoint); + if (err < 0) + return err; + } + err = snd_usb_endpoint_prepare(chip, subs->data_endpoint); + if (err < 0) + return err; + snd_usb_set_format_quirk(subs, subs->cur_audiofmt); + } else { + if (subs->sync_endpoint) { + err = snd_usb_endpoint_prepare(chip, subs->sync_endpoint); + if (err < 0) + return err; + } + } + + return 0; +} + /* * hw_params callback * @@ -611,18 +640,9 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) goto unlock; } - if (subs->sync_endpoint) { - ret = snd_usb_endpoint_prepare(chip, subs->sync_endpoint); - if (ret < 0) - goto unlock; - } - - ret = snd_usb_endpoint_prepare(chip, subs->data_endpoint); + ret = configure_endpoints(chip, subs); if (ret < 0) goto unlock; - else if (ret > 0) - snd_usb_set_format_quirk(subs, subs->cur_audiofmt); - ret = 0; /* reset the pointer */ subs->buffer_bytes = frames_to_bytes(runtime, runtime->buffer_size); |