From: Alex Elder Date: Wed, 10 Dec 2014 20:50:48 +0000 (-0600) Subject: greybus: ENODEV can be an expected error too X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1774 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7de3e650fb736bf7c40e20f5dc866c544376119c;p=karo-tx-linux.git greybus: ENODEV can be an expected error too When probing for i2c devices, a read transfer operation can be used. In this case, it is expected that some devices will not be found, so ENODEV is an expected failure. Don't issue a warning if the return value is -ENODEV. Note: I anticipate we might have to be more precise in identifying this specific case, but for now this eliminates a bogus warning when probing i2c devices. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/i2c-gb.c b/drivers/staging/greybus/i2c-gb.c index f63b60e50181..4ef6ea1230a5 100644 --- a/drivers/staging/greybus/i2c-gb.c +++ b/drivers/staging/greybus/i2c-gb.c @@ -276,6 +276,14 @@ static void gb_i2c_transfer_response(struct i2c_msg *msgs, u32 msg_count, } } +/* + * Some i2c transfer operations return results that are expected. + */ +static bool gb_i2c_expected_transfer_error(int errno) +{ + return errno == -EAGAIN || errno == -ENODEV; +} + static int gb_i2c_transfer_operation(struct gb_i2c_device *gb_i2c_dev, struct i2c_msg *msgs, u32 msg_count) { @@ -294,7 +302,7 @@ static int gb_i2c_transfer_operation(struct gb_i2c_device *gb_i2c_dev, response = operation->response->payload; gb_i2c_transfer_response(msgs, msg_count, response); ret = msg_count; - } else if (ret != -EAGAIN) { + } else if (!gb_i2c_expected_transfer_error(ret)) { pr_err("transfer operation failed (%d)\n", ret); } gb_operation_destroy(operation);