Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2426576rwr; Fri, 21 Apr 2023 08:44:28 -0700 (PDT) X-Google-Smtp-Source: AKy350aNmQFa5h9xOEH5WE5jtWI/pPkw1wqZdEnv0P2hdUS3Pvll0x8U0R0nl9fA+wuaKJamjztu X-Received: by 2002:a05:6a20:728a:b0:f1:c0a1:8035 with SMTP id o10-20020a056a20728a00b000f1c0a18035mr7980402pzk.0.1682091868164; Fri, 21 Apr 2023 08:44:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682091868; cv=none; d=google.com; s=arc-20160816; b=oiuORq0Bp7iAwxnKwgN/3FijTOdupIFrxdUw8oYNuki7z0rCPBuT9kkWQcDEZJecG6 w4OcSSlBj08m0lA8QYCT40r+RODejlBKOUyEVv7vzm+8Tl5Uq28XQgR96KoSb3dXUWTu HjAvUar0M+cn0lRPyLPXfiM8+E4pJgV8Tlpvj31cgF5HlyN90YGI3KJv14WSqr/OoCWc zHcrwcSZzQHVVID3hcTqNYDiyOhOr2KiB++8gR+eSSsPfx7E2GwHBxwrbqDe4OS+q951 jENx5wL/Y+yLj+hFIg26BVRZu4gLReb39HIazCL3DHZD/ixfUP96uyM3BiZvS9jOKjJ4 L89g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=gIQMf4SltSejANF4Gl5TJd9QHAPLK+5OGd/Ed4gc4+E=; b=cGEYMF6I4d/I8x6QP6i5+hmS5CnvNOqD8DgEiL5refInn9ntOeonGno7Jz/t+kalFZ HXsfd0TY+N+bO3UPYDAFtYCh5lxxu5CKkkkrZ4Giu7yq3cQQDy/d5rgHPCB1Y9FaFyKX FN0Fa/6scnEEbCQNrWsStjYKlyTj2We5+XCoTmjWORSs3LJdg3H2PXjudh5h+0ECwidc LPS8McpUuJkA8j3jfpBUWXZffW+cLQ4lBiFxfZBkGW9XMADyRepuWLDYFekEOGp6Ktgj JLWf/xcYDkCDJrCKElLeTgdFAW8ENN83CDVlqy9iJXTBEhroO//0Q1yr/xvywVZalRKW nJXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="mm7BQ/nm"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a190-20020a6390c7000000b00519009eb504si4846012pge.96.2023.04.21.08.44.17; Fri, 21 Apr 2023 08:44:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="mm7BQ/nm"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232502AbjDUPhw (ORCPT + 99 others); Fri, 21 Apr 2023 11:37:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231955AbjDUPhv (ORCPT ); Fri, 21 Apr 2023 11:37:51 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9361E5C for ; Fri, 21 Apr 2023 08:37:50 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 81A16218D5; Fri, 21 Apr 2023 15:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1682091469; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gIQMf4SltSejANF4Gl5TJd9QHAPLK+5OGd/Ed4gc4+E=; b=mm7BQ/nmqSghYxASMnnMXk+jOM4yIdtEYUg6yS1lbjvkDYxvdJoA5Zf6DuBY4EBGJGVchU NxcbTYJHoZVkwEBzudXUMo7MNqkZJslTDaG2lCnP9x6ggU6XoMHZjKKQOglxbLafFUx51Z x8Jf3TWyyahf13pD5B9g0ofsP+dEtBM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1682091469; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gIQMf4SltSejANF4Gl5TJd9QHAPLK+5OGd/Ed4gc4+E=; b=kd/1dBUYfltRJdnIhWVr+hiOkPu8MY5wVAFS3AVoYP8+QjebPLMt981NX49NeV9VOwKHQ9 Hzx3ajnHEUDZ7tCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 443331390E; Fri, 21 Apr 2023 15:37:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id OZLED82tQmQiIwAAMHmgww (envelope-from ); Fri, 21 Apr 2023 15:37:49 +0000 Date: Fri, 21 Apr 2023 17:37:48 +0200 Message-ID: <87cz3xqm9f.wl-tiwai@suse.de> From: Takashi Iwai To: Chris Down Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Jaroslav Kysela , Takashi Iwai Subject: Re: [PATCH] usb-audio: Rate limit usb_set_interface error reporting In-Reply-To: References: <87wn25qosu.wl-tiwai@suse.de> <87mt31qngg.wl-tiwai@suse.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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);