diff options
author | Stephen Warren <swarren@nvidia.com> | 2012-06-08 14:34:22 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-06-13 08:18:04 -0400 |
commit | d12cd198cba7949c70f596296297b772063175c0 (patch) | |
tree | d44fc3b5fe01e3b333229fcd1967f029a863ceb6 /sound/soc/soc-core.c | |
parent | 18d756440e8ed292b772682c4440a9d33643225b (diff) |
ASoC: factor out soc_remove_platform()
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>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r-- | sound/soc/soc-core.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 621c5bdea483..a539ade477af 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -898,6 +898,28 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) | |||
898 | return 0; | 898 | return 0; |
899 | } | 899 | } |
900 | 900 | ||
901 | static int soc_remove_platform(struct snd_soc_platform *platform) | ||
902 | { | ||
903 | int ret; | ||
904 | |||
905 | if (platform->driver->remove) { | ||
906 | ret = platform->driver->remove(platform); | ||
907 | if (ret < 0) | ||
908 | pr_err("asoc: failed to remove %s: %d\n", | ||
909 | platform->name, ret); | ||
910 | } | ||
911 | |||
912 | /* Make sure all DAPM widgets are freed */ | ||
913 | snd_soc_dapm_free(&platform->dapm); | ||
914 | |||
915 | soc_cleanup_platform_debugfs(platform); | ||
916 | platform->probed = 0; | ||
917 | list_del(&platform->card_list); | ||
918 | module_put(platform->dev->driver->owner); | ||
919 | |||
920 | return 0; | ||
921 | } | ||
922 | |||
901 | static void soc_remove_codec(struct snd_soc_codec *codec) | 923 | static void soc_remove_codec(struct snd_soc_codec *codec) |
902 | { | 924 | { |
903 | int err; | 925 | int err; |
@@ -950,22 +972,8 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order) | |||
950 | 972 | ||
951 | /* remove the platform */ | 973 | /* remove the platform */ |
952 | if (platform && platform->probed && | 974 | if (platform && platform->probed && |
953 | platform->driver->remove_order == order) { | 975 | platform->driver->remove_order == order) |
954 | if (platform->driver->remove) { | 976 | soc_remove_platform(platform); |
955 | err = platform->driver->remove(platform); | ||
956 | if (err < 0) | ||
957 | pr_err("asoc: failed to remove %s: %d\n", | ||
958 | platform->name, err); | ||
959 | } | ||
960 | |||
961 | /* Make sure all DAPM widgets are freed */ | ||
962 | snd_soc_dapm_free(&platform->dapm); | ||
963 | |||
964 | soc_cleanup_platform_debugfs(platform); | ||
965 | platform->probed = 0; | ||
966 | list_del(&platform->card_list); | ||
967 | module_put(platform->dev->driver->owner); | ||
968 | } | ||
969 | 977 | ||
970 | /* remove the CODEC */ | 978 | /* remove the CODEC */ |
971 | if (codec && codec->probed && | 979 | if (codec && codec->probed && |