diff mbox series

[13/19] ASoC: soc-card: add snd_soc_card_probe()

Message ID 87y2pf1ok8.wl-kuninori.morimoto.gx@renesas.com
State Accepted
Commit 73de4b026850da432b8bcfb73fc4af94674a8102
Headers show
Series [01/19] ASoC: soc.h: convert bool to bit field for snd_soc_card | expand

Commit Message

Kuninori Morimoto May 26, 2020, 1:18 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h |  2 ++
 sound/soc/soc-card.c     | 20 ++++++++++++++++++++
 sound/soc/soc-core.c     |  9 +++------
 3 files changed, 25 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index a54711b5c58f..38bb25428446 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -24,6 +24,8 @@  int snd_soc_card_suspend_post(struct snd_soc_card *card);
 int snd_soc_card_resume_pre(struct snd_soc_card *card);
 int snd_soc_card_resume_post(struct snd_soc_card *card);
 
+int snd_soc_card_probe(struct snd_soc_card *card);
+
 /* 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 e3b75e0640ab..49516fe7c54c 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -119,3 +119,23 @@  int snd_soc_card_resume_post(struct snd_soc_card *card)
 
 	return soc_card_ret(card, ret);
 }
+
+int snd_soc_card_probe(struct snd_soc_card *card)
+{
+	if (card->probe) {
+		int ret = card->probe(card);
+
+		if (ret < 0)
+			return soc_card_ret(card, ret);
+
+		/*
+		 * set probed here
+		 * see
+		 *	snd_soc_bind_card()
+		 *	snd_soc_card_late_probe()
+		 */
+		card->probed = 1;
+	}
+
+	return 0;
+}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 7cfb3ee6ff4f..13a7d5158534 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1825,12 +1825,9 @@  static int snd_soc_bind_card(struct snd_soc_card *card)
 		goto probe_end;
 
 	/* initialise the sound card only once */
-	if (card->probe) {
-		ret = card->probe(card);
-		if (ret < 0)
-			goto probe_end;
-		card->probed = 1;
-	}
+	ret = snd_soc_card_probe(card);
+	if (ret < 0)
+		goto probe_end;
 
 	/* probe all components used by DAI links on this card */
 	ret = soc_probe_link_components(card);