[Gta04-owner] [PATCH] ov9655: fix write_regs loop

Andreas Kemnade andreas at kemnade.info
Fri Jun 7 23:54:11 CEST 2013


The no need to write-optimization in ov9655_write_regs caused the
loop to abort at the first register which needs not to be changed.
So many registers were not set.

Signed-off-by: Andreas Kemnade <andreas at kemnade.info>
---
 drivers/media/i2c/ov9655.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/media/i2c/ov9655.c b/drivers/media/i2c/ov9655.c
index 3904d33..7b2859f 100644
--- a/drivers/media/i2c/ov9655.c
+++ b/drivers/media/i2c/ov9655.c
@@ -735,19 +735,18 @@ static int ov9655_write_regs(struct i2c_client *client,
 {
 	int i, ret;
 	for (i = 0; i < n; i++) {
-		u8 val = regs->value;
-		if(regs->clear != 0) { /* modify only some bits */
-			ret = ov9655_read(client, regs->addr);
+		u8 val = regs[i].value;
+		if(regs[i].clear != 0) { /* modify only some bits */
+			ret = ov9655_read(client, regs[i].addr);
 			if(ret < 0)
 				return ret;
-			val |= (ret & regs->clear);
+			val |= (ret & regs[i].clear);
 			if(val == (u8) ret)
-				return 0;	/* no need to write */
+				continue;	/* no need to write */
 		}
-		ret = ov9655_write(client, regs->addr, val);
+		ret = ov9655_write(client, regs[i].addr, val);
 		if (ret < 0)
 			return ret;
-		regs++;
 	}
 	return 0;
 }
-- 
1.7.2.5



More information about the Gta04-owner mailing list