From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
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 kuninori.morimoto.gx@renesas.com --- 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;