diff mbox series

[18/25] ASoC: soc-component: add snd_soc_component_is_suspended()

Message ID 87d0i0td5j.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show
Series ASoC: add soc-component.c | expand

Commit Message

Kuninori Morimoto July 24, 2019, 1:52 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current ALSA SoC is directly using component->xxx,
But, it is not good for encapsulation.
This patch adds new snd_soc_component_is_suspended() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-component.h | 1 +
 sound/soc/soc-component.c     | 5 +++++
 sound/soc/soc-core.c          | 5 ++---
 3 files changed, 8 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 52684d3..63e47cd 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -358,5 +358,6 @@  void snd_soc_component_pcm_free(struct snd_soc_component *component,
 				struct snd_pcm *pcm);
 void snd_soc_component_suspend(struct snd_soc_component *component);
 void snd_soc_component_resume(struct snd_soc_component *component);
+int snd_soc_component_is_suspended(struct snd_soc_component *component);
 
 #endif /* __SOC_COMPONENT_H */
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index d4b972c..fbb7493 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -433,3 +433,8 @@  void snd_soc_component_resume(struct snd_soc_component *component)
 		component->driver->resume(component);
 	component->suspended = 0;
 }
+
+int snd_soc_component_is_suspended(struct snd_soc_component *component)
+{
+	return component->suspended;
+}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 442d6a7..6283b17d 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -544,7 +544,7 @@  int snd_soc_suspend(struct device *dev)
 		 * If there are paths active then the COMPONENT will be held
 		 * with bias _ON and should not be suspended.
 		 */
-		if (!component->suspended) {
+		if (!snd_soc_component_is_suspended(component)) {
 			switch (snd_soc_dapm_get_bias_level(dapm)) {
 			case SND_SOC_BIAS_STANDBY:
 				/*
@@ -633,9 +633,8 @@  static void soc_resume_deferred(struct work_struct *work)
 	}
 
 	for_each_card_components(card, component) {
-		if (component->suspended) {
+		if (snd_soc_component_is_suspended(component))
 			snd_soc_component_resume(component);
-		}
 	}
 
 	for_each_card_rtds(card, rtd) {