i2c-algo-bit: Fix spurious SCL timeouts under heavy load
authorVille Syrjala <syrjala@sci.fi>
Thu, 15 Mar 2012 17:11:05 +0000 (18:11 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Mar 2012 15:57:59 +0000 (08:57 -0700)
commit35f68010b4311eacf6340473b062418715d68a39
treecb482f2b882598f145a2643bbee9e9e20ddfbbcd
parent90b7d65c8cba8830ede8307a21a76c8757eefa3a
i2c-algo-bit: Fix spurious SCL timeouts under heavy load

commit 8ee161ce5e0cfc689eb677f227a6248191165fac upstream.

When the system is under heavy load, there can be a significant delay
between the getscl() and time_after() calls inside sclhi(). That delay
may cause the time_after() check to trigger after SCL has gone high,
causing sclhi() to return -ETIMEDOUT.

To fix the problem, double check that SCL is still low after the
timeout has been reached, before deciding to return -ETIMEDOUT.

Signed-off-by: Ville Syrjala <syrjala@sci.fi>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/i2c/algos/i2c-algo-bit.c