From patchwork Wed May 24 08:53:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5buW5bSH5qau?= X-Patchwork-Id: 9745499 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3CAC760209 for ; Wed, 24 May 2017 08:53:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D895288FA for ; Wed, 24 May 2017 08:53:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F1CB2892A; Wed, 24 May 2017 08:53:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12C50288FA for ; Wed, 24 May 2017 08:53:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935735AbdEXIxC (ORCPT ); Wed, 24 May 2017 04:53:02 -0400 Received: from emcscan.emc.com.tw ([192.72.220.5]:1885 "EHLO emcscan.emc.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933013AbdEXIxB (ORCPT ); Wed, 24 May 2017 04:53:01 -0400 Received: from unknown (HELO elanic) ([192.168.10.6]) by emcscan.emc.com.tw with ESMTP; 24 May 2017 16:53:51 +0800 Received: from elanic (elanic.emc.com.tw [127.0.0.1]) by elanic (Postfix) with ESMTP id AD71E3CA949; Wed, 24 May 2017 16:47:51 +0800 (CST) Received: from nb92073 (unknown [192.168.33.46]) by elanic (Postfix) with ESMTP id 93ED03C9A1C; Wed, 24 May 2017 16:47:51 +0800 (CST) From: =?big5?B?ufmxUrph?= To: "'Dmitry Torokhov'" Cc: , , References: <1495549922-4589-1-git-send-email-kt.liao@emc.com.tw> <20170523211354.GA34299@dtor-ws> In-Reply-To: <20170523211354.GA34299@dtor-ws> Subject: RE: [PATCH] Input: elan_i2c - Prevent breaking of FW updating from unexpected signal Date: Wed, 24 May 2017 16:53:50 +0800 Message-ID: <00ec01d2d46b$43b8cf20$cb2a6d60$@emc.com.tw> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHLAsPPNsRjFPCRijNPHaLE21JoRQJkTzUUof+rV4A= Content-Language: zh-tw Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Dmitry -----Original Message----- From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com] Sent: Wednesday, May 24, 2017 5:14 AM To: KT Liao Cc: linux-kernel@vger.kernel.org; linux-input@vger.kernel.org; phoenix@emc.com.tw Subject: Re: [PATCH] Input: elan_i2c - Prevent breaking of FW updating from unexpected signal Hi KT, On Tue, May 23, 2017 at 10:32:02PM +0800, KT Liao wrote: > Use wait_for_completion_timeout to prevent breaking of FW updating from unexpected signal > > Signed-off-by: KT Liao > --- > drivers/input/mouse/elan_i2c_i2c.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c > index 3be75c6e..34356c7 100644 > --- a/drivers/input/mouse/elan_i2c_i2c.c > +++ b/drivers/input/mouse/elan_i2c_i2c.c > @@ -619,7 +619,7 @@ static int elan_i2c_finish_fw_update(struct i2c_client *client, > > error = elan_i2c_write_cmd(client, ETP_I2C_STAND_CMD, ETP_I2C_RESET); > if (!error) > - ret = wait_for_completion_interruptible_timeout(completion, > + ret = wait_for_completion_timeout(completion, > msecs_to_jiffies(300)); > disable_irq(client->irq); > > -- > 2.7.4 > wait_for_completion_timeout(), unlike wait_for_completion_interruptible_timeout() returns unsigned long, so the code below checking if 'ret' is negative, is no longer needed. How about the version of the patch below? [KT] : Thanks, it's ok. We have tested it on some Chrome system. diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c index 3be75c6e8090..278832047075 100644 --- a/drivers/input/mouse/elan_i2c_i2c.c +++ b/drivers/input/mouse/elan_i2c_i2c.c @@ -609,7 +609,6 @@ 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;