aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-09-22 18:56:28 -0400
committerMark Brown <broonie@kernel.org>2014-09-22 21:19:56 -0400
commite3f205a72c4554b58f51d5afd98195c4ff54d215 (patch)
treec2401c150fc1b42d6593d32b9238d1413a627a35
parent8ad9f9efcc7656cafb56bbbcd545f817a742bf32 (diff)
ASoC: Remove locking in snd_soc_{new,free}_ac97_codec()
snd_soc_new_ac97_codec() and snd_soc_free_ac97_codec() are called from within a CODEC's probe() and remove() callbacks. Those will not run concurrently against each other for the same CODEC instance, hence it is not necessary to protect the two functions with a mutex. This removes the last user in the ASoC core of the snd_soc_codec mutex field and will allow us to eventually remove it. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/soc-core.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index d4bfd4a9076f..a504cf42bf0a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2107,13 +2107,9 @@ static struct platform_driver soc_driver = {
2107int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, 2107int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
2108 struct snd_ac97_bus_ops *ops, int num) 2108 struct snd_ac97_bus_ops *ops, int num)
2109{ 2109{
2110 mutex_lock(&codec->mutex);
2111
2112 codec->ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL); 2110 codec->ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL);
2113 if (codec->ac97 == NULL) { 2111 if (codec->ac97 == NULL)
2114 mutex_unlock(&codec->mutex);
2115 return -ENOMEM; 2112 return -ENOMEM;
2116 }
2117 2113
2118 codec->ac97->bus = kzalloc(sizeof(struct snd_ac97_bus), GFP_KERNEL); 2114 codec->ac97->bus = kzalloc(sizeof(struct snd_ac97_bus), GFP_KERNEL);
2119 if (codec->ac97->bus == NULL) { 2115 if (codec->ac97->bus == NULL) {
@@ -2132,7 +2128,6 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
2132 */ 2128 */
2133 codec->ac97_created = 1; 2129 codec->ac97_created = 1;
2134 2130
2135 mutex_unlock(&codec->mutex);
2136 return 0; 2131 return 0;
2137} 2132}
2138EXPORT_SYMBOL_GPL(snd_soc_new_ac97_codec); 2133EXPORT_SYMBOL_GPL(snd_soc_new_ac97_codec);
@@ -2302,7 +2297,6 @@ EXPORT_SYMBOL_GPL(snd_soc_set_ac97_ops_of_reset);
2302 */ 2297 */
2303void snd_soc_free_ac97_codec(struct snd_soc_codec *codec) 2298void snd_soc_free_ac97_codec(struct snd_soc_codec *codec)
2304{ 2299{
2305 mutex_lock(&codec->mutex);
2306#ifdef CONFIG_SND_SOC_AC97_BUS 2300#ifdef CONFIG_SND_SOC_AC97_BUS
2307 soc_unregister_ac97_codec(codec); 2301 soc_unregister_ac97_codec(codec);
2308#endif 2302#endif
@@ -2310,7 +2304,6 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec)
2310 kfree(codec->ac97); 2304 kfree(codec->ac97);
2311 codec->ac97 = NULL; 2305 codec->ac97 = NULL;
2312 codec->ac97_created = 0; 2306 codec->ac97_created = 0;
2313 mutex_unlock(&codec->mutex);
2314} 2307}
2315EXPORT_SYMBOL_GPL(snd_soc_free_ac97_codec); 2308EXPORT_SYMBOL_GPL(snd_soc_free_ac97_codec);
2316 2309