diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-12-06 11:06:18 -0500 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-12-06 11:06:18 -0500 |
commit | d7d838a6ebbab6e786148133b6cf9617144603b4 (patch) | |
tree | 1ae24fd558dda66a188bb5694eb8865b16d49da4 /drivers/i2c/busses | |
parent | 02864d58ce102804b148c92e44726d9571d65d1e (diff) |
i2c-powermac: Log errors
Log errors when they happen, otherwise we have no idea what went
wrong.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Michel Daenzer <michel@daenzer.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r-- | drivers/i2c/busses/i2c-powermac.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index dba8e387f43f..5c22d9f0289b 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c | |||
@@ -108,16 +108,25 @@ static s32 i2c_powermac_smbus_xfer( struct i2c_adapter* adap, | |||
108 | } | 108 | } |
109 | 109 | ||
110 | rc = pmac_i2c_open(bus, 0); | 110 | rc = pmac_i2c_open(bus, 0); |
111 | if (rc) | 111 | if (rc) { |
112 | dev_err(&adap->dev, "Failed to open I2C, err %d\n", rc); | ||
112 | return rc; | 113 | return rc; |
114 | } | ||
113 | 115 | ||
114 | rc = pmac_i2c_setmode(bus, mode); | 116 | rc = pmac_i2c_setmode(bus, mode); |
115 | if (rc) | 117 | if (rc) { |
118 | dev_err(&adap->dev, "Failed to set I2C mode %d, err %d\n", | ||
119 | mode, rc); | ||
116 | goto bail; | 120 | goto bail; |
121 | } | ||
117 | 122 | ||
118 | rc = pmac_i2c_xfer(bus, addrdir, subsize, subaddr, buf, len); | 123 | rc = pmac_i2c_xfer(bus, addrdir, subsize, subaddr, buf, len); |
119 | if (rc) | 124 | if (rc) { |
125 | dev_err(&adap->dev, | ||
126 | "I2C transfer at 0x%02x failed, size %d, err %d\n", | ||
127 | addrdir >> 1, size, rc); | ||
120 | goto bail; | 128 | goto bail; |
129 | } | ||
121 | 130 | ||
122 | if (size == I2C_SMBUS_WORD_DATA && read) { | 131 | if (size == I2C_SMBUS_WORD_DATA && read) { |
123 | data->word = ((u16)local[1]) << 8; | 132 | data->word = ((u16)local[1]) << 8; |
@@ -157,12 +166,21 @@ static int i2c_powermac_master_xfer( struct i2c_adapter *adap, | |||
157 | addrdir ^= 1; | 166 | addrdir ^= 1; |
158 | 167 | ||
159 | rc = pmac_i2c_open(bus, 0); | 168 | rc = pmac_i2c_open(bus, 0); |
160 | if (rc) | 169 | if (rc) { |
170 | dev_err(&adap->dev, "Failed to open I2C, err %d\n", rc); | ||
161 | return rc; | 171 | return rc; |
172 | } | ||
162 | rc = pmac_i2c_setmode(bus, pmac_i2c_mode_std); | 173 | rc = pmac_i2c_setmode(bus, pmac_i2c_mode_std); |
163 | if (rc) | 174 | if (rc) { |
175 | dev_err(&adap->dev, "Failed to set I2C mode %d, err %d\n", | ||
176 | pmac_i2c_mode_std, rc); | ||
164 | goto bail; | 177 | goto bail; |
178 | } | ||
165 | rc = pmac_i2c_xfer(bus, addrdir, 0, 0, msgs->buf, msgs->len); | 179 | rc = pmac_i2c_xfer(bus, addrdir, 0, 0, msgs->buf, msgs->len); |
180 | if (rc < 0) | ||
181 | dev_err(&adap->dev, "I2C %s 0x%02x failed, err %d\n", | ||
182 | addrdir & 1 ? "read from" : "write to", addrdir >> 1, | ||
183 | rc); | ||
166 | bail: | 184 | bail: |
167 | pmac_i2c_close(bus); | 185 | pmac_i2c_close(bus); |
168 | return rc < 0 ? rc : 1; | 186 | return rc < 0 ? rc : 1; |