]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ASoC: when removing a CPU DAI, clean up its DAPM context
authorStephen Warren <swarren@nvidia.com>
Fri, 8 Jun 2012 18:34:21 +0000 (12:34 -0600)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 13 Jun 2012 12:18:04 +0000 (13:18 +0100)
When a standalone CPU DAI (one not part of a CODEC) is probed, widgets
are created for it. Add a call to snd_soc_dapm_free() in order to clean
these up when the CPU DAI is removed.

In order for snd_soc_dapm_free() to work, the CPU DAI's DAPM context's
list member must be initialized, since snd_soc_dapm_free() removes that
from the list it's part of. Add it to the card's list of DAPM contexts.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/soc-core.c

index 448d4a7c09dd3f8d3c4a8398de23302e29ce8a45..621c5bdea483b1afc30314c0b28e34b524739c65 100644 (file)
@@ -984,8 +984,10 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order)
                cpu_dai->probed = 0;
                list_del(&cpu_dai->card_list);
 
-               if (!cpu_dai->codec)
+               if (!cpu_dai->codec) {
+                       snd_soc_dapm_free(&cpu_dai->dapm);
                        module_put(cpu_dai->dev->driver->owner);
+               }
        }
 }
 
@@ -1264,6 +1266,7 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num, int order)
                        if (!try_module_get(cpu_dai->dev->driver->owner))
                                return -ENODEV;
 
+                       list_add(&cpu_dai->dapm.list, &card->dapm_list);
                        snd_soc_dapm_new_dai_widgets(&cpu_dai->dapm, cpu_dai);
                }