ASoC: Fix active count tracking for CODEC to CODEC links
authorLars-Peter Clausen <lars@metafoo.de>
Wed, 5 Mar 2014 12:17:44 +0000 (13:17 +0100)
committerMark Brown <broonie@linaro.org>
Thu, 6 Mar 2014 09:04:55 +0000 (17:04 +0800)
For CODEC to CODEC links we need to make sure to also manage the 'active' field
of the cpu_dai CODEC.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/soc-pcm.c

index 1a9857519d65577a1156d4349df17b3b7b909ab8..71a01dda1867e54dbd4de8a6c268501ebb60df4d 100644 (file)
@@ -61,7 +61,9 @@ void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd, int stream)
 
        cpu_dai->active++;
        codec_dai->active++;
-       rtd->codec->active++;
+       if (cpu_dai->codec)
+               cpu_dai->codec->active++;
+       codec_dai->codec->active++;
 }
 
 /**
@@ -91,7 +93,9 @@ void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream)
 
        cpu_dai->active--;
        codec_dai->active--;
-       rtd->codec->active--;
+       if (cpu_dai->codec)
+               cpu_dai->codec->active--;
+       codec_dai->codec->active--;
 }
 
 /**