[PATCH] i2c-i801: Fix block transaction poll loops
authorJean Delvare <khali@linux-fr.org>
Mon, 12 Jun 2006 19:49:36 +0000 (21:49 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 22 Jun 2006 18:10:35 +0000 (11:10 -0700)
i2c-i801: Fix block transaction poll loops

Two of the three poll loops have the poll and sleep swapped,
causing an extra sleep to occur after the polled condition is
fulfilled. In practice, this doubles the amount of sleep time for
every block transaction.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/i2c/busses/i2c-i801.c

index dfca74933625e0c1c629778f0af1f9f8f00351b3..4396dc91d5f5e32d41aea40229653df2fd804c6f 100644 (file)
@@ -334,8 +334,8 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
                /* We will always wait for a fraction of a second! */
                timeout = 0;
                do {
-                       temp = inb_p(SMBHSTSTS);
                        msleep(1);
+                       temp = inb_p(SMBHSTSTS);
                }
                    while ((!(temp & 0x80))
                           && (timeout++ < MAX_TIMEOUT));
@@ -393,8 +393,8 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
                /* wait for INTR bit as advised by Intel */
                timeout = 0;
                do {
-                       temp = inb_p(SMBHSTSTS);
                        msleep(1);
+                       temp = inb_p(SMBHSTSTS);
                } while ((!(temp & 0x02))
                           && (timeout++ < MAX_TIMEOUT));