diff options
-rw-r--r-- | include/sound/soc.h | 3 | ||||
-rw-r--r-- | sound/soc/codecs/ad1980.c | 2 | ||||
-rw-r--r-- | sound/soc/codecs/stac9766.c | 2 | ||||
-rw-r--r-- | sound/soc/codecs/wm9705.c | 2 | ||||
-rw-r--r-- | sound/soc/codecs/wm9712.c | 2 | ||||
-rw-r--r-- | sound/soc/codecs/wm9713.c | 2 | ||||
-rw-r--r-- | sound/soc/soc-ac97.c | 22 |
7 files changed, 14 insertions, 21 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index adef34fa5209..44b3ce531fd6 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -499,8 +499,7 @@ int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg, | |||
499 | unsigned int mask, unsigned int value); | 499 | unsigned int mask, unsigned int value); |
500 | 500 | ||
501 | #ifdef CONFIG_SND_SOC_AC97_BUS | 501 | #ifdef CONFIG_SND_SOC_AC97_BUS |
502 | int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, | 502 | int snd_soc_new_ac97_codec(struct snd_soc_codec *codec); |
503 | struct snd_ac97_bus_ops *ops, int num); | ||
504 | void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); | 503 | void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); |
505 | 504 | ||
506 | int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops); | 505 | int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops); |
diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c index 9ed4e12c26d1..f71cc21e67d4 100644 --- a/sound/soc/codecs/ad1980.c +++ b/sound/soc/codecs/ad1980.c | |||
@@ -220,7 +220,7 @@ static int ad1980_soc_probe(struct snd_soc_codec *codec) | |||
220 | u16 vendor_id2; | 220 | u16 vendor_id2; |
221 | u16 ext_status; | 221 | u16 ext_status; |
222 | 222 | ||
223 | ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); | 223 | ret = snd_soc_new_ac97_codec(codec); |
224 | if (ret < 0) { | 224 | if (ret < 0) { |
225 | dev_err(codec->dev, "Failed to register AC97 codec\n"); | 225 | dev_err(codec->dev, "Failed to register AC97 codec\n"); |
226 | return ret; | 226 | return ret; |
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c index 53b810d23fea..45ac4a71ecff 100644 --- a/sound/soc/codecs/stac9766.c +++ b/sound/soc/codecs/stac9766.c | |||
@@ -336,7 +336,7 @@ static int stac9766_codec_probe(struct snd_soc_codec *codec) | |||
336 | { | 336 | { |
337 | int ret = 0; | 337 | int ret = 0; |
338 | 338 | ||
339 | ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); | 339 | ret = snd_soc_new_ac97_codec(codec); |
340 | if (ret < 0) | 340 | if (ret < 0) |
341 | goto codec_err; | 341 | goto codec_err; |
342 | 342 | ||
diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index 1650195f6c84..2cb8a31819fa 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c | |||
@@ -337,7 +337,7 @@ static int wm9705_soc_probe(struct snd_soc_codec *codec) | |||
337 | { | 337 | { |
338 | int ret = 0; | 338 | int ret = 0; |
339 | 339 | ||
340 | ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); | 340 | ret = snd_soc_new_ac97_codec(codec); |
341 | if (ret < 0) { | 341 | if (ret < 0) { |
342 | dev_err(codec->dev, "Failed to register AC97 codec\n"); | 342 | dev_err(codec->dev, "Failed to register AC97 codec\n"); |
343 | return ret; | 343 | return ret; |
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 3fad37e0d33d..6b36223fd247 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c | |||
@@ -666,7 +666,7 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec) | |||
666 | { | 666 | { |
667 | int ret = 0; | 667 | int ret = 0; |
668 | 668 | ||
669 | ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); | 669 | ret = snd_soc_new_ac97_codec(codec); |
670 | if (ret < 0) { | 670 | if (ret < 0) { |
671 | dev_err(codec->dev, "Failed to register AC97 codec\n"); | 671 | dev_err(codec->dev, "Failed to register AC97 codec\n"); |
672 | return ret; | 672 | return ret; |
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index 998e4c7b6b12..2071df707e88 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
@@ -1219,7 +1219,7 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec) | |||
1219 | { | 1219 | { |
1220 | int ret = 0, reg; | 1220 | int ret = 0, reg; |
1221 | 1221 | ||
1222 | ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); | 1222 | ret = snd_soc_new_ac97_codec(codec); |
1223 | if (ret < 0) | 1223 | if (ret < 0) |
1224 | return ret; | 1224 | return ret; |
1225 | 1225 | ||
diff --git a/sound/soc/soc-ac97.c b/sound/soc/soc-ac97.c index da7b031a6eea..dbfca7e7dddb 100644 --- a/sound/soc/soc-ac97.c +++ b/sound/soc/soc-ac97.c | |||
@@ -38,6 +38,10 @@ struct snd_ac97_reset_cfg { | |||
38 | int gpio_reset; | 38 | int gpio_reset; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | static struct snd_ac97_bus soc_ac97_bus = { | ||
42 | .ops = NULL, /* Gets initialized in snd_soc_set_ac97_ops() */ | ||
43 | }; | ||
44 | |||
41 | /* unregister ac97 codec */ | 45 | /* unregister ac97 codec */ |
42 | static int soc_ac97_dev_unregister(struct snd_soc_codec *codec) | 46 | static int soc_ac97_dev_unregister(struct snd_soc_codec *codec) |
43 | { | 47 | { |
@@ -140,27 +144,17 @@ static void soc_ac97_device_release(struct device *dev) | |||
140 | /** | 144 | /** |
141 | * snd_soc_new_ac97_codec - initailise AC97 device | 145 | * snd_soc_new_ac97_codec - initailise AC97 device |
142 | * @codec: audio codec | 146 | * @codec: audio codec |
143 | * @ops: AC97 bus operations | ||
144 | * @num: AC97 codec number | ||
145 | * | 147 | * |
146 | * Initialises AC97 codec resources for use by ad-hoc devices only. | 148 | * Initialises AC97 codec resources for use by ad-hoc devices only. |
147 | */ | 149 | */ |
148 | int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, | 150 | int snd_soc_new_ac97_codec(struct snd_soc_codec *codec) |
149 | struct snd_ac97_bus_ops *ops, int num) | ||
150 | { | 151 | { |
151 | codec->ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL); | 152 | codec->ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL); |
152 | if (codec->ac97 == NULL) | 153 | if (codec->ac97 == NULL) |
153 | return -ENOMEM; | 154 | return -ENOMEM; |
154 | 155 | ||
155 | codec->ac97->bus = kzalloc(sizeof(struct snd_ac97_bus), GFP_KERNEL); | 156 | codec->ac97->bus = &soc_ac97_bus; |
156 | if (codec->ac97->bus == NULL) { | 157 | codec->ac97->num = 0; |
157 | kfree(codec->ac97); | ||
158 | codec->ac97 = NULL; | ||
159 | return -ENOMEM; | ||
160 | } | ||
161 | |||
162 | codec->ac97->bus->ops = ops; | ||
163 | codec->ac97->num = num; | ||
164 | codec->ac97->dev.release = soc_ac97_device_release; | 158 | codec->ac97->dev.release = soc_ac97_device_release; |
165 | 159 | ||
166 | /* | 160 | /* |
@@ -183,7 +177,6 @@ EXPORT_SYMBOL_GPL(snd_soc_new_ac97_codec); | |||
183 | void snd_soc_free_ac97_codec(struct snd_soc_codec *codec) | 177 | void snd_soc_free_ac97_codec(struct snd_soc_codec *codec) |
184 | { | 178 | { |
185 | soc_unregister_ac97_codec(codec); | 179 | soc_unregister_ac97_codec(codec); |
186 | kfree(codec->ac97->bus); | ||
187 | codec->ac97->bus = NULL; | 180 | codec->ac97->bus = NULL; |
188 | put_device(&codec->ac97->dev); | 181 | put_device(&codec->ac97->dev); |
189 | codec->ac97 = NULL; | 182 | codec->ac97 = NULL; |
@@ -314,6 +307,7 @@ int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops) | |||
314 | return -EBUSY; | 307 | return -EBUSY; |
315 | 308 | ||
316 | soc_ac97_ops = ops; | 309 | soc_ac97_ops = ops; |
310 | soc_ac97_bus.ops = ops; | ||
317 | 311 | ||
318 | return 0; | 312 | return 0; |
319 | } | 313 | } |