[alsa-devel] [PATCH] soc-core: let suspend/resume not called if the card is not instantiated

Barry Song 21cnbao at gmail.com
Fri Nov 13 05:51:18 CET 2009


It doesn't make sense to call suspend/resume of all cpu/codec dais even
they are not initialized and registered. This will cause many problems
foraudio PM.
The condition card is not instantiated covers codec is null, so delete
the check that codec is null.

Signed-off-by: Barry Song <21cnbao at gmail.com>
---
 sound/soc/soc-core.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index e2b6d75..097f3b9 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -796,10 +796,7 @@ static int soc_suspend(struct device *dev)
 	struct snd_soc_codec *codec = card->codec;
 	int i;
 
-	/* If the initialization of this soc device failed, there is no codec
-	 * associated with it. Just bail out in this case.
-	 */
-	if (!codec)
+	if (!card->instantiated)
 		return 0;
 
 	/* Due to the resume being scheduled into a workqueue we could
@@ -940,6 +937,9 @@ static int soc_resume(struct device *dev)
 	struct snd_soc_card *card = socdev->card;
 	struct snd_soc_dai *cpu_dai = card->dai_link[0].cpu_dai;
 
+	if (!card->instantiated)
+		return 0;
+
 	/* AC97 devices might have other drivers hanging off them so
 	 * need to resume immediately.  Other drivers don't have that
 	 * problem and may take a substantial amount of time to resume
-- 
1.5.6.3



More information about the Alsa-devel mailing list