aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
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/soc/codecs
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/soc/codecs')
-rw-r--r--sound/soc/codecs/cs4270.c23
-rw-r--r--sound/soc/codecs/tlv320aic26.c11
-rw-r--r--sound/soc/codecs/wm8400.c12
3 files changed, 11 insertions, 35 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/*