aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorPhilipp Zabel <philipp.zabel@gmail.com>2009-03-12 06:07:54 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-03-12 11:43:30 -0400
commiteb5f6d753e337834c7ceb07824ee472e43d9a7a2 (patch)
tree22c549607a8ed5657c98af6ae4ead1b3c0eaaaec /sound
parent6f7cb44ba1a5195bf719f9ba1d57bd79e13262c1 (diff)
ASoC: Replace remaining uses of snd_soc_cnew with snd_soc_add_controls.
The drivers are basically duplicating the same code over and over. As snd_soc_cnew is going to be made static some time after the next merge window, we might as well convert them now. Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/cs4270.c23
-rw-r--r--sound/soc/codecs/tlv320aic26.c11
-rw-r--r--sound/soc/codecs/wm8400.c12
-rw-r--r--sound/soc/omap/n810.c12
-rw-r--r--sound/soc/pxa/corgi.c12
-rw-r--r--sound/soc/pxa/palm27x.c13
-rw-r--r--sound/soc/pxa/poodle.c12
-rw-r--r--sound/soc/pxa/spitz.c12
-rw-r--r--sound/soc/pxa/tosa.c12
-rw-r--r--sound/soc/s3c24xx/neo1973_wm8753.c13
10 files changed, 46 insertions, 86 deletions
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c
index 2137670c9b78..7fa09a387622 100644
--- a/sound/soc/codecs/cs4270.c
+++ b/sound/soc/codecs/cs4270.c
@@ -540,7 +540,6 @@ static int cs4270_probe(struct platform_device *pdev)
540{ 540{
541 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 541 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
542 struct snd_soc_codec *codec = cs4270_codec; 542 struct snd_soc_codec *codec = cs4270_codec;
543 unsigned int i;
544 int ret; 543 int ret;
545 544
546 /* Connect the codec to the socdev. snd_soc_new_pcms() needs this. */ 545 /* Connect the codec to the socdev. snd_soc_new_pcms() needs this. */
@@ -554,23 +553,11 @@ static int cs4270_probe(struct platform_device *pdev)
554 } 553 }
555 554
556 /* Add the non-DAPM controls */ 555 /* Add the non-DAPM controls */
557 for (i = 0; i < ARRAY_SIZE(cs4270_snd_controls); i++) { 556 ret = snd_soc_add_controls(codec, cs4270_snd_controls,
558 struct snd_kcontrol *kctrl; 557 ARRAY_SIZE(cs4270_snd_controls));
559 558 if (ret < 0) {
560 kctrl = snd_soc_cnew(&cs4270_snd_controls[i], codec, NULL); 559 dev_err(codec->dev, "failed to add controls\n");
561 if (!kctrl) { 560 goto error_free_pcms;
562 dev_err(codec->dev, "error creating control '%s'\n",
563 cs4270_snd_controls[i].name);
564 ret = -ENOMEM;
565 goto error_free_pcms;
566 }
567
568 ret = snd_ctl_add(codec->card, kctrl);
569 if (ret < 0) {
570 dev_err(codec->dev, "error adding control '%s'\n",
571 cs4270_snd_controls[i].name);
572 goto error_free_pcms;
573 }
574 } 561 }
575 562
576 /* And finally, register the socdev */ 563 /* And finally, register the socdev */
diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c
index a7f333fc579e..3387d9e736ea 100644
--- a/sound/soc/codecs/tlv320aic26.c
+++ b/sound/soc/codecs/tlv320aic26.c
@@ -324,9 +324,8 @@ static int aic26_probe(struct platform_device *pdev)
324{ 324{
325 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 325 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
326 struct snd_soc_codec *codec; 326 struct snd_soc_codec *codec;
327 struct snd_kcontrol *kcontrol;
328 struct aic26 *aic26; 327 struct aic26 *aic26;
329 int i, ret, err; 328 int ret, err;
330 329
331 dev_info(&pdev->dev, "Probing AIC26 SoC CODEC driver\n"); 330 dev_info(&pdev->dev, "Probing AIC26 SoC CODEC driver\n");
332 dev_dbg(&pdev->dev, "socdev=%p\n", socdev); 331 dev_dbg(&pdev->dev, "socdev=%p\n", socdev);
@@ -353,11 +352,9 @@ static int aic26_probe(struct platform_device *pdev)
353 352
354 /* register controls */ 353 /* register controls */
355 dev_dbg(&pdev->dev, "Registering controls\n"); 354 dev_dbg(&pdev->dev, "Registering controls\n");
356 for (i = 0; i < ARRAY_SIZE(aic26_snd_controls); i++) { 355 err = snd_soc_add_controls(codec, aic26_snd_controls,
357 kcontrol = snd_soc_cnew(&aic26_snd_controls[i], codec, NULL); 356 ARRAY_SIZE(aic26_snd_controls));
358 err = snd_ctl_add(codec->card, kcontrol); 357 WARN_ON(err < 0);
359 WARN_ON(err < 0);
360 }
361 358
362 /* CODEC is setup, we can register the card now */ 359 /* CODEC is setup, we can register the card now */
363 dev_dbg(&pdev->dev, "Registering card\n"); 360 dev_dbg(&pdev->dev, "Registering card\n");
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
index 4e1cefff8483..744e0dc73be4 100644
--- a/sound/soc/codecs/wm8400.c
+++ b/sound/soc/codecs/wm8400.c
@@ -351,16 +351,8 @@ SOC_SINGLE("RIN34 Mute Switch", WM8400_RIGHT_LINE_INPUT_3_4_VOLUME,
351/* add non dapm controls */ 351/* add non dapm controls */
352static int wm8400_add_controls(struct snd_soc_codec *codec) 352static int wm8400_add_controls(struct snd_soc_codec *codec)
353{ 353{
354 int err, i; 354 return snd_soc_add_controls(codec, wm8400_snd_controls,
355 355 ARRAY_SIZE(wm8400_snd_controls));
356 for (i = 0; i < ARRAY_SIZE(wm8400_snd_controls); i++) {
357 err = snd_ctl_add(codec->card,
358 snd_soc_cnew(&wm8400_snd_controls[i],codec,
359 NULL));
360 if (err < 0)
361 return err;
362 }
363 return 0;
364} 356}
365 357
366/* 358/*
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c
index 9f037cd0191d..86471fd6340f 100644
--- a/sound/soc/omap/n810.c
+++ b/sound/soc/omap/n810.c
@@ -248,7 +248,7 @@ static const struct snd_kcontrol_new aic33_n810_controls[] = {
248 248
249static int n810_aic33_init(struct snd_soc_codec *codec) 249static int n810_aic33_init(struct snd_soc_codec *codec)
250{ 250{
251 int i, err; 251 int err;
252 252
253 /* Not connected */ 253 /* Not connected */
254 snd_soc_dapm_nc_pin(codec, "MONO_LOUT"); 254 snd_soc_dapm_nc_pin(codec, "MONO_LOUT");
@@ -256,12 +256,10 @@ static int n810_aic33_init(struct snd_soc_codec *codec)
256 snd_soc_dapm_nc_pin(codec, "HPRCOM"); 256 snd_soc_dapm_nc_pin(codec, "HPRCOM");
257 257
258 /* Add N810 specific controls */ 258 /* Add N810 specific controls */
259 for (i = 0; i < ARRAY_SIZE(aic33_n810_controls); i++) { 259 err = snd_soc_add_controls(codec, aic33_n810_controls,
260 err = snd_ctl_add(codec->card, 260 ARRAY_SIZE(aic33_n810_controls));
261 snd_soc_cnew(&aic33_n810_controls[i], codec, NULL)); 261 if (err < 0)
262 if (err < 0) 262 return err;
263 return err;
264 }
265 263
266 /* Add N810 specific widgets */ 264 /* Add N810 specific widgets */
267 snd_soc_dapm_new_controls(codec, aic33_dapm_widgets, 265 snd_soc_dapm_new_controls(codec, aic33_dapm_widgets,
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c
index 146973ae0974..02263e5d8f03 100644
--- a/sound/soc/pxa/corgi.c
+++ b/sound/soc/pxa/corgi.c
@@ -276,18 +276,16 @@ static const struct snd_kcontrol_new wm8731_corgi_controls[] = {
276 */ 276 */
277static int corgi_wm8731_init(struct snd_soc_codec *codec) 277static int corgi_wm8731_init(struct snd_soc_codec *codec)
278{ 278{
279 int i, err; 279 int err;
280 280
281 snd_soc_dapm_nc_pin(codec, "LLINEIN"); 281 snd_soc_dapm_nc_pin(codec, "LLINEIN");
282 snd_soc_dapm_nc_pin(codec, "RLINEIN"); 282 snd_soc_dapm_nc_pin(codec, "RLINEIN");
283 283
284 /* Add corgi specific controls */ 284 /* Add corgi specific controls */
285 for (i = 0; i < ARRAY_SIZE(wm8731_corgi_controls); i++) { 285 err = snd_soc_add_controls(codec, wm8731_corgi_controls,
286 err = snd_ctl_add(codec->card, 286 ARRAY_SIZE(wm8731_corgi_controls));
287 snd_soc_cnew(&wm8731_corgi_controls[i], codec, NULL)); 287 if (err < 0)
288 if (err < 0) 288 return err;
289 return err;
290 }
291 289
292 /* Add corgi specific widgets */ 290 /* Add corgi specific widgets */
293 snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, 291 snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets,
diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c
index 29958cd9daec..48a73f64500b 100644
--- a/sound/soc/pxa/palm27x.c
+++ b/sound/soc/pxa/palm27x.c
@@ -146,19 +146,16 @@ static const struct snd_kcontrol_new palm27x_controls[] = {
146 146
147static int palm27x_ac97_init(struct snd_soc_codec *codec) 147static int palm27x_ac97_init(struct snd_soc_codec *codec)
148{ 148{
149 int i, err; 149 int err;
150 150
151 snd_soc_dapm_nc_pin(codec, "OUT3"); 151 snd_soc_dapm_nc_pin(codec, "OUT3");
152 snd_soc_dapm_nc_pin(codec, "MONOOUT"); 152 snd_soc_dapm_nc_pin(codec, "MONOOUT");
153 153
154 /* add palm27x specific controls */ 154 /* add palm27x specific controls */
155 for (i = 0; i < ARRAY_SIZE(palm27x_controls); i++) { 155 err = snd_soc_add_controls(codec, palm27x_controls,
156 err = snd_ctl_add(codec->card, 156 ARRAY_SIZE(palm27x_controls));
157 snd_soc_cnew(&palm27x_controls[i], 157 if (err < 0)
158 codec, NULL)); 158 return err;
159 if (err < 0)
160 return err;
161 }
162 159
163 /* add palm27x specific widgets */ 160 /* add palm27x specific widgets */
164 snd_soc_dapm_new_controls(codec, palm27x_dapm_widgets, 161 snd_soc_dapm_new_controls(codec, palm27x_dapm_widgets,
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
index fb17a0a5a093..ef7c6c8dc8f1 100644
--- a/sound/soc/pxa/poodle.c
+++ b/sound/soc/pxa/poodle.c
@@ -241,19 +241,17 @@ static const struct snd_kcontrol_new wm8731_poodle_controls[] = {
241 */ 241 */
242static int poodle_wm8731_init(struct snd_soc_codec *codec) 242static int poodle_wm8731_init(struct snd_soc_codec *codec)
243{ 243{
244 int i, err; 244 int err;
245 245
246 snd_soc_dapm_nc_pin(codec, "LLINEIN"); 246 snd_soc_dapm_nc_pin(codec, "LLINEIN");
247 snd_soc_dapm_nc_pin(codec, "RLINEIN"); 247 snd_soc_dapm_nc_pin(codec, "RLINEIN");
248 snd_soc_dapm_enable_pin(codec, "MICIN"); 248 snd_soc_dapm_enable_pin(codec, "MICIN");
249 249
250 /* Add poodle specific controls */ 250 /* Add poodle specific controls */
251 for (i = 0; i < ARRAY_SIZE(wm8731_poodle_controls); i++) { 251 err = snd_soc_add_controls(codec, wm8731_poodle_controls,
252 err = snd_ctl_add(codec->card, 252 ARRAY_SIZE(wm8731_poodle_controls));
253 snd_soc_cnew(&wm8731_poodle_controls[i], codec, NULL)); 253 if (err < 0)
254 if (err < 0) 254 return err;
255 return err;
256 }
257 255
258 /* Add poodle specific widgets */ 256 /* Add poodle specific widgets */
259 snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, 257 snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets,
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c
index 1aafd8c645a1..6ca9f53080c6 100644
--- a/sound/soc/pxa/spitz.c
+++ b/sound/soc/pxa/spitz.c
@@ -278,7 +278,7 @@ static const struct snd_kcontrol_new wm8750_spitz_controls[] = {
278 */ 278 */
279static int spitz_wm8750_init(struct snd_soc_codec *codec) 279static int spitz_wm8750_init(struct snd_soc_codec *codec)
280{ 280{
281 int i, err; 281 int err;
282 282
283 /* NC codec pins */ 283 /* NC codec pins */
284 snd_soc_dapm_nc_pin(codec, "RINPUT1"); 284 snd_soc_dapm_nc_pin(codec, "RINPUT1");
@@ -290,12 +290,10 @@ static int spitz_wm8750_init(struct snd_soc_codec *codec)
290 snd_soc_dapm_nc_pin(codec, "MONO1"); 290 snd_soc_dapm_nc_pin(codec, "MONO1");
291 291
292 /* Add spitz specific controls */ 292 /* Add spitz specific controls */
293 for (i = 0; i < ARRAY_SIZE(wm8750_spitz_controls); i++) { 293 err = snd_soc_add_controls(codec, wm8750_spitz_controls,
294 err = snd_ctl_add(codec->card, 294 ARRAY_SIZE(wm8750_spitz_controls));
295 snd_soc_cnew(&wm8750_spitz_controls[i], codec, NULL)); 295 if (err < 0)
296 if (err < 0) 296 return err;
297 return err;
298 }
299 297
300 /* Add spitz specific widgets */ 298 /* Add spitz specific widgets */
301 snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets, 299 snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets,
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
index 09b5bada03b9..fc781374b1bf 100644
--- a/sound/soc/pxa/tosa.c
+++ b/sound/soc/pxa/tosa.c
@@ -188,18 +188,16 @@ static const struct snd_kcontrol_new tosa_controls[] = {
188 188
189static int tosa_ac97_init(struct snd_soc_codec *codec) 189static int tosa_ac97_init(struct snd_soc_codec *codec)
190{ 190{
191 int i, err; 191 int err;
192 192
193 snd_soc_dapm_nc_pin(codec, "OUT3"); 193 snd_soc_dapm_nc_pin(codec, "OUT3");
194 snd_soc_dapm_nc_pin(codec, "MONOOUT"); 194 snd_soc_dapm_nc_pin(codec, "MONOOUT");
195 195
196 /* add tosa specific controls */ 196 /* add tosa specific controls */
197 for (i = 0; i < ARRAY_SIZE(tosa_controls); i++) { 197 err = snd_soc_add_controls(codec, tosa_controls,
198 err = snd_ctl_add(codec->card, 198 ARRAY_SIZE(tosa_controls));
199 snd_soc_cnew(&tosa_controls[i],codec, NULL)); 199 if (err < 0)
200 if (err < 0) 200 return err;
201 return err;
202 }
203 201
204 /* add tosa specific widgets */ 202 /* add tosa specific widgets */
205 snd_soc_dapm_new_controls(codec, tosa_dapm_widgets, 203 snd_soc_dapm_new_controls(codec, tosa_dapm_widgets,
diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c
index 5f6aeec0437d..289fadf60b10 100644
--- a/sound/soc/s3c24xx/neo1973_wm8753.c
+++ b/sound/soc/s3c24xx/neo1973_wm8753.c
@@ -498,7 +498,7 @@ static const struct snd_kcontrol_new wm8753_neo1973_controls[] = {
498 */ 498 */
499static int neo1973_wm8753_init(struct snd_soc_codec *codec) 499static int neo1973_wm8753_init(struct snd_soc_codec *codec)
500{ 500{
501 int i, err; 501 int err;
502 502
503 pr_debug("Entered %s\n", __func__); 503 pr_debug("Entered %s\n", __func__);
504 504
@@ -518,13 +518,10 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec)
518 set_scenario_endpoints(codec, NEO_AUDIO_OFF); 518 set_scenario_endpoints(codec, NEO_AUDIO_OFF);
519 519
520 /* add neo1973 specific controls */ 520 /* add neo1973 specific controls */
521 for (i = 0; i < ARRAY_SIZE(wm8753_neo1973_controls); i++) { 521 err = snd_soc_add_controls(codec, wm8753_neo1973_controls,
522 err = snd_ctl_add(codec->card, 522 ARRAY_SIZE(8753_neo1973_controls));
523 snd_soc_cnew(&wm8753_neo1973_controls[i], 523 if (err < 0)
524 codec, NULL)); 524 return err;
525 if (err < 0)
526 return err;
527 }
528 525
529 /* set up neo1973 specific audio routes */ 526 /* set up neo1973 specific audio routes */
530 err = snd_soc_dapm_add_routes(codec, dapm_routes, 527 err = snd_soc_dapm_add_routes(codec, dapm_routes,