[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87cz3xqm9f.wl-tiwai@suse.de>
Date: Fri, 21 Apr 2023 17:37:48 +0200
From: Takashi Iwai <tiwai@...e.de>
To: Chris Down <chris@...isdown.name>
Cc: linux-kernel@...r.kernel.org, alsa-devel@...a-project.org,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>
Subject: Re: [PATCH] usb-audio: Rate limit usb_set_interface error reporting
On Fri, 21 Apr 2023 17:16:59 +0200,
Chris Down wrote:
>
> Takashi Iwai writes:
> > Hrm, is "usb 3-7.1.4" really the USB audio device? The previous
> > errors like "Unable to submit urb #2..." are certainly for USB audio,
> > and those are with "usb 3-7.4".
>
> There are two USB audio devices -- 3-7.1.4 is input, 3-7.4 is output.
>
> % dmesg --notime | grep -e 'usb 3-7.4' -e 'usb 3-7.1.4' | grep Product: | sort | uniq
> usb 3-7.1.4: Product: USB2.0 Microphone
> usb 3-7.4: Product: USB Audio Device
Ah I see. Then those are two different sound cards?
The repeated call of usb_set_interface() might be avoided by the
additional check like below. But it's still puzzling how it happens,
because the only caller of endpoint_set_interface() you modified is
snd_usb_endpoint_prepare(), and it's called only from
snd_usb_pcm_prepare(). And, snd_usb_pcm_preapre() has the
snd_usb_lock_shutdown() call, which does the check of the
card->shutdown flag that should be set by the USB disconnection
callback...
thanks,
Takashi
-- 8< --
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -911,6 +911,9 @@ static int endpoint_set_interface(struct snd_usb_audio *chip,
if (ep->iface_ref->altset == altset)
return 0;
+ /* already disconnected? */
+ if (unlikely(atomic_read(&chip->shutdown)))
+ return -ENODEV;
usb_audio_dbg(chip, "Setting usb interface %d:%d for EP 0x%x\n",
ep->iface, altset, ep->ep_num);
Powered by blists - more mailing lists