diff options
author | Ian Molton <ian@mnementh.co.uk> | 2009-01-08 19:23:21 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-01-09 05:39:49 -0500 |
commit | 3e8e1952e3a3dd59b11233a532ca68e6471742d9 (patch) | |
tree | 3dff59c0b09cbcbc0e4b80a00cecd507219a821c /sound/soc/codecs/wm8990.c | |
parent | a6ba2b2dabb583e7820e567fb309d771b50cb9ff (diff) |
ASoC: cleanup duplicated code.
Many codec drivers were implementing cookie-cutter copies of the function
that adds kcontrols to the codec.
This patch moves this code to a common function snd_soc_add_controls() in
soc-core.c and updates all drivers using copies of this function to use the
new common version.
[Edited to raise priority of error log message and document parameters.
-- broonie]
Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8990.c')
-rw-r--r-- | sound/soc/codecs/wm8990.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index 5b5afc144478..6b2778632d5e 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c | |||
@@ -417,21 +417,6 @@ SOC_SINGLE("RIN34 Mute Switch", WM8990_RIGHT_LINE_INPUT_3_4_VOLUME, | |||
417 | 417 | ||
418 | }; | 418 | }; |
419 | 419 | ||
420 | /* add non dapm controls */ | ||
421 | static int wm8990_add_controls(struct snd_soc_codec *codec) | ||
422 | { | ||
423 | int err, i; | ||
424 | |||
425 | for (i = 0; i < ARRAY_SIZE(wm8990_snd_controls); i++) { | ||
426 | err = snd_ctl_add(codec->card, | ||
427 | snd_soc_cnew(&wm8990_snd_controls[i], codec, | ||
428 | NULL)); | ||
429 | if (err < 0) | ||
430 | return err; | ||
431 | } | ||
432 | return 0; | ||
433 | } | ||
434 | |||
435 | /* | 420 | /* |
436 | * _DAPM_ Controls | 421 | * _DAPM_ Controls |
437 | */ | 422 | */ |
@@ -1460,7 +1445,8 @@ static int wm8990_init(struct snd_soc_device *socdev) | |||
1460 | wm8990_write(codec, WM8990_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8)); | 1445 | wm8990_write(codec, WM8990_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8)); |
1461 | wm8990_write(codec, WM8990_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8)); | 1446 | wm8990_write(codec, WM8990_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8)); |
1462 | 1447 | ||
1463 | wm8990_add_controls(codec); | 1448 | snd_soc_add_controls(codec, wm8990_snd_controls, |
1449 | ARRAY_SIZE(wm8990_snd_controls)); | ||
1464 | wm8990_add_widgets(codec); | 1450 | wm8990_add_widgets(codec); |
1465 | ret = snd_soc_init_card(socdev); | 1451 | ret = snd_soc_init_card(socdev); |
1466 | if (ret < 0) { | 1452 | if (ret < 0) { |