Title: [8478] trunk/sound/soc/soc-cache.c: soc-cache: let reg be AND'ed by 0xff instead of data buffer for 8_8 mode
Revision
8478
Author
bhsong
Date
2010-03-17 05:34:03 -0400 (Wed, 17 Mar 2010)

Log Message

soc-cache: let reg be AND'ed by 0xff instead of data buffer for 8_8 mode

The registers for AD193X are defined as 0x800-0x810 for spi which uses 16_8 mode,
for i2c to support AD1937, we will use 8_8 mode, only the low byte of 0x800-0x810
is valid.

Modified Paths

Diff

Modified: trunk/sound/soc/soc-cache.c (8477 => 8478)


--- trunk/sound/soc/soc-cache.c	2010-03-17 09:00:36 UTC (rev 8477)
+++ trunk/sound/soc/soc-cache.c	2010-03-17 09:34:03 UTC (rev 8478)
@@ -147,7 +147,8 @@
 
 	BUG_ON(codec->volatile_register);
 
-	data[0] = reg & 0xff;
+	reg &= 0xff;
+	data[0] = reg;
 	data[1] = value & 0xff;
 
 	if (reg < codec->reg_cache_size)
@@ -163,8 +164,11 @@
 				     unsigned int reg)
 {
 	u8 *cache = codec->reg_cache;
+
+	reg &= 0xff;
 	if (reg >= codec->reg_cache_size)
 		return -1;
+
 	return cache[reg];
 }
 
@@ -174,6 +178,7 @@
 	u16 *reg_cache = codec->reg_cache;
 	u8 data[3];
 
+	reg &= 0xff;
 	data[0] = reg;
 	data[1] = (value >> 8) & 0xff;
 	data[2] = value & 0xff;
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to