From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Duson Lin <dusonlin@emc.com.tw>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
phoenix@emc.com.tw
Subject: Re: [PATCH 2/2] Input: elan_i2c - Return error code when resume fail.
Date: Sat, 7 Mar 2015 21:11:42 -0800 [thread overview]
Message-ID: <20150308051142.GC4054@dtor-ws> (raw)
In-Reply-To: <1425728567-14089-1-git-send-email-dusonlin@emc.com.tw>
On Sat, Mar 07, 2015 at 07:42:47PM +0800, Duson Lin wrote:
> 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 <dusonlin@emc.com.tw>
Applied, thank you.
> ---
> 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)
> --
> 1.7.10.4
>
--
Dmitry
prev parent reply other threads:[~2015-03-08 5:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-07 11:42 [PATCH 2/2] Input: elan_i2c - Return error code when resume fail Duson Lin
2015-03-08 5:11 ` Dmitry Torokhov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150308051142.GC4054@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=dusonlin@emc.com.tw \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=phoenix@emc.com.tw \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox