[DEBUG PATCH] Print a message when a spurious i2c SCL timeout occurs.

Ville Syrjälä syrjala at sci.fi
Wed Mar 14 01:32:53 PDT 2012


A quick hack to verify that the fix works as intended...

Do not apply.

---
 drivers/i2c/algos/i2c-algo-bit.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index d25112e..3f547b5 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -89,6 +89,7 @@ static inline void scllo(struct i2c_algo_bit_data *adap)
 static int sclhi(struct i2c_algo_bit_data *adap)
 {
 	unsigned long start;
+	bool timeout = false;
 
 	setscl(adap, 1);
 
@@ -104,11 +105,16 @@ static int sclhi(struct i2c_algo_bit_data *adap)
 		 * are processing data internally.
 		 */
 		if (time_after(jiffies, start + adap->timeout))
+		{
+			timeout = true;
 			break;
+		}
 		cond_resched();
 	}
 	if (!getscl(adap))
 		return -ETIMEDOUT;
+	if (timeout)
+		printk(KERN_CRIT "spurious i2c scl timeout\n");
 #ifdef DEBUG
 	if (jiffies != start && i2c_debug >= 3)
 		pr_debug("i2c-algo-bit: needed %ld jiffies for SCL to go "
-- 
1.7.3.4



More information about the dri-devel mailing list