Skip to contentSkip to conversation

i2c: fix bit algorithm timeout for low values.

PATCH Applied Dave Airlie 3 participants 4 messages Apr 23, 2009 – May 5, 2009 I2C subsystem host drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: fix bit algorithm timeout for low values.

From: Dave Airlie <[email protected]>

When fetching DDC using i2c algo bit, we were often seeing timeouts before getting valid EDID on a retry. The VESA spec states 2ms is the DDC timeout, so when this translates into 1 jiffie and we are close to the end of the time period, it could return with a timeout less than 2ms.

Change this code to use time_after instead of time_after_eq.

---
 drivers/i2c/algos/i2c-algo-bit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/algos/i2c-algo-bit.c +1 -1
index d420cc5..e25e139 100644
@@ -104,7 +104,7 @@ static int sclhi(struct i2c_algo_bit_data *adap)
 		 * chips may hold it low ("clock stretching") while they
 		 * are processing data internally.
 		 */
-		if (time_after_eq(jiffies, start + adap->timeout))
+		if (time_after(jiffies, start + adap->timeout))
 			return -ETIMEDOUT;
 		cond_resched();
 	}
Signature · 1 line
1.6.0.6
Applied
#1 lore raw

Hi Dave,

Quoted 20 lines · Dave Airlie

From: Dave Airlie <[email protected]>

When fetching DDC using i2c algo bit, we were often seeing timeouts before getting valid EDID on a retry. The VESA spec states 2ms is the DDC timeout, so when this translates into 1 jiffie and we are close to the end of the time period, it could return with a timeout less than 2ms.

Change this code to use time_after instead of time_after_eq.

---
 drivers/i2c/algos/i2c-algo-bit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/algos/i2c-algo-bit.c +0 -0
index d420cc5..e25e139 100644

drivers/i2c/algos/i2c-algo-bit.c static int sclhi(struct i2c_algo_bit_data *adap) · line 110

Quoted 8 lines
drivers/i2c/algos/i2c-algo-bit.c +1 -1
@@ -104,7 +104,7 @@ static int sclhi(struct i2c_algo_bit_data *adap)
 		 * chips may hold it low ("clock stretching") while they
 		 * are processing data internally.
 		 */
-		if (time_after_eq(jiffies, start + adap->timeout))
+		if (time_after(jiffies, start + adap->timeout))
 			return -ETIMEDOUT;
 		cond_resched();
 	}

Applied, thanks. I agree this should go in stable.

Signature · 1 line
Jean Delvare
#2 lore raw
Quoted 18 lines · Jean Delvare

Hi Dave,

Quoted 15 lines · Dave Airlie

From: Dave Airlie <[email protected]>

When fetching DDC using i2c algo bit, we were often seeing timeouts before getting valid EDID on a retry. The VESA spec states 2ms is the DDC timeout, so when this translates into 1 jiffie and we are close to the end of the time period, it could return with a timeout less than 2ms.

Change this code to use time_after instead of time_after_eq.

---
 drivers/i2c/algos/i2c-algo-bit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 15 lines

drivers/i2c/algos/i2c-algo-bit.c static int sclhi(struct i2c_algo_bit_data *adap) · line 110

Quoted 13 lines
drivers/i2c/algos/i2c-algo-bit.c +1 -1
index d420cc5..e25e139 100644
@@ -104,7 +104,7 @@ static int sclhi(struct i2c_algo_bit_data *adap)
 		 * chips may hold it low ("clock stretching") while they
 		 * are processing data internally.
 		 */
-		if (time_after_eq(jiffies, start + adap->timeout))
+		if (time_after(jiffies, start + adap->timeout))
 			return -ETIMEDOUT;
 		cond_resched();
 	}

Applied, thanks. I agree this should go in stable.

I don't see this in Linus's tree anywhere, am I just missing it?

thanks,

greg k-h

#3 lore raw

Hi Greg,

Quoted 35 lines · Greg KH
Quoted 18 lines · Jean Delvare

Hi Dave,

Quoted 15 lines · Dave Airlie

From: Dave Airlie <[email protected]>

When fetching DDC using i2c algo bit, we were often seeing timeouts before getting valid EDID on a retry. The VESA spec states 2ms is the DDC timeout, so when this translates into 1 jiffie and we are close to the end of the time period, it could return with a timeout less than 2ms.

Change this code to use time_after instead of time_after_eq.

---
 drivers/i2c/algos/i2c-algo-bit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 15 lines

drivers/i2c/algos/i2c-algo-bit.c static int sclhi(struct i2c_algo_bit_data *adap) · line 110

Quoted 13 lines
drivers/i2c/algos/i2c-algo-bit.c +1 -1
index d420cc5..e25e139 100644
@@ -104,7 +104,7 @@ static int sclhi(struct i2c_algo_bit_data *adap)
 		 * chips may hold it low ("clock stretching") while they
 		 * are processing data internally.
 		 */
-		if (time_after_eq(jiffies, start + adap->timeout))
+		if (time_after(jiffies, start + adap->timeout))
 			return -ETIMEDOUT;
 		cond_resched();
 	}

Applied, thanks. I agree this should go in stable.

Quoted 1 line

I don't see this in Linus's tree anywhere, am I just missing it?

You're correct, it's not there yet, I'll push it to Linus today. Busy busy busy.

Signature · 1 line
Jean Delvare