ASoC: Use cpu_to_be16() in 8x16 write
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 11 May 2011 09:18:00 +0000 (11:18 +0200)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 27 May 2011 14:00:58 +0000 (22:00 +0800)
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
sound/soc/soc-cache.c

index dab109f2f47d1e553374d71a0855ef3b32309288..9c688b8a1f916105dc8785a58d4ab77cc284cb5b 100644 (file)
@@ -192,10 +192,10 @@ static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg,
                              unsigned int value)
 {
        u8 data[3];
+       u16 val = cpu_to_be16(value);
 
        data[0] = reg;
-       data[1] = (value >> 8) & 0xff;
-       data[2] = value & 0xff;
+       memcpy(&data[1], &val, sizeof(val));
 
        return do_hw_write(codec, reg, value, data, 3);
 }