Skip to content

Commit

Permalink
i2c-pasemi: Fix NACK detection
Browse files Browse the repository at this point in the history
Turns out we don't actually check the status to see if there was a
device out there to talk to, just if we had a timeout when doing so.

Add the proper check, so we don't falsly think there are devices
on the bus that are not there, etc.

Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
  • Loading branch information
Olof Johansson authored and Jean Delvare committed Nov 15, 2007
1 parent ff23f3e commit be8a1f7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/i2c/busses/i2c-pasemi.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct pasemi_smbus {
#define MRXFIFO_DATA_M 0x000000ff

#define SMSTA_XEN 0x08000000
#define SMSTA_MTN 0x00200000

#define CTL_MRR 0x00000400
#define CTL_MTR 0x00000200
Expand Down Expand Up @@ -98,6 +99,10 @@ static unsigned int pasemi_smb_waitready(struct pasemi_smbus *smbus)
status = reg_read(smbus, REG_SMSTA);
}

/* Got NACK? */
if (status & SMSTA_MTN)
return -ENXIO;

if (timeout < 0) {
dev_warn(&smbus->dev->dev, "Timeout, status 0x%08x\n", status);
reg_write(smbus, REG_SMSTA, status);
Expand Down

0 comments on commit be8a1f7

Please sign in to comment.