aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8750.c
diff options
context:
space:
mode:
authorIan Molton <ian@mnementh.co.uk>2009-01-08 19:23:21 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-01-09 05:39:49 -0500
commit3e8e1952e3a3dd59b11233a532ca68e6471742d9 (patch)
tree3dff59c0b09cbcbc0e4b80a00cecd507219a821c /sound/soc/codecs/wm8750.c
parenta6ba2b2dabb583e7820e567fb309d771b50cb9ff (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/wm8750.c')
-rw-r--r--sound/soc/codecs/wm8750.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index 5997fa68e0d5..1578569793a2 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -231,21 +231,6 @@ SOC_SINGLE("Mono Playback Volume", WM8750_MOUTV, 0, 127, 0),
231 231
232}; 232};
233 233
234/* add non dapm controls */
235static int wm8750_add_controls(struct snd_soc_codec *codec)
236{
237 int err, i;
238
239 for (i = 0; i < ARRAY_SIZE(wm8750_snd_controls); i++) {
240 err = snd_ctl_add(codec->card,
241 snd_soc_cnew(&wm8750_snd_controls[i],
242 codec, NULL));
243 if (err < 0)
244 return err;
245 }
246 return 0;
247}
248
249/* 234/*
250 * DAPM Controls 235 * DAPM Controls
251 */ 236 */
@@ -816,7 +801,8 @@ static int wm8750_init(struct snd_soc_device *socdev)
816 reg = wm8750_read_reg_cache(codec, WM8750_RINVOL); 801 reg = wm8750_read_reg_cache(codec, WM8750_RINVOL);
817 wm8750_write(codec, WM8750_RINVOL, reg | 0x0100); 802 wm8750_write(codec, WM8750_RINVOL, reg | 0x0100);
818 803
819 wm8750_add_controls(codec); 804 snd_soc_add_controls(codec, wm8750_snd_controls,
805 ARRAY_SIZE(wm8750_snd_controls));
820 wm8750_add_widgets(codec); 806 wm8750_add_widgets(codec);
821 ret = snd_soc_init_card(socdev); 807 ret = snd_soc_init_card(socdev);
822 if (ret < 0) { 808 if (ret < 0) {