Input: elan_i2c - return error code when resume fails

In order to better diagnose potential issues let's return error to the
upper layers when resuming the device fails and also add a few diagnostic
messages.

Signed-off-by: Duson Lin <dusonlin@emc.com.tw>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
Duson Lin
2015-03-07 20:57:54 -08:00
committed by Dmitry Torokhov
parent ceb5b6c8be
commit b3beed7fe8
2 changed files with 18 additions and 6 deletions

View File

@@ -117,7 +117,15 @@ static int elan_i2c_write_cmd(struct i2c_client *client, u16 reg, u16 cmd)
int ret;
ret = i2c_transfer(client->adapter, &msg, 1);
return ret == 1 ? 0 : (ret < 0 ? ret : -EIO);
if (ret != 1) {
if (ret >= 0)
ret = -EIO;
dev_err(&client->dev, "writing cmd (0x%04x) failed: %d\n",
reg, ret);
return ret;
}
return 0;
}
static int elan_i2c_initialize(struct i2c_client *client)