提交 1204d12a 编写于 作者: J Jan Kundrát 提交者: Wolfram Sang

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: NJan Kundrát <jan.kundrat@cesnet.cz>
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
上级 9d9a152e
...@@ -110,8 +110,8 @@ static int sclhi(struct i2c_algo_bit_data *adap) ...@@ -110,8 +110,8 @@ static int sclhi(struct i2c_algo_bit_data *adap)
} }
#ifdef DEBUG #ifdef DEBUG
if (jiffies != start && i2c_debug >= 3) if (jiffies != start && i2c_debug >= 3)
pr_debug("i2c-algo-bit: needed %ld jiffies for SCL to go " pr_debug("i2c-algo-bit: needed %ld jiffies for SCL to go high\n",
"high\n", jiffies - start); jiffies - start);
#endif #endif
done: done:
...@@ -171,8 +171,9 @@ static int i2c_outb(struct i2c_adapter *i2c_adap, unsigned char c) ...@@ -171,8 +171,9 @@ static int i2c_outb(struct i2c_adapter *i2c_adap, unsigned char c)
setsda(adap, sb); setsda(adap, sb);
udelay((adap->udelay + 1) / 2); udelay((adap->udelay + 1) / 2);
if (sclhi(adap) < 0) { /* timed out */ if (sclhi(adap) < 0) { /* timed out */
bit_dbg(1, &i2c_adap->dev, "i2c_outb: 0x%02x, " bit_dbg(1, &i2c_adap->dev,
"timeout at bit #%d\n", (int)c, i); "i2c_outb: 0x%02x, timeout at bit #%d\n",
(int)c, i);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
/* FIXME do arbitration here: /* FIXME do arbitration here:
...@@ -185,8 +186,8 @@ static int i2c_outb(struct i2c_adapter *i2c_adap, unsigned char c) ...@@ -185,8 +186,8 @@ static int i2c_outb(struct i2c_adapter *i2c_adap, unsigned char c)
} }
sdahi(adap); sdahi(adap);
if (sclhi(adap) < 0) { /* timeout */ if (sclhi(adap) < 0) { /* timeout */
bit_dbg(1, &i2c_adap->dev, "i2c_outb: 0x%02x, " bit_dbg(1, &i2c_adap->dev,
"timeout at ack\n", (int)c); "i2c_outb: 0x%02x, timeout at ack\n", (int)c);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -215,8 +216,9 @@ static int i2c_inb(struct i2c_adapter *i2c_adap) ...@@ -215,8 +216,9 @@ static int i2c_inb(struct i2c_adapter *i2c_adap)
sdahi(adap); sdahi(adap);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
if (sclhi(adap) < 0) { /* timeout */ if (sclhi(adap) < 0) { /* timeout */
bit_dbg(1, &i2c_adap->dev, "i2c_inb: timeout at bit " bit_dbg(1, &i2c_adap->dev,
"#%d\n", 7 - i); "i2c_inb: timeout at bit #%d\n",
7 - i);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
indata *= 2; indata *= 2;
...@@ -265,8 +267,9 @@ static int test_bus(struct i2c_adapter *i2c_adap) ...@@ -265,8 +267,9 @@ static int test_bus(struct i2c_adapter *i2c_adap)
goto bailout; goto bailout;
} }
if (!scl) { if (!scl) {
printk(KERN_WARNING "%s: SCL unexpected low " printk(KERN_WARNING
"while pulling SDA low!\n", name); "%s: SCL unexpected low while pulling SDA low!\n",
name);
goto bailout; goto bailout;
} }
...@@ -278,8 +281,9 @@ static int test_bus(struct i2c_adapter *i2c_adap) ...@@ -278,8 +281,9 @@ static int test_bus(struct i2c_adapter *i2c_adap)
goto bailout; goto bailout;
} }
if (!scl) { if (!scl) {
printk(KERN_WARNING "%s: SCL unexpected low " printk(KERN_WARNING
"while pulling SDA high!\n", name); "%s: SCL unexpected low while pulling SDA high!\n",
name);
goto bailout; goto bailout;
} }
...@@ -291,8 +295,9 @@ static int test_bus(struct i2c_adapter *i2c_adap) ...@@ -291,8 +295,9 @@ static int test_bus(struct i2c_adapter *i2c_adap)
goto bailout; goto bailout;
} }
if (!sda) { if (!sda) {
printk(KERN_WARNING "%s: SDA unexpected low " printk(KERN_WARNING
"while pulling SCL low!\n", name); "%s: SDA unexpected low while pulling SCL low!\n",
name);
goto bailout; goto bailout;
} }
...@@ -304,8 +309,9 @@ static int test_bus(struct i2c_adapter *i2c_adap) ...@@ -304,8 +309,9 @@ static int test_bus(struct i2c_adapter *i2c_adap)
goto bailout; goto bailout;
} }
if (!sda) { if (!sda) {
printk(KERN_WARNING "%s: SDA unexpected low " printk(KERN_WARNING
"while pulling SCL high!\n", name); "%s: SDA unexpected low while pulling SCL high!\n",
name);
goto bailout; goto bailout;
} }
...@@ -352,8 +358,8 @@ static int try_address(struct i2c_adapter *i2c_adap, ...@@ -352,8 +358,8 @@ static int try_address(struct i2c_adapter *i2c_adap,
i2c_start(adap); i2c_start(adap);
} }
if (i && ret) if (i && ret)
bit_dbg(1, &i2c_adap->dev, "Used %d tries to %s client at " bit_dbg(1, &i2c_adap->dev,
"0x%02x: %s\n", i + 1, "Used %d tries to %s client at 0x%02x: %s\n", i + 1,
addr & 1 ? "read from" : "write to", addr >> 1, addr & 1 ? "read from" : "write to", addr >> 1,
ret == 1 ? "success" : "failed, timeout?"); ret == 1 ? "success" : "failed, timeout?");
return ret; return ret;
...@@ -442,8 +448,9 @@ static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) ...@@ -442,8 +448,9 @@ static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
if (inval <= 0 || inval > I2C_SMBUS_BLOCK_MAX) { if (inval <= 0 || inval > I2C_SMBUS_BLOCK_MAX) {
if (!(flags & I2C_M_NO_RD_ACK)) if (!(flags & I2C_M_NO_RD_ACK))
acknak(i2c_adap, 0); acknak(i2c_adap, 0);
dev_err(&i2c_adap->dev, "readbytes: invalid " dev_err(&i2c_adap->dev,
"block length (%d)\n", inval); "readbytes: invalid block length (%d)\n",
inval);
return -EPROTO; return -EPROTO;
} }
/* The original count value accounts for the extra /* 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,8 +513,8 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
return -ENXIO; return -ENXIO;
} }
if (flags & I2C_M_RD) { if (flags & I2C_M_RD) {
bit_dbg(3, &i2c_adap->dev, "emitting repeated " bit_dbg(3, &i2c_adap->dev,
"start condition\n"); "emitting repeated start condition\n");
i2c_repstart(adap); i2c_repstart(adap);
/* okay, now switch into reading mode */ /* okay, now switch into reading mode */
addr |= 0x01; addr |= 0x01;
...@@ -564,8 +571,8 @@ static int bit_xfer(struct i2c_adapter *i2c_adap, ...@@ -564,8 +571,8 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
} }
ret = bit_doAddress(i2c_adap, pmsg); ret = bit_doAddress(i2c_adap, pmsg);
if ((ret != 0) && !nak_ok) { if ((ret != 0) && !nak_ok) {
bit_dbg(1, &i2c_adap->dev, "NAK from " bit_dbg(1, &i2c_adap->dev,
"device addr 0x%02x msg #%d\n", "NAK from device addr 0x%02x msg #%d\n",
msgs[i].addr, i); msgs[i].addr, i);
goto bailout; goto bailout;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册