ASoC: audio-graph-card.c: move audio_graph_parse_of()

Current audio-graph-card functions definition are like below

(A)'	static int graph_get_dais_count();

(B)	int audio_graph_parse_of(...)
	{
		...
(A)		ret = graph_get_dais_count();
		...
	}

(A)	static int graph_get_dais_count(...)
	{
		...
	}
(C)

We don't need to have (A)' definition if audio_graph_parse_of() (B) was
defined at (C). This patch moves (B) to (C).

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87r0ntmc3c.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org
This commit is contained in:
Kuninori Morimoto 2023-08-24 02:02:49 +00:00 committed by Mark Brown
parent 2b59332ead
commit 45b4878b03
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -425,77 +425,6 @@ static int graph_for_each_link(struct asoc_simple_priv *priv,
return ret;
}
static int graph_get_dais_count(struct asoc_simple_priv *priv,
struct link_info *li);
int audio_graph_parse_of(struct asoc_simple_priv *priv, struct device *dev)
{
struct snd_soc_card *card = simple_priv_to_card(priv);
struct link_info *li;
int ret;
li = devm_kzalloc(dev, sizeof(*li), GFP_KERNEL);
if (!li)
return -ENOMEM;
card->owner = THIS_MODULE;
card->dev = dev;
ret = graph_get_dais_count(priv, li);
if (ret < 0)
return ret;
if (!li->link)
return -EINVAL;
ret = asoc_simple_init_priv(priv, li);
if (ret < 0)
return ret;
priv->pa_gpio = devm_gpiod_get_optional(dev, "pa", GPIOD_OUT_LOW);
if (IS_ERR(priv->pa_gpio)) {
ret = PTR_ERR(priv->pa_gpio);
dev_err(dev, "failed to get amplifier gpio: %d\n", ret);
return ret;
}
ret = asoc_simple_parse_widgets(card, NULL);
if (ret < 0)
return ret;
ret = asoc_simple_parse_routing(card, NULL);
if (ret < 0)
return ret;
memset(li, 0, sizeof(*li));
ret = graph_for_each_link(priv, li,
graph_dai_link_of,
graph_dai_link_of_dpcm);
if (ret < 0)
goto err;
ret = asoc_simple_parse_card_name(card, NULL);
if (ret < 0)
goto err;
snd_soc_card_set_drvdata(card, priv);
asoc_simple_debug_info(priv);
ret = devm_snd_soc_register_card(dev, card);
if (ret < 0)
goto err;
devm_kfree(dev, li);
return 0;
err:
asoc_simple_clean_reference(card);
return dev_err_probe(dev, ret, "parse error\n");
}
EXPORT_SYMBOL_GPL(audio_graph_parse_of);
static int graph_count_noml(struct asoc_simple_priv *priv,
struct device_node *cpu_ep,
struct device_node *codec_ep,
@ -612,6 +541,74 @@ static int graph_get_dais_count(struct asoc_simple_priv *priv,
graph_count_dpcm);
}
int audio_graph_parse_of(struct asoc_simple_priv *priv, struct device *dev)
{
struct snd_soc_card *card = simple_priv_to_card(priv);
struct link_info *li;
int ret;
li = devm_kzalloc(dev, sizeof(*li), GFP_KERNEL);
if (!li)
return -ENOMEM;
card->owner = THIS_MODULE;
card->dev = dev;
ret = graph_get_dais_count(priv, li);
if (ret < 0)
return ret;
if (!li->link)
return -EINVAL;
ret = asoc_simple_init_priv(priv, li);
if (ret < 0)
return ret;
priv->pa_gpio = devm_gpiod_get_optional(dev, "pa", GPIOD_OUT_LOW);
if (IS_ERR(priv->pa_gpio)) {
ret = PTR_ERR(priv->pa_gpio);
dev_err(dev, "failed to get amplifier gpio: %d\n", ret);
return ret;
}
ret = asoc_simple_parse_widgets(card, NULL);
if (ret < 0)
return ret;
ret = asoc_simple_parse_routing(card, NULL);
if (ret < 0)
return ret;
memset(li, 0, sizeof(*li));
ret = graph_for_each_link(priv, li,
graph_dai_link_of,
graph_dai_link_of_dpcm);
if (ret < 0)
goto err;
ret = asoc_simple_parse_card_name(card, NULL);
if (ret < 0)
goto err;
snd_soc_card_set_drvdata(card, priv);
asoc_simple_debug_info(priv);
ret = devm_snd_soc_register_card(dev, card);
if (ret < 0)
goto err;
devm_kfree(dev, li);
return 0;
err:
asoc_simple_clean_reference(card);
return dev_err_probe(dev, ret, "parse error\n");
}
EXPORT_SYMBOL_GPL(audio_graph_parse_of);
static int graph_probe(struct platform_device *pdev)
{
struct asoc_simple_priv *priv;