ASoC: Use explicit endianness conversion in snd_soc_16_8_write()
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 11 May 2011 13:15:56 +0000 (15:15 +0200)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 27 May 2011 14:01:40 +0000 (22:01 +0800)
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
sound/soc/soc-cache.c

index 9c688b8a1f916105dc8785a58d4ab77cc284cb5b..d1d4059be04e654b7f349807536d4ff11a786c5b 100644 (file)
@@ -314,9 +314,9 @@ static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg,
                              unsigned int value)
 {
        u8 data[3];
+       u16 rval = cpu_to_be16(reg);
 
-       data[0] = (reg >> 8) & 0xff;
-       data[1] = reg & 0xff;
+       memcpy(data, &rval, sizeof(rval));
        data[2] = value;
        reg &= 0xff;