diff options
Diffstat (limited to 'src/southbridge/intel/i82801gx/smbus.h')
-rw-r--r-- | src/southbridge/intel/i82801gx/smbus.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/southbridge/intel/i82801gx/smbus.h b/src/southbridge/intel/i82801gx/smbus.h index 80456bc9ff..ff8e1fb112 100644 --- a/src/southbridge/intel/i82801gx/smbus.h +++ b/src/southbridge/intel/i82801gx/smbus.h @@ -24,7 +24,7 @@ static void smbus_delay(void) static int smbus_wait_until_ready(u16 smbus_base) { - unsigned loops = SMBUS_TIMEOUT; + unsigned int loops = SMBUS_TIMEOUT; unsigned char byte; do { smbus_delay(); @@ -37,7 +37,7 @@ static int smbus_wait_until_ready(u16 smbus_base) static int smbus_wait_until_done(u16 smbus_base) { - unsigned loops = SMBUS_TIMEOUT; + unsigned int loops = SMBUS_TIMEOUT; unsigned char byte; do { smbus_delay(); @@ -48,14 +48,13 @@ static int smbus_wait_until_done(u16 smbus_base) return loops ? 0 : -1; } -static int do_smbus_read_byte(unsigned smbus_base, unsigned device, unsigned address) +static int do_smbus_read_byte(unsigned int smbus_base, unsigned int device, unsigned int address) { unsigned char global_status_register; unsigned char byte; - if (smbus_wait_until_ready(smbus_base) < 0) { + if (smbus_wait_until_ready(smbus_base) < 0) return SMBUS_WAIT_UNTIL_READY_TIMEOUT; - } /* Setup transaction */ /* Disable interrupts */ outb(inb(smbus_base + SMBHSTCTL) & (~1), smbus_base + SMBHSTCTL); @@ -77,9 +76,8 @@ static int do_smbus_read_byte(unsigned smbus_base, unsigned device, unsigned add smbus_base + SMBHSTCTL); /* Poll for transaction completion */ - if (smbus_wait_until_done(smbus_base) < 0) { + if (smbus_wait_until_done(smbus_base) < 0) return SMBUS_WAIT_UNTIL_DONE_TIMEOUT; - } global_status_register = inb(smbus_base + SMBHSTSTAT); @@ -88,8 +86,7 @@ static int do_smbus_read_byte(unsigned smbus_base, unsigned device, unsigned add /* Read results of transaction */ byte = inb(smbus_base + SMBHSTDAT0); - if (global_status_register != (1 << 1)) { + if (global_status_register != (1 << 1)) return SMBUS_ERROR; - } return byte; } |