@@ -137,7 +137,9 @@
#define I2C_PORT_BUSY_RESET 0x80000000
-#define I2C_LOCAL_WAIT_TIMEOUT 2 /* jiffies */
+#define I2C_LOCAL_WAIT_TIMEOUT msecs_to_jiffies(10)
+
+#define I2C_MSG_SCHED_TIMEOUT msecs_to_jiffies(50)
/* choose timeout length from legacy driver; it's well tested */
#define I2C_ABORT_TIMEOUT msecs_to_jiffies(100)
@@ -655,6 +657,19 @@ static int fsi_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
adap->timeout - (jiffies - start_time));
if (rc)
goto unlock;
+
+ if (i && i != (num - 1)) {
+ /*
+ * Release the CPU for a while if we're in the middle
+ * of some large transfers. Otherwise, we could hold
+ * the CPU for a very long and risk watchdog problems.
+ */
+ set_current_state(TASK_INTERRUPTIBLE);
+ if (schedule_timeout(I2C_MSG_SCHED_TIMEOUT) > 0) {
+ rc = -EINTR;
+ goto unlock;
+ }
+ }
}
unlock: