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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05884C43334 for ; Mon, 25 Jul 2022 14:43:52 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 38399112; Mon, 25 Jul 2022 16:43:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 38399112 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1658760230; bh=cPvlS0x1ixXOKpFae4QJiIADvvLZeb+OSOmV7SfhXY4=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=uZRHmjrUxWcQOUFLkBn5Nmnuq9Mx3Ylev95pjipsSlURZ3FaBZap4PMuhRNoWCyYU 29BA63ZtT8vYmXcnmq4KsUqDVVgmLV4RmM29oawAdYIz/5RtiYugGK7p/PIZAcCbW5 XevAUWcqhXFhpiXhR9QV2A6hawOSoyLUISGwYbpU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B0FBBF80155; Mon, 25 Jul 2022 16:42:59 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 82BFEF80163; Mon, 25 Jul 2022 16:42:57 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A6F41F80128 for ; Mon, 25 Jul 2022 16:42:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A6F41F80128 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="N+CXARJp"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Ih8d0XDR" 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 6A63134E0C; Mon, 25 Jul 2022 14:42:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1658760171; 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=TECSX5Gn0ZjFmgqf0jP/q64yC5a9YIK4SITdughLIQk=; b=N+CXARJp7g6FlkSDbhydM0ZMktK9lbcILdqI/U+ZshwRe8TGZBgRHvx36NtUwrmJ1nUlQ0 X8iRj3U9RIpMtfEp51E+JLrWGWSWylEu7HZxwQb7DgQjbshHJ5iFX30NLhmGswwkbd5/hO kGC3qT9GVp5Vgrhbdt4/7axlZLTgmdc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1658760171; 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=TECSX5Gn0ZjFmgqf0jP/q64yC5a9YIK4SITdughLIQk=; b=Ih8d0XDRbbaLLnjQ9y6w3FPCXlxS0tsUImcZHiAXgdDojhL4pCSOley8dvajo+RMu8+xGH rffZsY1vxJB1x9Cg== 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 5166C13A8D; Mon, 25 Jul 2022 14:42:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QdgWE+ur3mL6HQAAMHmgww (envelope-from ); Mon, 25 Jul 2022 14:42:51 +0000 Date: Mon, 25 Jul 2022 16:42:50 +0200 Message-ID: <87ilnlb6dx.wl-tiwai@suse.de> From: Takashi Iwai To: Kuninori Morimoto Subject: Re: Question about DPCM locking In-Reply-To: <875ykmx0vt.wl-kuninori.morimoto.gx@renesas.com> References: <875ykmx0vt.wl-kuninori.morimoto.gx@renesas.com> 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 Cc: Linux-ALSA X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Mon, 27 Jun 2022 05:04:38 +0200, Kuninori Morimoto wrote: > > > Hi Takashi > > May I ask about this patch ? > > ASoC: soc-pcm: Fix and cleanup DPCM locking > b7898396f4bbe160f546d0c5e9fa17cca9a7d153 Sorry for the very late response. It's been completely overlooked. > Q1. > > It exchanges many function parameters > > - func(substream, xxx) > + func(rtd, substream, xxx) > ^^^^ > > I guess the purpose is it want to call snd_soc_dpcm_mutex_assert_held() > inside the func ? But it looks very verbose. > we can do like this, but am I misunderstanding ? > > func(substream, xxx) { > struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); > > snd_soc_dpcm_mutex_assert_held(rtd); > > ... > } This could be changed in that way, too. I just took the current code as the compiler produced a bit better code. > Q2. > > It added new __soc_pcm_close(). > But soc_pcm_close() is using soc_pcm_clean() instead of __soc_pcm_close(). > Is this just a mistake ? > > static int soc_pcm_close(struct snd_pcm_substream *substream) > { > struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); > > snd_soc_dpcm_mutex_lock(rtd); > - soc_pcm_clean(substream, 0); > + __soc_pcm_close(substream); > snd_soc_dpcm_mutex_unlock(rtd); > return 0; > } Not really a mistake, as you can see, that's the very same code :) That said, it's fine to call __soc_pcm_close() there instead of the open code, too, as long as the resultant binary becomes same (or better). thanks, Takashi