From: Takashi Iwai <tiwai@suse.de>
To: Chris Down <chris@chrisdown.name>
Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org,
Takashi Iwai <tiwai@suse.com>
Subject: Re: [PATCH] usb-audio: Rate limit usb_set_interface error reporting
Date: Fri, 21 Apr 2023 17:37:48 +0200 [thread overview]
Message-ID: <87cz3xqm9f.wl-tiwai@suse.de> (raw)
In-Reply-To: <ZEKo68jUGe1taYxz@chrisdown.name>
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);
WARNING: multiple messages have this Message-ID (diff)
From: Takashi Iwai <tiwai@suse.de>
To: Chris Down <chris@chrisdown.name>
Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Subject: Re: [PATCH] usb-audio: Rate limit usb_set_interface error reporting
Date: Fri, 21 Apr 2023 17:37:48 +0200 [thread overview]
Message-ID: <87cz3xqm9f.wl-tiwai@suse.de> (raw)
In-Reply-To: <ZEKo68jUGe1taYxz@chrisdown.name>
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);
next prev parent reply other threads:[~2023-04-21 15:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-21 14:38 [PATCH] usb-audio: Rate limit usb_set_interface error reporting Chris Down
2023-04-21 14:38 ` Chris Down
2023-04-21 14:42 ` Takashi Iwai
2023-04-21 14:42 ` Takashi Iwai
2023-04-21 14:48 ` Chris Down
2023-04-21 14:48 ` Chris Down
2023-04-21 15:11 ` Takashi Iwai
2023-04-21 15:11 ` Takashi Iwai
2023-04-21 15:16 ` Chris Down
2023-04-21 15:16 ` Chris Down
2023-04-21 15:37 ` Takashi Iwai [this message]
2023-04-21 15:37 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87cz3xqm9f.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=chris@chrisdown.name \
--cc=linux-kernel@vger.kernel.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.