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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AC54C3F2CD for ; Tue, 3 Mar 2020 00:44:59 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A9FA924673 for ; Tue, 3 Mar 2020 00:44:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="WuB2U2vZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9FA924673 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 09F3E1676; Tue, 3 Mar 2020 01:44:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 09F3E1676 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1583196297; bh=pOJhz/1frry6VXpb3dnLI2KcSBCuXgpwO2KQEW+GtK0=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=WuB2U2vZ52kBBSlqweDLLpAzAooNzqcBGulJ3ZqECKRjLKcuH0TbZ+hJVlO9WV/W7 btKKwLqtADtsT3IG51m4E+q9PL9tWl3lFXwPsSOxEkMEymibC+HBMBEUG6h6iKt2LI zckZonwQHw5VKAW0faGYh8NThJ7X76k6P0bNGJtw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6B01EF80130; Tue, 3 Mar 2020 01:44:06 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 725FAF801ED; Tue, 3 Mar 2020 01:44:04 +0100 (CET) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 0ECE5F80130 for ; Tue, 3 Mar 2020 01:43:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0ECE5F80130 Date: 03 Mar 2020 09:43:53 +0900 X-IronPort-AV: E=Sophos;i="5.70,509,1574089200"; d="scan'208";a="40556374" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 03 Mar 2020 09:43:53 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 8736D4008C52; Tue, 3 Mar 2020 09:43:53 +0900 (JST) Message-ID: <8736aq2rp2.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Kai Vehmanen Subject: Re: [PATCH] ASoC: soc-pcm: Revert "call snd_soc_component_open/close() once" In-Reply-To: References: <20200219182650.1416-1-kai.vehmanen@linux.intel.com> <87blput7hh.wl-kuninori.morimoto.gx@renesas.com> <87mu9cspyf.wl-kuninori.morimoto.gx@renesas.com> <87mu978pob.wl-kuninori.morimoto.gx@renesas.com> <87ftey88wk.wl-kuninori.morimoto.gx@renesas.com> <874kvb7d38.wl-kuninori.morimoto.gx@renesas.com> <871rqf6xas.wl-kuninori.morimoto.gx@renesas.com> <87zhd35eko.wl-kuninori.morimoto.gx@renesas.com> <87d09vha51.wl-kuninori.morimoto.gx@renesas.com> User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: alsa-devel@alsa-project.org, broonie@kernel.org, ranjani.sridharan@linux.intel.com, digetx@gmail.com, pierre-louis.bossart@linux.intel.com 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" Hi Kai Thank you for your feedback > /* add list of opened substreams to snd_soc_component */ > struct snd_soc_component { > ... > struct list_head substream_list; >=20 > int snd_soc_component_open(struct snd_soc_component *component, > =BB =BB =BB struct snd_pcm_substream *substream) > { > int res =3D 0; > if (component->driver->open) > res =3D component->driver->open(component, substream); >=20 > /* on success, add proxy of substream to component->substream_lis= t */ > ... >=20 > int snd_soc_component_close(struct snd_soc_component *component, > =BB =BB =BB struct snd_pcm_substream *substream) > { > /*=20 > * lookup substream from "component->substream_List",=20 > * only call driver->close() if found > */ > ... >=20 >=20 > ... this is arguably more code, but makes the state created in=20 > snd_soc_component_open() explicit. Upon error in middle of=20 > components_open(), one can just call soc_pcm_components_close() which wil= l=20 > close all components for that substream (that had been succesfully=20 > opened). k Yes, totally agree to your code. But, 1 point I still not yet understand. close() will be called 1) when open failed, or, 2) normal close. If my understanding was correct, your code is caring that 2) normal close() might be called without open(). I don't think it happen, but are you worrying that it might be happen by some BUG, or for some accident ? If so, I can 100% understand your idea. Thank you for your help !! Best regards --- Kuninori Morimoto