Commit 582f3503 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: audio-graph: tidyup graph_parse_node()

audio-graph is using cpus->dai_name / codecs->dai_name for
dailink->name.
In graph_parse_node(), xxx->dai_name is got by
snd_soc_get_dai_name(), but it might be removed soon by
asoc_simple_canonicalize_cpu().

The order should be
	*1) call snd_soc_get_dai_name()
	 2) create dailink name
	*3) call asoc_simple_canonicalize_cpu()

* are implemented in graph_parse_node().
This patch remove 3) from graph_parse_node()
Reported-by: default avatar"kernelci.org bot" <bot@kernelci.org>
Fixes: 8859f809 ("ASoC: audio-graph: add graph_parse_node()")
Fixes: e51237b8 ("ASoC: audio-graph: add graph_link_init()")
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: default avatarMichael Walle <michael@walle.cc>
Link: https://lore.kernel.org/r/87cztyawzr.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f8090ffc
...@@ -209,7 +209,7 @@ static void graph_parse_mclk_fs(struct device_node *top, ...@@ -209,7 +209,7 @@ static void graph_parse_mclk_fs(struct device_node *top,
static int graph_parse_node(struct asoc_simple_priv *priv, static int graph_parse_node(struct asoc_simple_priv *priv,
struct device_node *ep, struct device_node *ep,
struct link_info *li, struct link_info *li,
int is_cpu) int *cpu)
{ {
struct device *dev = simple_priv_to_dev(priv); struct device *dev = simple_priv_to_dev(priv);
struct device_node *top = dev->of_node; struct device_node *top = dev->of_node;
...@@ -217,9 +217,9 @@ static int graph_parse_node(struct asoc_simple_priv *priv, ...@@ -217,9 +217,9 @@ static int graph_parse_node(struct asoc_simple_priv *priv,
struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link);
struct snd_soc_dai_link_component *dlc; struct snd_soc_dai_link_component *dlc;
struct asoc_simple_dai *dai; struct asoc_simple_dai *dai;
int ret, single = 0; int ret;
if (is_cpu) { if (cpu) {
dlc = asoc_link_to_cpu(dai_link, 0); dlc = asoc_link_to_cpu(dai_link, 0);
dai = simple_props_to_dai_cpu(dai_props, 0); dai = simple_props_to_dai_cpu(dai_props, 0);
} else { } else {
...@@ -229,7 +229,7 @@ static int graph_parse_node(struct asoc_simple_priv *priv, ...@@ -229,7 +229,7 @@ static int graph_parse_node(struct asoc_simple_priv *priv,
graph_parse_mclk_fs(top, ep, dai_props); graph_parse_mclk_fs(top, ep, dai_props);
ret = asoc_simple_parse_dai(ep, dlc, &single); ret = asoc_simple_parse_dai(ep, dlc, cpu);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -241,9 +241,6 @@ static int graph_parse_node(struct asoc_simple_priv *priv, ...@@ -241,9 +241,6 @@ static int graph_parse_node(struct asoc_simple_priv *priv,
if (ret < 0) if (ret < 0)
return ret; return ret;
if (is_cpu)
asoc_simple_canonicalize_cpu(dlc, single);
return 0; return 0;
} }
...@@ -288,6 +285,7 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, ...@@ -288,6 +285,7 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
if (li->cpu) { if (li->cpu) {
struct snd_soc_card *card = simple_priv_to_card(priv); struct snd_soc_card *card = simple_priv_to_card(priv);
struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0); struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0);
int is_single_links = 0;
/* Codec is dummy */ /* Codec is dummy */
...@@ -295,7 +293,7 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, ...@@ -295,7 +293,7 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
dai_link->dynamic = 1; dai_link->dynamic = 1;
dai_link->dpcm_merged_format = 1; dai_link->dpcm_merged_format = 1;
ret = graph_parse_node(priv, cpu_ep, li, 1); ret = graph_parse_node(priv, cpu_ep, li, &is_single_links);
if (ret) if (ret)
return ret; return ret;
...@@ -313,6 +311,8 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, ...@@ -313,6 +311,8 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
*/ */
if (card->component_chaining && !soc_component_is_pcm(cpus)) if (card->component_chaining && !soc_component_is_pcm(cpus))
dai_link->no_pcm = 1; dai_link->no_pcm = 1;
asoc_simple_canonicalize_cpu(cpus, is_single_links);
} else { } else {
struct snd_soc_codec_conf *cconf = simple_props_to_codec_conf(dai_props, 0); struct snd_soc_codec_conf *cconf = simple_props_to_codec_conf(dai_props, 0);
struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0); struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0);
...@@ -325,7 +325,7 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, ...@@ -325,7 +325,7 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
dai_link->no_pcm = 1; dai_link->no_pcm = 1;
dai_link->be_hw_params_fixup = asoc_simple_be_hw_params_fixup; dai_link->be_hw_params_fixup = asoc_simple_be_hw_params_fixup;
ret = graph_parse_node(priv, codec_ep, li, 0); ret = graph_parse_node(priv, codec_ep, li, NULL);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -367,20 +367,23 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv, ...@@ -367,20 +367,23 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv,
struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0); struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0);
struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0); struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0);
char dai_name[64]; char dai_name[64];
int ret; int ret, is_single_links = 0;
dev_dbg(dev, "link_of (%pOF)\n", cpu_ep); dev_dbg(dev, "link_of (%pOF)\n", cpu_ep);
ret = graph_parse_node(priv, cpu_ep, li, 1); ret = graph_parse_node(priv, cpu_ep, li, &is_single_links);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = graph_parse_node(priv, codec_ep, li, 0); ret = graph_parse_node(priv, codec_ep, li, NULL);
if (ret < 0) if (ret < 0)
return ret; return ret;
snprintf(dai_name, sizeof(dai_name), snprintf(dai_name, sizeof(dai_name),
"%s-%s", cpus->dai_name, codecs->dai_name); "%s-%s", cpus->dai_name, codecs->dai_name);
asoc_simple_canonicalize_cpu(cpus, is_single_links);
ret = graph_link_init(priv, cpu_ep, codec_ep, li, dai_name); ret = graph_link_init(priv, cpu_ep, codec_ep, li, dai_name);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment