]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: factor out soc_remove_platform()
authorStephen Warren <swarren@nvidia.com>
Fri, 8 Jun 2012 18:34:22 +0000 (12:34 -0600)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 13 Jun 2012 12:18:04 +0000 (13:18 +0100)
This change simply factors out part of soc_remove_dai_link() into a
standalone function. This makes platform and CODEC removal much more
similar at the call-sites.

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

index 621c5bdea483b1afc30314c0b28e34b524739c65..a539ade477af3429e885941639337fb1e304ee09 100644 (file)
@@ -898,6 +898,28 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
        return 0;
 }
 
+static int soc_remove_platform(struct snd_soc_platform *platform)
+{
+       int ret;
+
+       if (platform->driver->remove) {
+               ret = platform->driver->remove(platform);
+               if (ret < 0)
+                       pr_err("asoc: failed to remove %s: %d\n",
+                               platform->name, ret);
+       }
+
+       /* Make sure all DAPM widgets are freed */
+       snd_soc_dapm_free(&platform->dapm);
+
+       soc_cleanup_platform_debugfs(platform);
+       platform->probed = 0;
+       list_del(&platform->card_list);
+       module_put(platform->dev->driver->owner);
+
+       return 0;
+}
+
 static void soc_remove_codec(struct snd_soc_codec *codec)
 {
        int err;
@@ -950,22 +972,8 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order)
 
        /* remove the platform */
        if (platform && platform->probed &&
-                       platform->driver->remove_order == order) {
-               if (platform->driver->remove) {
-                       err = platform->driver->remove(platform);
-                       if (err < 0)
-                               pr_err("asoc: failed to remove %s: %d\n",
-                                                       platform->name, err);
-               }
-
-               /* Make sure all DAPM widgets are freed */
-               snd_soc_dapm_free(&platform->dapm);
-
-               soc_cleanup_platform_debugfs(platform);
-               platform->probed = 0;
-               list_del(&platform->card_list);
-               module_put(platform->dev->driver->owner);
-       }
+                       platform->driver->remove_order == order)
+               soc_remove_platform(platform);
 
        /* remove the CODEC */
        if (codec && codec->probed &&