]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/soc/codecs/wm8731.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm
[linux-2.6-omap-h63xx.git] / sound / soc / codecs / wm8731.c
index e6b990507df24b293d03a169a6efe56a088d3ec9..9c33fe874928ec2ae746d112334a622e20d7dc14 100644 (file)
@@ -19,7 +19,6 @@
 #include <linux/pm.h>
 #include <linux/i2c.h>
 #include <linux/platform_device.h>
-#include <sound/driver.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -543,14 +542,10 @@ static int wm8731_init(struct snd_soc_device *socdev)
        codec->dapm_event = wm8731_dapm_event;
        codec->dai = &wm8731_dai;
        codec->num_dai = 1;
-       codec->reg_cache_size = ARRAY_SIZE(wm8731_reg);
-       codec->reg_cache =
-                       kzalloc(sizeof(u16) * ARRAY_SIZE(wm8731_reg), GFP_KERNEL);
+       codec->reg_cache_size = sizeof(wm8731_reg);
+       codec->reg_cache = kmemdup(wm8731_reg, sizeof(wm8731_reg), GFP_KERNEL);
        if (codec->reg_cache == NULL)
                return -ENOMEM;
-       memcpy(codec->reg_cache,
-               wm8731_reg, sizeof(u16) * ARRAY_SIZE(wm8731_reg));
-       codec->reg_cache_size = sizeof(u16) * ARRAY_SIZE(wm8731_reg);
 
        wm8731_reset(codec);
 
@@ -566,13 +561,13 @@ static int wm8731_init(struct snd_soc_device *socdev)
 
        /* set the update bits */
        reg = wm8731_read_reg_cache(codec, WM8731_LOUT1V);
-       wm8731_write(codec, WM8731_LOUT1V, reg 0x0100);
+       wm8731_write(codec, WM8731_LOUT1V, reg & ~0x0100);
        reg = wm8731_read_reg_cache(codec, WM8731_ROUT1V);
-       wm8731_write(codec, WM8731_ROUT1V, reg 0x0100);
+       wm8731_write(codec, WM8731_ROUT1V, reg & ~0x0100);
        reg = wm8731_read_reg_cache(codec, WM8731_LINVOL);
-       wm8731_write(codec, WM8731_LINVOL, reg 0x0100);
+       wm8731_write(codec, WM8731_LINVOL, reg & ~0x0100);
        reg = wm8731_read_reg_cache(codec, WM8731_RINVOL);
-       wm8731_write(codec, WM8731_RINVOL, reg 0x0100);
+       wm8731_write(codec, WM8731_RINVOL, reg & ~0x0100);
 
        wm8731_add_controls(codec);
        wm8731_add_widgets(codec);
@@ -627,12 +622,11 @@ static int wm8731_codec_probe(struct i2c_adapter *adap, int addr, int kind)
        client_template.adapter = adap;
        client_template.addr = addr;
 
-       i2c = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
        if (i2c == NULL) {
                kfree(codec);
                return -ENOMEM;
        }
-       memcpy(i2c, &client_template, sizeof(struct i2c_client));
        i2c_set_clientdata(i2c, codec);
        codec->control_data = i2c;