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/wm8728.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/wm8728.c')
-rw-r--r-- | sound/soc/codecs/wm8728.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c index 80b11983e137..defa310bc7d9 100644 --- a/sound/soc/codecs/wm8728.c +++ b/sound/soc/codecs/wm8728.c | |||
@@ -92,21 +92,6 @@ SOC_DOUBLE_R_TLV("Digital Playback Volume", WM8728_DACLVOL, WM8728_DACRVOL, | |||
92 | SOC_SINGLE("Deemphasis", WM8728_DACCTL, 1, 1, 0), | 92 | SOC_SINGLE("Deemphasis", WM8728_DACCTL, 1, 1, 0), |
93 | }; | 93 | }; |
94 | 94 | ||
95 | static int wm8728_add_controls(struct snd_soc_codec *codec) | ||
96 | { | ||
97 | int err, i; | ||
98 | |||
99 | for (i = 0; i < ARRAY_SIZE(wm8728_snd_controls); i++) { | ||
100 | err = snd_ctl_add(codec->card, | ||
101 | snd_soc_cnew(&wm8728_snd_controls[i], | ||
102 | codec, NULL)); | ||
103 | if (err < 0) | ||
104 | return err; | ||
105 | } | ||
106 | |||
107 | return 0; | ||
108 | } | ||
109 | |||
110 | /* | 95 | /* |
111 | * DAPM controls. | 96 | * DAPM controls. |
112 | */ | 97 | */ |
@@ -330,7 +315,8 @@ static int wm8728_init(struct snd_soc_device *socdev) | |||
330 | /* power on device */ | 315 | /* power on device */ |
331 | wm8728_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 316 | wm8728_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
332 | 317 | ||
333 | wm8728_add_controls(codec); | 318 | snd_soc_add_controls(codec, wm8728_snd_controls, |
319 | ARRAY_SIZE(wm8728_snd_controls)); | ||
334 | wm8728_add_widgets(codec); | 320 | wm8728_add_widgets(codec); |
335 | ret = snd_soc_init_card(socdev); | 321 | ret = snd_soc_init_card(socdev); |
336 | if (ret < 0) { | 322 | if (ret < 0) { |