Skip to contentSkip to conversation

i2c: i2c-cros-ec-tunnel: Reduce logging noise

PATCH Superseded Guenter Roeck 2 participants 2 messages Jul 25, 2016

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: i2c-cros-ec-tunnel: Reduce logging noise

If an i2c access through i2c-cros-ec-tunnel returns an error, the following log message is seen on the console.

cros-ec-i2c-tunnel ff200000.spi:ec@0:i2c-tunnel:
Error parsing EC i2c message -121

This can happen a lot if, for example, the i2c-detect command is executed.

Since it is perfectly normal for an i2c controller to report an error, replace the error message with a debug message. Also, report -ENXIO instead of -EREMOTEIO if the access error is due to NAK from the device, as suggested in Documentation/i2c/fault-codes.

---
 drivers/i2c/busses/i2c-cros-ec-tunnel.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-cros-ec-tunnel.c +4 -2
index a0d95ff682ae..95f26fecc6e9 100644
@@ -154,7 +154,9 @@ static int ec_i2c_parse_response(const u8 *buf, struct i2c_msg i2c_msgs[],
 	resp = (const struct ec_response_i2c_passthru *)buf;
 	if (resp->i2c_status & EC_I2C_STATUS_TIMEOUT)
 		return -ETIMEDOUT;
-	else if (resp->i2c_status & EC_I2C_STATUS_ERROR)
+	else if (resp->i2c_status & EC_I2C_STATUS_NAK)
+		return -ENXIO;
+	else if (resp->i2c_status)
 		return -EREMOTEIO;
 
 	/* Other side could send us back fewer messages, but not more */
@@ -223,7 +225,7 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[],
 
 	result = ec_i2c_parse_response(msg->data, i2c_msgs, &num);
 	if (result < 0) {
-		dev_err(dev, "Error parsing EC i2c message %d\n", result);
+		dev_dbg(dev, "Error parsing EC i2c message %d\n", result);
 		goto exit;
 	}
 
Signature · 1 line
2.5.0
#1 lore raw

drivers/i2c/busses/i2c-cros-ec-tunnel.c static int ec_i2c_parse_response(const u8 *buf, struct i2c_msg i2c_msgs[], · line 160

Quoted 6 lines
drivers/i2c/busses/i2c-cros-ec-tunnel.c +3 -1
-	else if (resp->i2c_status & EC_I2C_STATUS_ERROR)
+	else if (resp->i2c_status & EC_I2C_STATUS_NAK)
+		return -ENXIO;
+	else if (resp->i2c_status)
 		return -EREMOTEIO;

Since you mentioned Documentation/i2c/fault-codes already: -EIO?

drivers/i2c/busses/i2c-cros-ec-tunnel.c static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[], · line 228

Quoted 8 lines
drivers/i2c/busses/i2c-cros-ec-tunnel.c +1 -1
 	/* Other side could send us back fewer messages, but not more */
@@ -223,7 +225,7 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[],
 
 	result = ec_i2c_parse_response(msg->data, i2c_msgs, &num);
 	if (result < 0) {
-		dev_err(dev, "Error parsing EC i2c message %d\n", result);
+		dev_dbg(dev, "Error parsing EC i2c message %d\n", result);

For me, this message can go entirely, but I'll leave this up to you.