[PATCH] 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 --- sound/soc/generic/audio-graph-card.c | 139 +++++++++++++-------------- 1 file changed, 68 insertions(+), 71 deletions(-)
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 13693ef9c242..844a2ef15948 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -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;
On Thu, 24 Aug 2023 02:02:49 +0000, Kuninori Morimoto wrote:
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(); ... }
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: audio-graph-card.c: move audio_graph_parse_of() commit: 45b4878b0330e255059135dfab4e01d12feb5580
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (2)
-
Kuninori Morimoto
-
Mark Brown