From patchwork Sat Mar 7 11:42:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Duson Lin X-Patchwork-Id: 5959151 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 02A769F373 for ; Sat, 7 Mar 2015 11:43:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1C230202BE for ; Sat, 7 Mar 2015 11:43:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A8E24201C8 for ; Sat, 7 Mar 2015 11:43:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751900AbbCGLnD (ORCPT ); Sat, 7 Mar 2015 06:43:03 -0500 Received: from msr13.hinet.net ([168.95.4.113]:41032 "EHLO msr13.hinet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751773AbbCGLnB (ORCPT ); Sat, 7 Mar 2015 06:43:01 -0500 Received: from localhost.localdomain (42-72-96-126.EMOME-IP.hinet.net [42.72.96.126]) (authenticated bits=0) by msr13.hinet.net (8.14.9/8.14.9) with ESMTP id t27BgsRs013583; Sat, 7 Mar 2015 19:42:55 +0800 (CST) From: Duson Lin To: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, dmitry.torokhov@gmail.com Cc: phoenix@emc.com.tw, Duson Lin Subject: [PATCH 2/2] Input: elan_i2c - Return error code when resume fail. Date: Sat, 7 Mar 2015 19:42:47 +0800 Message-Id: <1425728567-14089-1-git-send-email-dusonlin@emc.com.tw> X-Mailer: git-send-email 1.7.10.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFrMTGxaLlkVCna//kV4jBhVMWFpd3zWGzuPnpG6vF4UUvGC0WNt5k tHjRPpnFgdXj8yY5j52z7rJ7HP/YwBzAHMWamZeUX5HAmjHl7CamgoWCFccnLmNuYOzj62Lk 5BASiJCYefwIC4jNJqAqMeFpLyuILSIQJXFy2WU2EJtZwELi/PK1TCC2sICXRMvHH2A2C1D9 koPdzCA2r4CzxOUlD9lBbAkBRYnuZxPYJjByrGIUyS2u0C3OLTbUNdXLyMxLLdED4k2MQA+t iGfn38F49qThIUYmDs5DjAIcjEo8vEvmfQ4RYk0sK67MBYlzH2KU5GBSEuV1WfQrRIgvKT+l MiOxOCO+qDQntfgQowQHj5IIb/ljoBxvcUFibnFmOkxKhoNDSYKXAyQlWJSanlqRlplTkloE kT7FqCglzpsNkhQA6csozYPLwQL7EqOslDDvxEdANTwFqUW5mSWo8q8YxYEuFuadADKFJzOv BG75K6C7mIDuWiD2A+SukkSEFADVpLDezwEAAA== Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The resume function always return success, so stop event can not be triggered when "suspend_stress_test" running. In order to debug more easily, we add some error messages in elan_enable_power and elan_disable_power funtion. Signed-off-by: Duson Lin --- drivers/input/mouse/elan_i2c_core.c | 10 +++++++--- drivers/input/mouse/elan_i2c_i2c.c | 7 ++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 16f9584..f24078b 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -111,6 +111,7 @@ static int elan_enable_power(struct elan_tp_data *data) msleep(30); } while (--repeat > 0); + dev_err(&data->client->dev, "Failed to enable power\n"); return error; } @@ -138,6 +139,7 @@ static int elan_disable_power(struct elan_tp_data *data) msleep(30); } while (--repeat > 0); + dev_err(&data->client->dev, "Failed to disable power\n"); return error; } @@ -1084,16 +1086,18 @@ static int __maybe_unused elan_resume(struct device *dev) } error = elan_enable_power(data); - if (error) + if (error) { dev_err(dev, "power up when resuming failed: %d\n", error); + goto err; + } error = elan_initialize(data); if (error) dev_err(dev, "initialize when resuming failed: %d\n", error); +err: enable_irq(data->client->irq); - - return 0; + return error; } static SIMPLE_DEV_PM_OPS(elan_pm_ops, elan_suspend, elan_resume); diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c index 029941f..e29b28c 100644 --- a/drivers/input/mouse/elan_i2c_i2c.c +++ b/drivers/input/mouse/elan_i2c_i2c.c @@ -117,7 +117,12 @@ 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) { + dev_err(&client->dev, "writing cmd (0x%04x) fail.\n", reg); + return ret < 0 ? ret : -EIO; + } + + return 0; } static int elan_i2c_initialize(struct i2c_client *client)