提交 d12cd198 编写于 作者: S Stephen Warren 提交者: Mark Brown

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: NStephen Warren <swarren@nvidia.com>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 18d75644
...@@ -898,6 +898,28 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) ...@@ -898,6 +898,28 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
return 0; 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) static void soc_remove_codec(struct snd_soc_codec *codec)
{ {
int err; int err;
...@@ -950,22 +972,8 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order) ...@@ -950,22 +972,8 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order)
/* remove the platform */ /* remove the platform */
if (platform && platform->probed && if (platform && platform->probed &&
platform->driver->remove_order == order) { platform->driver->remove_order == order)
if (platform->driver->remove) { soc_remove_platform(platform);
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);
}
/* remove the CODEC */ /* remove the CODEC */
if (codec && codec->probed && if (codec && codec->probed &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册