]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.22.14/i2c-pasemi-fix-nack-detection.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.22.14 / i2c-pasemi-fix-nack-detection.patch
1 From khali@linux-fr.org Mon Nov 19 09:45:02 2007
2 From: Jean Delvare <khali@linux-fr.org>
3 Date: Fri, 16 Nov 2007 10:24:36 +0100
4 Subject: i2c-pasemi: Fix NACK detection
5 To: stable@kernel.org
6 Cc: Olof Johansson <olof@lixom.net>
7 Message-ID: <20071116102436.036f8727@hyperion.delvare>
8
9 From: Jean Delvare <khali@linux-fr.org>
10
11 patch be8a1f7cd4501c3b4b32543577a33aee6d2193ac in mainline.
12
13 Turns out we don't actually check the status to see if there was a
14 device out there to talk to, just if we had a timeout when doing so.
15
16 Add the proper check, so we don't falsly think there are devices
17 on the bus that are not there, etc.
18
19 Signed-off-by: Olof Johansson <olof@lixom.net>
20 Signed-off-by: Jean Delvare <khali@linux-fr.org>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
22
23 ---
24 drivers/i2c/busses/i2c-pasemi.c | 5 +++++
25 1 file changed, 5 insertions(+)
26
27 --- a/drivers/i2c/busses/i2c-pasemi.c
28 +++ b/drivers/i2c/busses/i2c-pasemi.c
29 @@ -51,6 +51,7 @@ struct pasemi_smbus {
30 #define MRXFIFO_DATA_M 0x000000ff
31
32 #define SMSTA_XEN 0x08000000
33 +#define SMSTA_MTN 0x00200000
34
35 #define CTL_MRR 0x00000400
36 #define CTL_MTR 0x00000200
37 @@ -98,6 +99,10 @@ static unsigned int pasemi_smb_waitready
38 status = reg_read(smbus, REG_SMSTA);
39 }
40
41 + /* Got NACK? */
42 + if (status & SMSTA_MTN)
43 + return -ENXIO;
44 +
45 if (timeout < 0) {
46 dev_warn(&smbus->dev->dev, "Timeout, status 0x%08x\n", status);
47 reg_write(smbus, REG_SMSTA, status);