diff options
author | Mark Brown <broonie@kernel.org> | 2015-08-30 17:51:52 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-08-30 17:51:52 +0300 |
commit | 24ecc23cf62a48ae47ccc40f0f226d45c962512e (patch) | |
tree | 91d4f94ae19c126854baecfa893f4ab17530b39a /sound/soc/soc-core.c | |
parent | a1780653b906ca342f20812570e1f07edb35b907 (diff) | |
parent | abd31b32dde4683df6fd0439caa314aafd751698 (diff) | |
download | linux-24ecc23cf62a48ae47ccc40f0f226d45c962512e.tar.xz |
Merge remote-tracking branch 'asoc/topic/core' into asoc-next
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r-- | sound/soc/soc-core.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 0e1e69c7abd5..afc845e50c24 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -978,7 +978,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) static void soc_remove_component(struct snd_soc_component *component) { - if (!component->probed) + if (!component->card) return; /* This is a HACK and will be removed soon */ @@ -991,7 +991,7 @@ static void soc_remove_component(struct snd_soc_component *component) snd_soc_dapm_free(snd_soc_component_get_dapm(component)); soc_cleanup_component_debugfs(component); - component->probed = 0; + component->card = NULL; module_put(component->dev->driver->owner); } @@ -1102,16 +1102,26 @@ static int soc_probe_component(struct snd_soc_card *card, struct snd_soc_dai *dai; int ret; - if (component->probed) + if (!strcmp(component->name, "snd-soc-dummy")) return 0; - component->card = card; - dapm->card = card; - soc_set_name_prefix(card, component); + if (component->card) { + if (component->card != card) { + dev_err(component->dev, + "Trying to bind component to card \"%s\" but is already bound to card \"%s\"\n", + card->name, component->card->name); + return -ENODEV; + } + return 0; + } if (!try_module_get(component->dev->driver->owner)) return -ENODEV; + component->card = card; + dapm->card = card; + soc_set_name_prefix(card, component); + soc_init_component_debugfs(component); if (component->dapm_widgets) { @@ -1155,7 +1165,6 @@ static int soc_probe_component(struct snd_soc_card *card, snd_soc_dapm_add_routes(dapm, component->dapm_routes, component->num_dapm_routes); - component->probed = 1; list_add(&dapm->list, &card->dapm_list); /* This is a HACK and will be removed soon */ @@ -1166,6 +1175,7 @@ static int soc_probe_component(struct snd_soc_card *card, err_probe: soc_cleanup_component_debugfs(component); + component->card = NULL; module_put(component->dev->driver->owner); return ret; @@ -1449,7 +1459,7 @@ static void soc_remove_aux_dev(struct snd_soc_card *card, int num) rtd->dev_registered = 0; } - if (component && component->probed) + if (component) soc_remove_component(component); } |