* [PATCH 2/2] Input: elan_i2c - Return error code when resume fail.
@ 2015-03-07 11:42 Duson Lin
2015-03-08 5:11 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Duson Lin @ 2015-03-07 11:42 UTC (permalink / raw)
To: linux-kernel, linux-input, dmitry.torokhov; +Cc: phoenix, Duson Lin
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] Input: elan_i2c - Return error code when resume fail.
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
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2015-03-08 5:11 UTC (permalink / raw)
To: Duson Lin; +Cc: linux-kernel, linux-input, phoenix
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-08 5:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).