Patch from Roel Kluin, backported from Linux 2.6.

With a postfix decrement these timeouts reach -1 rather than 0, but
after the loop it is tested whether they have become 0.

As pointed out by Jean Delvare, the condition we are waiting for should
also be tested before the timeout. With the current order, you could
exit with a timeout error while the job is actually done.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-2.10@5687 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2009-03-18 09:33:04 +00:00
1 parent 465e03ce73
commit 74bf4482f4
2 files changed
+3 -2

No files matched your search

+1
View File
@@ -4,6 +4,7 @@ lm_sensors CHANGES file
SVN-HEAD
File lm_sensors.lsm: Delete, don't advertise a legacy branch
File doc/developers/release_checklist: Skip mail to lsm
Module i2c-amd8111: Fix timeout handling (2.6 backport)
Module it87: Properly decode -128 degrees C (2.6 backport)
Program sensors-detect: Fix detection of older DS1621
+2 -2
View File
@@ -79,7 +79,7 @@ unsigned int amd_ec_wait_write(struct amd_smbus *smbus)
{
int timeout = 500;
while (timeout-- && (inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_IBF))
while ((inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_IBF) && --timeout)
udelay(1);
if (!timeout) {
@@ -94,7 +94,7 @@ unsigned int amd_ec_wait_read(struct amd_smbus *smbus)
{
int timeout = 500;
while (timeout-- && (~inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_OBF))
while ((~inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_OBF) && --timeout)
udelay(1);
if (!timeout) {