提交 a04f1440 编写于 作者: K KT Liao 提交者: Dmitry Torokhov

Input: elan_i2c - ignore signals when finishing updating firmware

Use wait_for_completion_timeout() instead of
wait_for_completion_interruptible_timeout() to avoid stray signals ruining
firmware update. Our timeout is only 300 msec so we are fine simply letting
it expire in case device misbehaves.
Signed-off-by: NKT Liao <kt.liao@emc.com.tw>
Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
上级 4b3c7dbb
...@@ -554,7 +554,6 @@ static int elan_i2c_finish_fw_update(struct i2c_client *client, ...@@ -554,7 +554,6 @@ static int elan_i2c_finish_fw_update(struct i2c_client *client,
struct completion *completion) struct completion *completion)
{ {
struct device *dev = &client->dev; struct device *dev = &client->dev;
long ret;
int error; int error;
int len; int len;
u8 buffer[ETP_I2C_REPORT_LEN]; u8 buffer[ETP_I2C_REPORT_LEN];
...@@ -570,23 +569,19 @@ static int elan_i2c_finish_fw_update(struct i2c_client *client, ...@@ -570,23 +569,19 @@ static int elan_i2c_finish_fw_update(struct i2c_client *client,
enable_irq(client->irq); enable_irq(client->irq);
error = elan_i2c_write_cmd(client, ETP_I2C_STAND_CMD, ETP_I2C_RESET); 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) { if (error) {
dev_err(dev, "device reset failed: %d\n", error); dev_err(dev, "device reset failed: %d\n", error);
return error; } else if (!wait_for_completion_timeout(completion,
} else if (ret == 0) { msecs_to_jiffies(300))) {
dev_err(dev, "timeout waiting for device reset\n"); dev_err(dev, "timeout waiting for device reset\n");
return -ETIMEDOUT; error = -ETIMEDOUT;
} else if (ret < 0) {
error = ret;
dev_err(dev, "error waiting for device reset: %d\n", error);
return error;
} }
disable_irq(client->irq);
if (error)
return error;
len = i2c_master_recv(client, buffer, ETP_I2C_INF_LENGTH); len = i2c_master_recv(client, buffer, ETP_I2C_INF_LENGTH);
if (len != ETP_I2C_INF_LENGTH) { if (len != ETP_I2C_INF_LENGTH) {
error = len < 0 ? len : -EIO; error = len < 0 ? len : -EIO;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册