From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1967CECAAD3 for ; Wed, 7 Sep 2022 09:41:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230036AbiIGJlm (ORCPT ); Wed, 7 Sep 2022 05:41:42 -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 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