diff options
author | KT Liao <kt.liao@emc.com.tw> | 2017-05-23 16:41:47 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-05-25 13:11:45 -0400 |
commit | a04f144059ac09f2c3da50b5707df589044aad66 (patch) | |
tree | 69263772d3c8ea4c7d2fb0608975f4f68265d2d1 | |
parent | 4b3c7dbbfff0673e8a89575414b864d8b001d3bb (diff) |
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: KT Liao <kt.liao@emc.com.tw>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/mouse/elan_i2c_i2c.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c index 765879dcaf85..f431da07f861 100644 --- a/drivers/input/mouse/elan_i2c_i2c.c +++ b/drivers/input/mouse/elan_i2c_i2c.c | |||
@@ -554,7 +554,6 @@ static int elan_i2c_finish_fw_update(struct i2c_client *client, | |||
554 | struct completion *completion) | 554 | struct completion *completion) |
555 | { | 555 | { |
556 | struct device *dev = &client->dev; | 556 | struct device *dev = &client->dev; |
557 | long ret; | ||
558 | int error; | 557 | int error; |
559 | int len; | 558 | int len; |
560 | u8 buffer[ETP_I2C_REPORT_LEN]; | 559 | u8 buffer[ETP_I2C_REPORT_LEN]; |
@@ -570,23 +569,19 @@ static int elan_i2c_finish_fw_update(struct i2c_client *client, | |||
570 | enable_irq(client->irq); | 569 | enable_irq(client->irq); |
571 | 570 | ||
572 | error = elan_i2c_write_cmd(client, ETP_I2C_STAND_CMD, ETP_I2C_RESET); | 571 | error = elan_i2c_write_cmd(client, ETP_I2C_STAND_CMD, ETP_I2C_RESET); |
573 | if (!error) | ||
574 | ret = wait_for_completion_interruptible_timeout(completion, | ||
575 | msecs_to_jiffies(300)); | ||
576 | disable_irq(client->irq); | ||
577 | |||
578 | if (error) { | 572 | if (error) { |
579 | dev_err(dev, "device reset failed: %d\n", error); | 573 | dev_err(dev, "device reset failed: %d\n", error); |
580 | return error; | 574 | } else if (!wait_for_completion_timeout(completion, |
581 | } else if (ret == 0) { | 575 | msecs_to_jiffies(300))) { |
582 | dev_err(dev, "timeout waiting for device reset\n"); | 576 | dev_err(dev, "timeout waiting for device reset\n"); |
583 | return -ETIMEDOUT; | 577 | error = -ETIMEDOUT; |
584 | } else if (ret < 0) { | ||
585 | error = ret; | ||
586 | dev_err(dev, "error waiting for device reset: %d\n", error); | ||
587 | return error; | ||
588 | } | 578 | } |
589 | 579 | ||
580 | disable_irq(client->irq); | ||
581 | |||
582 | if (error) | ||
583 | return error; | ||
584 | |||
590 | len = i2c_master_recv(client, buffer, ETP_I2C_INF_LENGTH); | 585 | len = i2c_master_recv(client, buffer, ETP_I2C_INF_LENGTH); |
591 | if (len != ETP_I2C_INF_LENGTH) { | 586 | if (len != ETP_I2C_INF_LENGTH) { |
592 | error = len < 0 ? len : -EIO; | 587 | error = len < 0 ? len : -EIO; |