Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5451143rwb; Wed, 7 Sep 2022 03:06:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR7MeFnN+a8tli7evJyXbVj+wpsQ52beM6mn3R9H54dY8xTnkvTrPba9fK/tvvn5x/lCGIMV X-Received: by 2002:a17:903:2410:b0:171:4bbc:2526 with SMTP id e16-20020a170903241000b001714bbc2526mr3153438plo.62.1662545172648; Wed, 07 Sep 2022 03:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662545172; cv=none; d=google.com; s=arc-20160816; b=iFjwKFpfRL3vOjVyYowr/5AFxLxQp3E19i1bY0tzhkigAyQG/HQG6MMClzgzmQVXmh +zRTjZ0tyQU/L0bgM3HVTE734IkHgx4jnoZUfD9ENIFuo9PToxLY73KSBExhyrhXKNLI CihEfxDK6r/OlK3nmH64i0sEHf42XG/j43lTLDMc2j369kNiFHb17/CKBcSOZX1OehGw AY9R/w6iC/MQs6p4OcGAq6Fc/C4IvmldPNG68WK17CMA2RPrtkhmf+e0FyKVu0Dq6m15 uMVUMNGgDD65Dp6sd5WrXRQg1GpMSmEeTJl3rMrQXdEy7CiH28POBai8gSHI+csd8pQk 4saw== 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=ze00JS9YGRsmAOsgdNY0pIe743MLOM0ULC1uIhk+gSI=; b=u4PMe8N7neUkuZLszmUPB3XVp9usJ8n7AXGcLEyM1dr4oJSWUi9cQlIx3YRVMwEb+e 1a2eKXXozwAWSUy0f39e+hqyya3zDD3Kdheo/VHiP8IjRHpvHyyKZdY53/oN7HzUIeU/ q6lyPkvJqhalArz6zbHB/1du6cnttXhELaqJH2VT7f/hssy8zbsqPJuEs//XG1BXJTA7 Y5hJKUBPPz5tIHu5o10YWD+gUrDWAFs/UT5B9Waeb1FNuOL5gXkxQ5r/YFXLaZVfTYFq lakbOuztg+aYWSSzuLk5yVf3E05JjZfR4QKWeb1GpkuWNf9RZmpewUEbOn2tXXK9fjA6 7oLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="pdv/adkq"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=tfRWsEJs; 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 m17-20020a170902db1100b001713e8ccf07si18271051plx.376.2022.09.07.03.05.59; Wed, 07 Sep 2022 03:06:12 -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="pdv/adkq"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=tfRWsEJs; 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 S230026AbiIGJll (ORCPT + 99 others); Wed, 7 Sep 2022 05:41:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229889AbiIGJlk (ORCPT ); Wed, 7 Sep 2022 05:41:40 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB3A6816AC; Wed, 7 Sep 2022 02:41:35 -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-out2.suse.de (Postfix) with ESMTPS id 5E3CA20244; Wed, 7 Sep 2022 09:41:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1662543694; 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=ze00JS9YGRsmAOsgdNY0pIe743MLOM0ULC1uIhk+gSI=; b=pdv/adkqMdjWaF2y66ATUsR60vbM0O7UPXb51iHgb0pEVrf2UvXNh2FnzLyBfipQ/7kGYo 4+nN5w1A8fFBp5LhtY2fDYqTFJPASxc7vdDUIuDH9ZOcJLBO/yrlNdKmXgqDz6vy5c8b06 DYke03vLgwuchnkpTR9hkqh0pmQJrxg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1662543694; 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=ze00JS9YGRsmAOsgdNY0pIe743MLOM0ULC1uIhk+gSI=; b=tfRWsEJswRREbJ4G7TnFuakduyK92hysTRuQg0+KaImRZDoFb9k3Qum09HGJppbgLLictf Hh1c6TT5AnnyJwCA== 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 4A08813486; Wed, 7 Sep 2022 09:41:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1TesEU5nGGMwNQAAMHmgww (envelope-from ); Wed, 07 Sep 2022 09:41:34 +0000 Date: Wed, 07 Sep 2022 11:41:33 +0200 Message-ID: <878rmvmshe.wl-tiwai@suse.de> From: Takashi Iwai To: "Jason A. Donenfeld" Cc: alsa-devel@alsa-project.org, LKML , stable , =?ISO-8859-4?Q?Nikl=E0vs_Ko=B6es=F1ikovs?= <89q1r14hd@relay.firefox.com>, Wim Taymans Subject: Re: [PATCH] ALSA: usb-audio: Don't refcount multiple accesses on the single clock In-Reply-To: References: <20220905101403.1435037-1-Jason@zx2c4.com> <87sfl6jbb3.wl-tiwai@suse.de> <87czc7ehqp.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 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 Wed, 07 Sep 2022 11:28:54 +0200, Jason A. Donenfeld wrote: > > On Wed, Sep 07, 2022 at 10:00:46AM +0200, Takashi Iwai wrote: > > On Mon, 05 Sep 2022 14:16:39 +0200, > > Jason A. Donenfeld wrote: > > > > > > On Mon, Sep 5, 2022 at 1:44 PM Takashi Iwai wrote: > > > > When you load snd-usb-audio with dyndbg=+p option, does it show the > > > > new error message "Mismatched sample rate xxx"? > > > > > > No. > > > > What about the patch below? > > > > > > Takashi > > > > -- 8< -- > > --- a/sound/usb/endpoint.c > > +++ b/sound/usb/endpoint.c > > @@ -925,6 +925,8 @@ void snd_usb_endpoint_close(struct snd_usb_audio *chip, > > endpoint_set_interface(chip, ep, false); > > > > if (!--ep->opened) { > > + if (ep->clock_ref && !atomic_read(&ep->clock_ref->locked)) > > + ep->clock_ref->rate = 0; > > ep->iface = 0; > > ep->altsetting = 0; > > ep->cur_audiofmt = NULL; > > I think this works. OK, thanks. If this patch fixes, the problem is that the behavior of the applications that do only PCM prepare without actually starting, then closes. This left the last set rate unexpectedly. I'm going to write up the proper patch. Takashi