diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-03-18 04:02:11 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-04-14 12:22:43 -0400 |
commit | 98e639fb8a3ed1bf2bd512626c3cfc2992a57113 (patch) | |
tree | b017a1a4c6cd07839eb449c6c7e76763fb5f6f4b | |
parent | 20a0ec27ea11af0251ffeb5ee2b96cc5c72cb517 (diff) |
ASoC: Track which components have been registered with snd_soc_register_component()
snd_soc_unregister_component() takes the parent device of the component as a
parameter and then looks up the component based on this. This is a problem if
multiple components are registered for the same parent device. Currently drivers
do not do this, but some drivers register a CPU DAI component and a platform for
the same parent device. This will become a problem once platforms are also made
components. To make sure that snd_soc_unregister_component() will not
accidentally unregister the platform in such a case only consider components
that were registered with snd_soc_register_component(). This is only meant as
short term stopgap solution to be able to continue componentisation. Long term
we'll need something different.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | include/sound/soc.h | 1 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index a355d0f9a6f9..f8a79c17628e 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -662,6 +662,7 @@ struct snd_soc_component { | |||
662 | unsigned int active; | 662 | unsigned int active; |
663 | 663 | ||
664 | unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */ | 664 | unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */ |
665 | unsigned int registered_as_component:1; | ||
665 | 666 | ||
666 | struct list_head list; | 667 | struct list_head list; |
667 | 668 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 41bd24348520..3314efb365e3 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -3879,6 +3879,7 @@ int snd_soc_register_component(struct device *dev, | |||
3879 | } | 3879 | } |
3880 | 3880 | ||
3881 | cmpnt->ignore_pmdown_time = true; | 3881 | cmpnt->ignore_pmdown_time = true; |
3882 | cmpnt->registered_as_component = true; | ||
3882 | 3883 | ||
3883 | return __snd_soc_register_component(dev, cmpnt, cmpnt_drv, NULL, | 3884 | return __snd_soc_register_component(dev, cmpnt, cmpnt_drv, NULL, |
3884 | dai_drv, num_dai, true); | 3885 | dai_drv, num_dai, true); |
@@ -3894,7 +3895,7 @@ void snd_soc_unregister_component(struct device *dev) | |||
3894 | struct snd_soc_component *cmpnt; | 3895 | struct snd_soc_component *cmpnt; |
3895 | 3896 | ||
3896 | list_for_each_entry(cmpnt, &component_list, list) { | 3897 | list_for_each_entry(cmpnt, &component_list, list) { |
3897 | if (dev == cmpnt->dev) | 3898 | if (dev == cmpnt->dev && cmpnt->registered_as_component) |
3898 | goto found; | 3899 | goto found; |
3899 | } | 3900 | } |
3900 | return; | 3901 | return; |