i2c: i2c-cros-ec-tunnel: Reduce logging noise
Subsystems (2)
PATCH v3 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, drop the message. Also, report -ENXIO instead of -EREMOTEIO if the access error is due to NAK from the device, and return -EIO instead of -EREMOTEIO for other errors, as suggested in Documentation/i2c/fault-codes.
---
v3: Do not assume that unknown status bits reflect an error.
v2: Drop message entirely instead of replacing it with dev_dbg,
and return -EIO instead of -EREMOTEIO for unknown errors.
drivers/i2c/busses/i2c-cros-ec-tunnel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-cros-ec-tunnel.c +4 -4
@@ -154,8 +154,10 @@ 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_NAK ) +return -ENXIO ;else if (resp->i2c_status &EC_I2C_STATUS_ERROR ) -return -EREMOTEIO ; +return -EIO ;/* Other side could send us back fewer messages, but not more */ if (resp->num_msgs > *num)
@@ -222,10 +224,8 @@ 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); +if (result <0 ) goto exit; - }/* Indicate success by saying how many messages were sent */ result = num;
Signature · 1 line
2.5.0
Hi
Quoted 40 lines · Guenter Roeck
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 -121This 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, drop the message. Also, report
-ENXIOinstead of-EREMOTEIOif the access error is due to NAK from the device, and return-EIOinstead of-EREMOTEIOfor other errors, as suggested inDocumentation/i2c/fault-codes.Signed-off-by Guenter Roeck <[email protected]>---
v3: Do not assume that unknown status bits reflect an error.
v2: Drop message entirely instead of replacing it withdev_dbg,
and return-EIOinstead of-EREMOTEIOfor unknown errors.drivers/i2c/busses/i2c-cros-ec-tunnel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/i2c/busses/i2c-cros-ec-tunnel.c +3
-1@@ -154,8 +154,10 @@ 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_NAK ) +return -ENXIO ;else if (resp->i2c_status &EC_I2C_STATUS_ERROR ) -return -EREMOTEIO ; +return -EIO ;/* Other side could send us back fewer messages, but not more */ if (resp->num_msgs > *num)@@ -222,10 +224,8 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[], }
drivers/i2c/busses/i2c-cros-ec-tunnel.c static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[], · line 231
Quoted 10 lines
drivers/i2c/busses/i2c-cros-ec-tunnel.c +1
-3result =ec_i2c_parse_response (msg->data, i2c_msgs, &num); -if (result <0 ) { -dev_err (dev,"Error parsing EC i2c message %d\n" , result); +if (result <0 ) goto exit; - }/* Indicate success by saying how many messages were sent */ result = num;
Wolfram Sang
AppliedQuoted 8 lines · Guenter Roeck
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 -121This can happen a lot if, for example, the i2c-detect command is executed.
Quoted 7 lines
Since it is perfectly normal for an i2c controller to report an error, drop the message. Also, report
-ENXIOinstead of-EREMOTEIOif the access error is due to NAK from the device, and return-EIOinstead of-EREMOTEIOfor other errors, as suggested inDocumentation/i2c/fault-codes.Signed-off-by Guenter Roeck <[email protected]>Reviewed-by Douglas Anderson <[email protected]>
Applied to for-next, thanks!