]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - sound/soc/codecs/ak4104.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt...
[mv-sheeva.git] / sound / soc / codecs / ak4104.c
index b9ef7e45891d3c238597a750f762ea4bcbf3ef96..bdeb10dfd88728bb17ad68f45353d15e290a2ef8 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/soc.h>
 #include <sound/initval.h>
@@ -90,12 +91,10 @@ static int ak4104_spi_write(struct snd_soc_codec *codec, unsigned int reg,
        if (reg >= codec->reg_cache_size)
                return -EINVAL;
 
-       reg &= AK4104_REG_MASK;
-       reg |= AK4104_WRITE;
-
        /* only write to the hardware if value has changed */
        if (cache[reg] != value) {
-               u8 tmp[2] = { reg, value };
+               u8 tmp[2] = { (reg & AK4104_REG_MASK) | AK4104_WRITE, value };
+
                if (spi_write(spi, tmp, sizeof(tmp))) {
                        dev_err(&spi->dev, "SPI write failed\n");
                        return -EIO;