Title: [7655] trunk/sound/soc/soc-core.c: [soc-core] Fix dai->ops NULL bug for AC97 codec dai
Revision
7655
Author
bhsong
Date
2009-10-15 06:29:19 -0400 (Thu, 15 Oct 2009)

Log Message

[soc-core] Fix dai->ops NULL bug for AC97 codec dai
AC97 codec dai don't register itself, then it loses to the chance to be given a null_dai_ops
in snd_soc_register_dai, while access the ops field in the dai, panic will happen

And this fix make ad1980 work too.

Modified Paths

Diff

Modified: trunk/sound/soc/soc-core.c (7654 => 7655)


--- trunk/sound/soc/soc-core.c	2009-10-15 10:00:30 UTC (rev 7654)
+++ trunk/sound/soc/soc-core.c	2009-10-15 10:29:19 UTC (rev 7655)
@@ -793,6 +793,9 @@
 #define soc_resume	NULL
 #endif
 
+static struct snd_soc_dai_ops null_dai_ops = {
+};
+
 static void snd_soc_instantiate_card(struct snd_soc_card *card)
 {
 	struct platform_device *pdev = container_of(card->dev,
@@ -836,6 +839,12 @@
 			ac97 = 1;
 	}
 
+	for (i = 0; i < card->num_links; i++) {
+		if (card->dai_link[i].codec_dai->ac97_control &&
+				(!card->dai_link[i].codec_dai->ops))
+			card->dai_link[i].codec_dai->ops = &null_dai_ops;
+	}
+
 	/* If we have AC97 in the system then don't wait for the
 	 * codec.  This will need revisiting if we have to handle
 	 * systems with mixed AC97 and non-AC97 parts.  Only check for
@@ -2260,9 +2269,6 @@
 	return 0;
 }
 
-static struct snd_soc_dai_ops null_dai_ops = {
-};
-
 /**
  * snd_soc_register_dai - Register a DAI with the ASoC core
  *
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to