aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/elan_i2c_i2c.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-05-29 19:54:21 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-05-29 19:54:21 -0700
commitd8f797c60661a90ee26ca9330cf85ede9aa2ec17 (patch)
tree5038609885fc3e4cb7f329d974875ac4411c6af5 /drivers/input/mouse/elan_i2c_i2c.c
parentInput: tsc2007 - move header file out of I2C realm (diff)
parentLinux 4.12-rc3 (diff)
downloadlinux-dev-d8f797c60661a90ee26ca9330cf85ede9aa2ec17.tar.xz
linux-dev-d8f797c60661a90ee26ca9330cf85ede9aa2ec17.zip
Merge tag 'v4.12-rc3' into next
Sync with mainline to bring in changes in platform drovers dropping calls to sparse_keymap_free() so that we can remove it for good.
Diffstat (limited to 'drivers/input/mouse/elan_i2c_i2c.c')
-rw-r--r--drivers/input/mouse/elan_i2c_i2c.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c
index 3be75c6e8090..80172f25974d 100644
--- a/drivers/input/mouse/elan_i2c_i2c.c
+++ b/drivers/input/mouse/elan_i2c_i2c.c
@@ -609,32 +609,34 @@ static int elan_i2c_finish_fw_update(struct i2c_client *client,
struct completion *completion)
{
struct device *dev = &client->dev;
- long ret;
int error;
int len;
- u8 buffer[ETP_I2C_INF_LENGTH];
+ u8 buffer[ETP_I2C_REPORT_LEN];
+
+ len = i2c_master_recv(client, buffer, ETP_I2C_REPORT_LEN);
+ if (len != ETP_I2C_REPORT_LEN) {
+ error = len < 0 ? len : -EIO;
+ dev_warn(dev, "failed to read I2C data after FW WDT reset: %d (%d)\n",
+ error, len);
+ }
reinit_completion(completion);
enable_irq(client->irq);
error = elan_i2c_write_cmd(client, ETP_I2C_STAND_CMD, ETP_I2C_RESET);
- if (!error)
- ret = wait_for_completion_interruptible_timeout(completion,
- msecs_to_jiffies(300));
- disable_irq(client->irq);
-
if (error) {
dev_err(dev, "device reset failed: %d\n", error);
- return error;
- } else if (ret == 0) {
+ } else if (!wait_for_completion_timeout(completion,
+ msecs_to_jiffies(300))) {
dev_err(dev, "timeout waiting for device reset\n");
- return -ETIMEDOUT;
- } else if (ret < 0) {
- error = ret;
- dev_err(dev, "error waiting for device reset: %d\n", error);
- return error;
+ error = -ETIMEDOUT;
}
+ disable_irq(client->irq);
+
+ if (error)
+ return error;
+
len = i2c_master_recv(client, buffer, ETP_I2C_INF_LENGTH);
if (len != ETP_I2C_INF_LENGTH) {
error = len < 0 ? len : -EIO;