ASoC: adau1701: fix adau1701_reg_read()
authorDaniel Mack <[email protected]>
Thu, 3 Jul 2014 14:51:36 +0000 (16:51 +0200)
committerMark Brown <[email protected]>
Thu, 3 Jul 2014 18:42:40 +0000 (19:42 +0100)
Fix a long standing bug in the read register routing of adau1701.
The bytes arrive in the buffer in big-endian, so the result has to be
shifted before and-ing the bytes in the loop.

Signed-off-by: Daniel Mack <[email protected]>
Acked-by: Lars-Peter Clausen <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Cc: [email protected]
sound/soc/codecs/adau1701.c

index d71c59cf7bdd5210ac20ee2c3d76d8d7578385da..370b742117efd1aa2e8a785e2ae1011ddf4d7e88 100644 (file)
@@ -230,8 +230,10 @@ static int adau1701_reg_read(void *context, unsigned int reg,
 
        *value = 0;
 
-       for (i = 0; i < size; i++)
-               *value |= recv_buf[i] << (i * 8);
+       for (i = 0; i < size; i++) {
+               *value <<= 8;
+               *value |= recv_buf[i];
+       }
 
        return 0;
 }