All pastes #1846644 Raw Edit

phh

public text v1 · immutable
#1846644 ·published 2010-03-20 14:10 UTC
rendered paste body
diff --git a/arch/arm/mach-msm/board-htcraphael-navi.c b/arch/arm/mach-msm/board-htcraphael-navi.cindex 663329d..679d020 100644--- a/arch/arm/mach-msm/board-htcraphael-navi.c+++ b/arch/arm/mach-msm/board-htcraphael-navi.c@@ -400,24 +400,33 @@ static void raphnavi_pad(struct raphnavi *navi, char *data) static int raphnavi_i2c_read(struct i2c_client *client, unsigned id, char *buf, int len) { 	int r;-	char outbuffer[2] = { 0, 0 };--	outbuffer[0] = id;-	// maejrep: Have to separate the "ask" and "read" chunks-	r = i2c_master_send(client, outbuffer, 1);-	if (r < 0) {-		printk(KERN_WARNING "%s: error while asking for "-			"navi address %02x,%02x: %d\n", __func__, client->addr, id, r);-		return r;-	}-	mdelay(1);-	r = i2c_master_recv(client, buf, len);-	if (r < 0) {-		printk(KERN_ERR "%s: error while reading navi at "-			"address %02x,%02x: %d\n", __func__, client->addr, id, r);-		return r;+	int retry;+	int ret;+	struct i2c_msg msgs[] = {+		{+			.addr = client->addr,+			.flags = 0,+			.len = 1,+			.buf = &id,+		},+		{+			.addr = client->addr,+			.flags = I2C_M_RD,+			.len = len,+			.buf = buf,+		}+	};+	for (retry = 0; retry <= I2C_READ_RETRY_TIMES; retry++) {+		ret = i2c_transfer(client->adapter, msgs, 2);+		if (ret == 2) {+			return 0;+		}+		msleep(10);+		printk("read retry\n"); 	}-	return 0;+	dev_err(&client->dev, "i2c_read_block retry over %d\n",+			I2C_READ_RETRY_TIMES);+	return -EIO; }  static irqreturn_t raphnavi_irq_handler(int irq, void *dev_id)