diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-07-08 14:47:44 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-07-08 15:05:04 -0400 |
commit | abd31b32dde4683df6fd0439caa314aafd751698 (patch) | |
tree | 88bf97534fc24cc2d9aa1d7f70a7ca7d8439862d | |
parent | 1b7c12316982f74a5b8e7704c24cf5524d0723a3 (diff) |
ASoC: Use card field to indicate whether a component is bound
Use the card field of a component to indicate whether it is bound or not.
This makes a certain sense given that the field contains the card the
component is bound to and a component can only be bound to one card at a
time. And it also requires to unset the card field when the component is
unbound from the card.
This makes the probded flag redundant and it can be removed.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | include/sound/soc.h | 1 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 16 |
2 files changed, 8 insertions, 9 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index 93df8bf9d54a..59635a12c3be 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -758,7 +758,6 @@ struct snd_soc_component { | |||
758 | 758 | ||
759 | unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */ | 759 | unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */ |
760 | unsigned int registered_as_component:1; | 760 | unsigned int registered_as_component:1; |
761 | unsigned int probed:1; | ||
762 | 761 | ||
763 | struct list_head list; | 762 | struct list_head list; |
764 | 763 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 96bb71aea529..42575b03411e 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) | |||
978 | 978 | ||
979 | static void soc_remove_component(struct snd_soc_component *component) | 979 | static void soc_remove_component(struct snd_soc_component *component) |
980 | { | 980 | { |
981 | if (!component->probed) | 981 | if (!component->card) |
982 | return; | 982 | return; |
983 | 983 | ||
984 | /* This is a HACK and will be removed soon */ | 984 | /* This is a HACK and will be removed soon */ |
@@ -991,7 +991,7 @@ static void soc_remove_component(struct snd_soc_component *component) | |||
991 | snd_soc_dapm_free(snd_soc_component_get_dapm(component)); | 991 | snd_soc_dapm_free(snd_soc_component_get_dapm(component)); |
992 | 992 | ||
993 | soc_cleanup_component_debugfs(component); | 993 | soc_cleanup_component_debugfs(component); |
994 | component->probed = 0; | 994 | component->card = NULL; |
995 | module_put(component->dev->driver->owner); | 995 | module_put(component->dev->driver->owner); |
996 | } | 996 | } |
997 | 997 | ||
@@ -1105,7 +1105,7 @@ static int soc_probe_component(struct snd_soc_card *card, | |||
1105 | if (!strcmp(component->name, "snd-soc-dummy")) | 1105 | if (!strcmp(component->name, "snd-soc-dummy")) |
1106 | return 0; | 1106 | return 0; |
1107 | 1107 | ||
1108 | if (component->probed) { | 1108 | if (component->card) { |
1109 | if (component->card != card) { | 1109 | if (component->card != card) { |
1110 | dev_err(component->dev, | 1110 | dev_err(component->dev, |
1111 | "Trying to bind component to card \"%s\" but is already bound to card \"%s\"\n", | 1111 | "Trying to bind component to card \"%s\" but is already bound to card \"%s\"\n", |
@@ -1115,13 +1115,13 @@ static int soc_probe_component(struct snd_soc_card *card, | |||
1115 | return 0; | 1115 | return 0; |
1116 | } | 1116 | } |
1117 | 1117 | ||
1118 | if (!try_module_get(component->dev->driver->owner)) | ||
1119 | return -ENODEV; | ||
1120 | |||
1118 | component->card = card; | 1121 | component->card = card; |
1119 | dapm->card = card; | 1122 | dapm->card = card; |
1120 | soc_set_name_prefix(card, component); | 1123 | soc_set_name_prefix(card, component); |
1121 | 1124 | ||
1122 | if (!try_module_get(component->dev->driver->owner)) | ||
1123 | return -ENODEV; | ||
1124 | |||
1125 | soc_init_component_debugfs(component); | 1125 | soc_init_component_debugfs(component); |
1126 | 1126 | ||
1127 | if (component->dapm_widgets) { | 1127 | if (component->dapm_widgets) { |
@@ -1165,7 +1165,6 @@ static int soc_probe_component(struct snd_soc_card *card, | |||
1165 | snd_soc_dapm_add_routes(dapm, component->dapm_routes, | 1165 | snd_soc_dapm_add_routes(dapm, component->dapm_routes, |
1166 | component->num_dapm_routes); | 1166 | component->num_dapm_routes); |
1167 | 1167 | ||
1168 | component->probed = 1; | ||
1169 | list_add(&dapm->list, &card->dapm_list); | 1168 | list_add(&dapm->list, &card->dapm_list); |
1170 | 1169 | ||
1171 | /* This is a HACK and will be removed soon */ | 1170 | /* This is a HACK and will be removed soon */ |
@@ -1176,6 +1175,7 @@ static int soc_probe_component(struct snd_soc_card *card, | |||
1176 | 1175 | ||
1177 | err_probe: | 1176 | err_probe: |
1178 | soc_cleanup_component_debugfs(component); | 1177 | soc_cleanup_component_debugfs(component); |
1178 | component->card = NULL; | ||
1179 | module_put(component->dev->driver->owner); | 1179 | module_put(component->dev->driver->owner); |
1180 | 1180 | ||
1181 | return ret; | 1181 | return ret; |
@@ -1459,7 +1459,7 @@ static void soc_remove_aux_dev(struct snd_soc_card *card, int num) | |||
1459 | rtd->dev_registered = 0; | 1459 | rtd->dev_registered = 0; |
1460 | } | 1460 | } |
1461 | 1461 | ||
1462 | if (component && component->probed) | 1462 | if (component) |
1463 | soc_remove_component(component); | 1463 | soc_remove_component(component); |
1464 | } | 1464 | } |
1465 | 1465 | ||