[PATCH 15/19] ASoC: soc-card: add snd_soc_card_remove()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Tue May 26 03:18:50 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 |  1 +
 sound/soc/soc-card.c     | 13 +++++++++++++
 sound/soc/soc-core.c     |  4 +---
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 58b25963151a..b338bbd08219 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -26,6 +26,7 @@ int snd_soc_card_resume_post(struct snd_soc_card *card);
 
 int snd_soc_card_probe(struct snd_soc_card *card);
 int snd_soc_card_late_probe(struct snd_soc_card *card);
+int snd_soc_card_remove(struct snd_soc_card *card);
 
 /* device driver data */
 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 63bfcb0d1579..449f6cc86859 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -159,3 +159,16 @@ int snd_soc_card_late_probe(struct snd_soc_card *card)
 
 	return 0;
 }
+
+int snd_soc_card_remove(struct snd_soc_card *card)
+{
+	int ret = 0;
+
+	if (card->probed &&
+	    card->remove)
+		ret = card->remove(card);
+
+	card->probed = 0;
+
+	return soc_card_ret(card, ret);
+}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 42e8c11a0b26..136ff7237a80 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1747,9 +1747,7 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card)
 	soc_cleanup_card_debugfs(card);
 
 	/* remove the card */
-	if (card->probed && card->remove)
-		card->remove(card);
-	card->probed = 0;
+	snd_soc_card_remove(card);
 
 	if (card->snd_card) {
 		snd_card_free(card->snd_card);
-- 
2.17.1



More information about the Alsa-devel mailing list