aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/algos/i2c-algo-bit.c
diff options
context:
space:
mode:
authorJan Kundrát <jan.kundrat@cesnet.cz>2018-08-28 04:07:40 -0400
committerWolfram Sang <wsa@the-dreams.de>2018-08-30 17:11:42 -0400
commit1204d12a494cf5dff497859a5febf2ae30a28970 (patch)
tree71e1e2b8d020e41a8291db8eaea03a769dc1dfa8 /drivers/i2c/algos/i2c-algo-bit.c
parent9d9a152ebaa86a9dede4624919566483c955d0a7 (diff)
i2c: algos: bit: make the error messages grepable
Yep, I went looking for one of these, and I wasn't able to find it easily. That's worse than a line which is 82-chars long, IMHO. Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/algos/i2c-algo-bit.c')
-rw-r--r--drivers/i2c/algos/i2c-algo-bit.c55
1 files changed, 31 insertions, 24 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index 6ec65adaba49..c33dcfb87993 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -110,8 +110,8 @@ static int sclhi(struct i2c_algo_bit_data *adap)
110 } 110 }
111#ifdef DEBUG 111#ifdef DEBUG
112 if (jiffies != start && i2c_debug >= 3) 112 if (jiffies != start && i2c_debug >= 3)
113 pr_debug("i2c-algo-bit: needed %ld jiffies for SCL to go " 113 pr_debug("i2c-algo-bit: needed %ld jiffies for SCL to go high\n",
114 "high\n", jiffies - start); 114 jiffies - start);
115#endif 115#endif
116 116
117done: 117done:
@@ -171,8 +171,9 @@ static int i2c_outb(struct i2c_adapter *i2c_adap, unsigned char c)
171 setsda(adap, sb); 171 setsda(adap, sb);
172 udelay((adap->udelay + 1) / 2); 172 udelay((adap->udelay + 1) / 2);
173 if (sclhi(adap) < 0) { /* timed out */ 173 if (sclhi(adap) < 0) { /* timed out */
174 bit_dbg(1, &i2c_adap->dev, "i2c_outb: 0x%02x, " 174 bit_dbg(1, &i2c_adap->dev,
175 "timeout at bit #%d\n", (int)c, i); 175 "i2c_outb: 0x%02x, timeout at bit #%d\n",
176 (int)c, i);
176 return -ETIMEDOUT; 177 return -ETIMEDOUT;
177 } 178 }
178 /* FIXME do arbitration here: 179 /* FIXME do arbitration here:
@@ -185,8 +186,8 @@ static int i2c_outb(struct i2c_adapter *i2c_adap, unsigned char c)
185 } 186 }
186 sdahi(adap); 187 sdahi(adap);
187 if (sclhi(adap) < 0) { /* timeout */ 188 if (sclhi(adap) < 0) { /* timeout */
188 bit_dbg(1, &i2c_adap->dev, "i2c_outb: 0x%02x, " 189 bit_dbg(1, &i2c_adap->dev,
189 "timeout at ack\n", (int)c); 190 "i2c_outb: 0x%02x, timeout at ack\n", (int)c);
190 return -ETIMEDOUT; 191 return -ETIMEDOUT;
191 } 192 }
192 193
@@ -215,8 +216,9 @@ static int i2c_inb(struct i2c_adapter *i2c_adap)
215 sdahi(adap); 216 sdahi(adap);
216 for (i = 0; i < 8; i++) { 217 for (i = 0; i < 8; i++) {
217 if (sclhi(adap) < 0) { /* timeout */ 218 if (sclhi(adap) < 0) { /* timeout */
218 bit_dbg(1, &i2c_adap->dev, "i2c_inb: timeout at bit " 219 bit_dbg(1, &i2c_adap->dev,
219 "#%d\n", 7 - i); 220 "i2c_inb: timeout at bit #%d\n",
221 7 - i);
220 return -ETIMEDOUT; 222 return -ETIMEDOUT;
221 } 223 }
222 indata *= 2; 224 indata *= 2;
@@ -265,8 +267,9 @@ static int test_bus(struct i2c_adapter *i2c_adap)
265 goto bailout; 267 goto bailout;
266 } 268 }
267 if (!scl) { 269 if (!scl) {
268 printk(KERN_WARNING "%s: SCL unexpected low " 270 printk(KERN_WARNING
269 "while pulling SDA low!\n", name); 271 "%s: SCL unexpected low while pulling SDA low!\n",
272 name);
270 goto bailout; 273 goto bailout;
271 } 274 }
272 275
@@ -278,8 +281,9 @@ static int test_bus(struct i2c_adapter *i2c_adap)
278 goto bailout; 281 goto bailout;
279 } 282 }
280 if (!scl) { 283 if (!scl) {
281 printk(KERN_WARNING "%s: SCL unexpected low " 284 printk(KERN_WARNING
282 "while pulling SDA high!\n", name); 285 "%s: SCL unexpected low while pulling SDA high!\n",
286 name);
283 goto bailout; 287 goto bailout;
284 } 288 }
285 289
@@ -291,8 +295,9 @@ static int test_bus(struct i2c_adapter *i2c_adap)
291 goto bailout; 295 goto bailout;
292 } 296 }
293 if (!sda) { 297 if (!sda) {
294 printk(KERN_WARNING "%s: SDA unexpected low " 298 printk(KERN_WARNING
295 "while pulling SCL low!\n", name); 299 "%s: SDA unexpected low while pulling SCL low!\n",
300 name);
296 goto bailout; 301 goto bailout;
297 } 302 }
298 303
@@ -304,8 +309,9 @@ static int test_bus(struct i2c_adapter *i2c_adap)
304 goto bailout; 309 goto bailout;
305 } 310 }
306 if (!sda) { 311 if (!sda) {
307 printk(KERN_WARNING "%s: SDA unexpected low " 312 printk(KERN_WARNING
308 "while pulling SCL high!\n", name); 313 "%s: SDA unexpected low while pulling SCL high!\n",
314 name);
309 goto bailout; 315 goto bailout;
310 } 316 }
311 317
@@ -352,8 +358,8 @@ static int try_address(struct i2c_adapter *i2c_adap,
352 i2c_start(adap); 358 i2c_start(adap);
353 } 359 }
354 if (i && ret) 360 if (i && ret)
355 bit_dbg(1, &i2c_adap->dev, "Used %d tries to %s client at " 361 bit_dbg(1, &i2c_adap->dev,
356 "0x%02x: %s\n", i + 1, 362 "Used %d tries to %s client at 0x%02x: %s\n", i + 1,
357 addr & 1 ? "read from" : "write to", addr >> 1, 363 addr & 1 ? "read from" : "write to", addr >> 1,
358 ret == 1 ? "success" : "failed, timeout?"); 364 ret == 1 ? "success" : "failed, timeout?");
359 return ret; 365 return ret;
@@ -442,8 +448,9 @@ static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
442 if (inval <= 0 || inval > I2C_SMBUS_BLOCK_MAX) { 448 if (inval <= 0 || inval > I2C_SMBUS_BLOCK_MAX) {
443 if (!(flags & I2C_M_NO_RD_ACK)) 449 if (!(flags & I2C_M_NO_RD_ACK))
444 acknak(i2c_adap, 0); 450 acknak(i2c_adap, 0);
445 dev_err(&i2c_adap->dev, "readbytes: invalid " 451 dev_err(&i2c_adap->dev,
446 "block length (%d)\n", inval); 452 "readbytes: invalid block length (%d)\n",
453 inval);
447 return -EPROTO; 454 return -EPROTO;
448 } 455 }
449 /* The original count value accounts for the extra 456 /* The original count value accounts for the extra
@@ -506,8 +513,8 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
506 return -ENXIO; 513 return -ENXIO;
507 } 514 }
508 if (flags & I2C_M_RD) { 515 if (flags & I2C_M_RD) {
509 bit_dbg(3, &i2c_adap->dev, "emitting repeated " 516 bit_dbg(3, &i2c_adap->dev,
510 "start condition\n"); 517 "emitting repeated start condition\n");
511 i2c_repstart(adap); 518 i2c_repstart(adap);
512 /* okay, now switch into reading mode */ 519 /* okay, now switch into reading mode */
513 addr |= 0x01; 520 addr |= 0x01;
@@ -564,8 +571,8 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
564 } 571 }
565 ret = bit_doAddress(i2c_adap, pmsg); 572 ret = bit_doAddress(i2c_adap, pmsg);
566 if ((ret != 0) && !nak_ok) { 573 if ((ret != 0) && !nak_ok) {
567 bit_dbg(1, &i2c_adap->dev, "NAK from " 574 bit_dbg(1, &i2c_adap->dev,
568 "device addr 0x%02x msg #%d\n", 575 "NAK from device addr 0x%02x msg #%d\n",
569 msgs[i].addr, i); 576 msgs[i].addr, i);
570 goto bailout; 577 goto bailout;
571 } 578 }