diff options
author | Takashi Iwai <tiwai@suse.de> | 2022-10-09 13:42:09 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2022-10-09 13:43:24 +0300 |
commit | 9902b303b5ade208b58f0dd38a09831813582211 (patch) | |
tree | b74c15b89dc278f2d747c186ed21dee62ad910d2 /sound/usb | |
parent | 556a11a082ee208455ed42e7c460849cc3dbd68c (diff) | |
download | linux-9902b303b5ade208b58f0dd38a09831813582211.tar.xz |
ALSA: usb-audio: Avoid unnecessary interface change at EP close
We toggle USB interface at PCM prepare and reset at close. When the
PCM isn't prepared, resetting again makes little sense.
Check the current altset and avoid unnecessary interface reset at EP
close.
Link: https://lore.kernel.org/r/20221009104212.18877-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/endpoint.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 48a3843a08f1..f21acbc9f4f4 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -32,6 +32,7 @@ struct snd_usb_iface_ref { unsigned char iface; bool need_setup; int opened; + int altset; struct list_head list; }; @@ -899,6 +900,9 @@ static int endpoint_set_interface(struct snd_usb_audio *chip, int altset = set ? ep->altsetting : 0; int err; + if (ep->iface_ref->altset == altset) + return 0; + usb_audio_dbg(chip, "Setting usb interface %d:%d for EP 0x%x\n", ep->iface, altset, ep->ep_num); err = usb_set_interface(chip->dev, ep->iface, altset); @@ -910,6 +914,7 @@ static int endpoint_set_interface(struct snd_usb_audio *chip, if (chip->quirk_flags & QUIRK_FLAG_IFACE_DELAY) msleep(50); + ep->iface_ref->altset = altset; return 0; } |