[PATCH 18/19] ASoC: soc-card: add snd_soc_card_add_dai_link()
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Tue May 26 03:19:15 CEST 2020
From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
Card related function should be implemented at soc-card now.
This patch adds it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
include/sound/soc-card.h | 3 +++
sound/soc/soc-card.c | 12 ++++++++++++
sound/soc/soc-core.c | 5 +++--
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 54341e4d818a..501d3d5b6efb 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -35,6 +35,9 @@ int snd_soc_card_set_bias_level_post(struct snd_soc_card *card,
struct snd_soc_dapm_context *dapm,
enum snd_soc_bias_level level);
+int snd_soc_card_add_dai_link(struct snd_soc_card *card,
+ struct snd_soc_dai_link *dai_link);
+
/* device driver data */
static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
void *data)
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 8db3b98d1c80..3886e6f2dbc3 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -196,3 +196,15 @@ int snd_soc_card_set_bias_level_post(struct snd_soc_card *card,
return soc_card_ret(card, ret);
}
+
+int snd_soc_card_add_dai_link(struct snd_soc_card *card,
+ struct snd_soc_dai_link *dai_link)
+{
+ int ret = 0;
+
+ if (card->add_dai_link)
+ ret = card->add_dai_link(card, dai_link);
+
+ return soc_card_ret(card, ret);
+}
+EXPORT_SYMBOL_GPL(snd_soc_card_add_dai_link);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 136ff7237a80..d238b47252a5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -978,8 +978,9 @@ int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
/*
* Notify the machine driver for extra initialization
*/
- if (card->add_dai_link)
- card->add_dai_link(card, dai_link);
+ ret = snd_soc_card_add_dai_link(card, dai_link);
+ if (ret < 0)
+ return ret;
if (dai_link->ignore)
return 0;
--
2.17.1
More information about the Alsa-devel
mailing list