On 25 January 2013 14:45, Wolfram Sang <w.sang@xxxxxxxxxxxxxx> wrote: > On Thu, Jan 24, 2013 at 04:06:37PM +0530, Viresh Kumar wrote: >> +static int i2c_generic_recovery(struct i2c_adapter *adap) >> +{ >> + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; >> + int i = 0, val = 1, ret = 0; >> + >> + if (bri->prepare_recovery) >> + bri->prepare_recovery(bri); >> + >> + /* >> + * By this time SCL is high, as we need to give 9 falling-rising edges >> + */ >> + while (i++ < RECOVERY_CLK_CNT * 2) { >> + /* SCL shouldn't be low here */ >> + if (val && !bri->get_scl(adap)) { >> + dev_err(&adap->dev, "SCL is stuck Low exit recovery\n"); >> + ret = -EBUSY; >> + goto unprepare; >> + } >> + >> + val = !val; >> + bri->set_scl(adap, val); >> + ndelay(clk_delay); >> + >> + /* break if sda got high, check only when scl line is high */ >> + if (bri->get_sda && val) >> + if (bri->get_sda(adap)) >> + break; > > Didn't we agree to move the SDA check before the SCL setting? Yes. There was a check for SCL (separately) before this loop. I got that into this loop to save on redundant code. And now, after sending a complete clock, we first check sda, then go to next iteration of loop and check scl. Over that, this routine is a modified a bit again, due to Uwe's comment. Wait for v10. You would get that in 2 mins :) BTW, all other comments are accepted. -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html