From patchwork Mon May 10 01:52:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 433201 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=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS autolearn=ham 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 D5750C433ED for ; Mon, 10 May 2021 01:54:39 +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 43E38613B6 for ; Mon, 10 May 2021 01:54:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43E38613B6 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 CF4C016B9; Mon, 10 May 2021 03:53:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CF4C016B9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1620611677; bh=uoKPvibia5Qf1gIoMR3ldr+jSucaLQLc8FHsVYCFdxE=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=WZO3WUGJdMDWq7B0VrI2R8Cwhhu0EdKjQ5bMSKVGB2iN3jlEHCasKWvnFJkd9dG1T YFrtJ9KNQ3p8KVZNNsBmxgme6l7x9ls6cCoqNYvMtmMuEL7VkYzWc9Hv7aT6DTYlEX aqmAIFz6TTFmxtzU/Oo5WZclWLF9PGWnyhBejG8I= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3EE3CF804AE; Mon, 10 May 2021 03:52:27 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 98F83F804AC; Mon, 10 May 2021 03:52:25 +0200 (CEST) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id A367FF80430 for ; Mon, 10 May 2021 03:52:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A367FF80430 Date: 10 May 2021 10:52:22 +0900 X-IronPort-AV: E=Sophos;i="5.82,286,1613401200"; d="scan'208";a="80553374" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 10 May 2021 10:52:22 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 2E7294013259; Mon, 10 May 2021 10:52:22 +0900 (JST) Message-ID: <877dk7cq3t.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 4/4] ASoC: audio-graph: tidyup dai_name seting timing User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Mark Brown , Michael Walle , Guillaume Tucker In-Reply-To: <87cztzcq56.wl-kuninori.morimoto.gx@renesas.com> References: <87cztzcq56.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") 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" From: Kuninori Morimoto audio-graph is using cpus->dai_name / codecs->dai_name for dailink->name, but cpus->dai_name might be removed under simple_parse_node() (= asoc_simple_canonicalize_cpu()). Thus we need to get dai_name before calling simple_parse_node(). This patch fixup it. To reduce future confusion, this patch follow same style for similar parts too. Fixes: 8859f809c7d5813 ("ASoC: audio-graph: add graph_parse_node()") Fixes: e51237b8d305225 ("ASoC: audio-graph: add graph_link_init()") Signed-off-by: Kuninori Morimoto --- sound/soc/generic/audio-graph-card.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 0159a4576e9c..f8fc3222710b 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -295,12 +295,13 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, dai_link->dynamic = 1; dai_link->dpcm_merged_format = 1; + snprintf(dai_name, sizeof(dai_name), + "fe.%pOFP.%s", cpus->of_node, cpus->dai_name); + ret = graph_parse_node(priv, cpu_ep, li, 1); if (ret) return ret; - snprintf(dai_name, sizeof(dai_name), - "fe.%pOFP.%s", cpus->of_node, cpus->dai_name); /* * In BE<->BE connections it is not required to create * PCM devices at CPU end of the dai link and thus 'no_pcm' @@ -325,13 +326,13 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, dai_link->no_pcm = 1; dai_link->be_hw_params_fixup = asoc_simple_be_hw_params_fixup; + snprintf(dai_name, sizeof(dai_name), + "be.%pOFP.%s", codecs->of_node, codecs->dai_name); + ret = graph_parse_node(priv, codec_ep, li, 0); if (ret < 0) return ret; - snprintf(dai_name, sizeof(dai_name), - "be.%pOFP.%s", codecs->of_node, codecs->dai_name); - /* check "prefix" from top node */ port = of_get_parent(ep); ports = of_get_parent(port); @@ -371,6 +372,13 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv, dev_dbg(dev, "link_of (%pOF)\n", cpu_ep); + /* + * next graph_parse_node() might remove cpus->dai_name. + * get dai_name before it. + */ + snprintf(dai_name, sizeof(dai_name), + "%s-%s", cpus->dai_name, codecs->dai_name); + ret = graph_parse_node(priv, cpu_ep, li, 1); if (ret < 0) return ret; @@ -379,8 +387,6 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv, if (ret < 0) return ret; - snprintf(dai_name, sizeof(dai_name), - "%s-%s", cpus->dai_name, codecs->dai_name); ret = graph_link_init(priv, cpu_ep, codec_ep, li, dai_name); if (ret < 0) return ret;