Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1204d12a authored by Jan Kundrát's avatar Jan Kundrát Committed by Wolfram Sang
Browse files

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: default avatarJan Kundrát <jan.kundrat@cesnet.cz>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 9d9a152e
Loading
Loading
Loading
Loading
+31 −24
Original line number Diff line number Diff line
@@ -110,8 +110,8 @@ static int sclhi(struct i2c_algo_bit_data *adap)
	}
#ifdef DEBUG
	if (jiffies != start && i2c_debug >= 3)
		pr_debug("i2c-algo-bit: needed %ld jiffies for SCL to go "
			 "high\n", jiffies - start);
		pr_debug("i2c-algo-bit: needed %ld jiffies for SCL to go high\n",
			 jiffies - start);
#endif

done:
@@ -171,8 +171,9 @@ static int i2c_outb(struct i2c_adapter *i2c_adap, unsigned char c)
		setsda(adap, sb);
		udelay((adap->udelay + 1) / 2);
		if (sclhi(adap) < 0) { /* timed out */
			bit_dbg(1, &i2c_adap->dev, "i2c_outb: 0x%02x, "
				"timeout at bit #%d\n", (int)c, i);
			bit_dbg(1, &i2c_adap->dev,
				"i2c_outb: 0x%02x, timeout at bit #%d\n",
				(int)c, i);
			return -ETIMEDOUT;
		}
		/* FIXME do arbitration here:
@@ -185,8 +186,8 @@ static int i2c_outb(struct i2c_adapter *i2c_adap, unsigned char c)
	}
	sdahi(adap);
	if (sclhi(adap) < 0) { /* timeout */
		bit_dbg(1, &i2c_adap->dev, "i2c_outb: 0x%02x, "
			"timeout at ack\n", (int)c);
		bit_dbg(1, &i2c_adap->dev,
			"i2c_outb: 0x%02x, timeout at ack\n", (int)c);
		return -ETIMEDOUT;
	}

@@ -215,8 +216,9 @@ static int i2c_inb(struct i2c_adapter *i2c_adap)
	sdahi(adap);
	for (i = 0; i < 8; i++) {
		if (sclhi(adap) < 0) { /* timeout */
			bit_dbg(1, &i2c_adap->dev, "i2c_inb: timeout at bit "
				"#%d\n", 7 - i);
			bit_dbg(1, &i2c_adap->dev,
				"i2c_inb: timeout at bit #%d\n",
				7 - i);
			return -ETIMEDOUT;
		}
		indata *= 2;
@@ -265,8 +267,9 @@ static int test_bus(struct i2c_adapter *i2c_adap)
		goto bailout;
	}
	if (!scl) {
		printk(KERN_WARNING "%s: SCL unexpected low "
		       "while pulling SDA low!\n", name);
		printk(KERN_WARNING
		       "%s: SCL unexpected low while pulling SDA low!\n",
		       name);
		goto bailout;
	}

@@ -278,8 +281,9 @@ static int test_bus(struct i2c_adapter *i2c_adap)
		goto bailout;
	}
	if (!scl) {
		printk(KERN_WARNING "%s: SCL unexpected low "
		       "while pulling SDA high!\n", name);
		printk(KERN_WARNING
		       "%s: SCL unexpected low while pulling SDA high!\n",
		       name);
		goto bailout;
	}

@@ -291,8 +295,9 @@ static int test_bus(struct i2c_adapter *i2c_adap)
		goto bailout;
	}
	if (!sda) {
		printk(KERN_WARNING "%s: SDA unexpected low "
		       "while pulling SCL low!\n", name);
		printk(KERN_WARNING
		       "%s: SDA unexpected low while pulling SCL low!\n",
		       name);
		goto bailout;
	}

@@ -304,8 +309,9 @@ static int test_bus(struct i2c_adapter *i2c_adap)
		goto bailout;
	}
	if (!sda) {
		printk(KERN_WARNING "%s: SDA unexpected low "
		       "while pulling SCL high!\n", name);
		printk(KERN_WARNING
		       "%s: SDA unexpected low while pulling SCL high!\n",
		       name);
		goto bailout;
	}

@@ -352,8 +358,8 @@ static int try_address(struct i2c_adapter *i2c_adap,
		i2c_start(adap);
	}
	if (i && ret)
		bit_dbg(1, &i2c_adap->dev, "Used %d tries to %s client at "
			"0x%02x: %s\n", i + 1,
		bit_dbg(1, &i2c_adap->dev,
			"Used %d tries to %s client at 0x%02x: %s\n", i + 1,
			addr & 1 ? "read from" : "write to", addr >> 1,
			ret == 1 ? "success" : "failed, timeout?");
	return ret;
@@ -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 (!(flags & I2C_M_NO_RD_ACK))
					acknak(i2c_adap, 0);
				dev_err(&i2c_adap->dev, "readbytes: invalid "
					"block length (%d)\n", inval);
				dev_err(&i2c_adap->dev,
					"readbytes: invalid block length (%d)\n",
					inval);
				return -EPROTO;
			}
			/* 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)
			return -ENXIO;
		}
		if (flags & I2C_M_RD) {
			bit_dbg(3, &i2c_adap->dev, "emitting repeated "
				"start condition\n");
			bit_dbg(3, &i2c_adap->dev,
				"emitting repeated start condition\n");
			i2c_repstart(adap);
			/* okay, now switch into reading mode */
			addr |= 0x01;
@@ -564,8 +571,8 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
			}
			ret = bit_doAddress(i2c_adap, pmsg);
			if ((ret != 0) && !nak_ok) {
				bit_dbg(1, &i2c_adap->dev, "NAK from "
					"device addr 0x%02x msg #%d\n",
				bit_dbg(1, &i2c_adap->dev,
					"NAK from device addr 0x%02x msg #%d\n",
					msgs[i].addr, i);
				goto bailout;
			}