From: Kuninori Morimoto Date: Thu, 28 May 2020 01:49:26 +0000 (+0900) Subject: ASoC: soc-card: add snd_soc_card_remove() X-Git-Tag: v5.15~2585^2~131^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b0275d956fab05a5088e20244c8d1eb433b7b90f;p=platform%2Fkernel%2Flinux-starfive.git ASoC: soc-card: add snd_soc_card_remove() Card related function should be implemented at soc-card now. This patch adds it. Signed-off-by: Kuninori Morimoto Reviewed-by: Ranjani Sridharan Link: https://lore.kernel.org/r/87tv00zv4p.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h index 521dc05..97a34f0 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 317771d..920967a 100644 --- a/sound/soc/soc-card.c +++ b/sound/soc/soc-card.c @@ -166,3 +166,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 42e8c11..136ff72 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);