diff mbox series

[05/25] ASoC: soc.h: add snd_soc_card_is_instantiated() helper

Message ID 873585lmdn.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State Superseded
Headers show
Series ASoC: use helper function and cleanup | expand

Commit Message

Kuninori Morimoto Jan. 20, 2023, 7:02 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC framework/driver checks whether card was instantiated every
where. Then, it should check card pointer too in such case.
This patch adds snd_soc_card_is_instantiated() for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Charles Keepax Jan. 20, 2023, 11:14 a.m. UTC | #1
On Fri, Jan 20, 2023 at 07:02:13AM +0000, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> ASoC framework/driver checks whether card was instantiated every
> where. Then, it should check card pointer too in such case.
> This patch adds snd_soc_card_is_instantiated() for it.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles
diff mbox series

Patch

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 37bbfc8b45cb..e58b43b5da7c 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1052,6 +1052,12 @@  struct snd_soc_card {
 #define for_each_card_widgets_safe(card, w, _w)	\
 	list_for_each_entry_safe(w, _w, &card->widgets, list)
 
+
+static inline int snd_soc_card_is_instantiated(struct snd_soc_card *card)
+{
+	return card && card->instantiated;
+}
+
 /* SoC machine DAI configuration, glues a codec and cpu DAI together */
 struct snd_soc_pcm_runtime {
 	struct device *dev;