2015-04-20 05:54:06

by Dudley Du

[permalink] [raw]
Subject: [PATCH] input: cyapa: fix update suspend scanrate set to max 1000 issue

Fix update suspend scareate always set to max 1000 issue, the root cause is
the missed using max_t as min_t.
TEST=test on Chromebook.

Signed-off-by: Dudley Du <[email protected]>
---
drivers/input/mouse/cyapa.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
index 58f4f6f..efe1484 100644
--- a/drivers/input/mouse/cyapa.c
+++ b/drivers/input/mouse/cyapa.c
@@ -723,7 +723,7 @@ static ssize_t cyapa_update_suspend_scanrate(struct device *dev,
} else if (sysfs_streq(buf, OFF_MODE_NAME)) {
cyapa->suspend_power_mode = PWR_MODE_OFF;
} else if (!kstrtou16(buf, 10, &sleep_time)) {
- cyapa->suspend_sleep_time = max_t(u16, sleep_time, 1000);
+ cyapa->suspend_sleep_time = min_t(u16, sleep_time, 1000);
cyapa->suspend_power_mode =
cyapa_sleep_time_to_pwr_cmd(cyapa->suspend_sleep_time);
} else {
@@ -840,7 +840,7 @@ static ssize_t cyapa_update_rt_suspend_scanrate(struct device *dev,
if (error)
return error;

- cyapa->runtime_suspend_sleep_time = max_t(u16, time, 1000);
+ cyapa->runtime_suspend_sleep_time = min_t(u16, time, 1000);
cyapa->runtime_suspend_power_mode =
cyapa_sleep_time_to_pwr_cmd(cyapa->runtime_suspend_sleep_time);

--
1.9.1


2015-04-20 17:00:45

by Benson Leung

[permalink] [raw]
Subject: Re: [PATCH] input: cyapa: fix update suspend scanrate set to max 1000 issue

Hi Dudley.

Just a minor commit message nit. Thanks!

On Sun, Apr 19, 2015 at 10:43 PM, Dudley Du <[email protected]> wrote:
> Fix update suspend scareate always set to max 1000 issue, the root cause is
s/scareate/scanrate
> the missed using max_t as min_t.
> TEST=test on Chromebook.
>
> Signed-off-by: Dudley Du <[email protected]>

Reviewed-by: Benson Leung <[email protected]>

> ---
> drivers/input/mouse/cyapa.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
> index 58f4f6f..efe1484 100644
> --- a/drivers/input/mouse/cyapa.c
> +++ b/drivers/input/mouse/cyapa.c
> @@ -723,7 +723,7 @@ static ssize_t cyapa_update_suspend_scanrate(struct device *dev,
> } else if (sysfs_streq(buf, OFF_MODE_NAME)) {
> cyapa->suspend_power_mode = PWR_MODE_OFF;
> } else if (!kstrtou16(buf, 10, &sleep_time)) {
> - cyapa->suspend_sleep_time = max_t(u16, sleep_time, 1000);
> + cyapa->suspend_sleep_time = min_t(u16, sleep_time, 1000);
> cyapa->suspend_power_mode =
> cyapa_sleep_time_to_pwr_cmd(cyapa->suspend_sleep_time);
> } else {
> @@ -840,7 +840,7 @@ static ssize_t cyapa_update_rt_suspend_scanrate(struct device *dev,
> if (error)
> return error;
>
> - cyapa->runtime_suspend_sleep_time = max_t(u16, time, 1000);
> + cyapa->runtime_suspend_sleep_time = min_t(u16, time, 1000);
> cyapa->runtime_suspend_power_mode =
> cyapa_sleep_time_to_pwr_cmd(cyapa->runtime_suspend_sleep_time);
>
> --
> 1.9.1
>



--
Benson Leung
Software Engineer, Chrome OS
Google Inc.
[email protected]

2015-04-20 17:04:23

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH] input: cyapa: fix update suspend scanrate set to max 1000 issue

On Mon, Apr 20, 2015 at 10:00:42AM -0700, Benson Leung wrote:
> Hi Dudley.
>
> Just a minor commit message nit. Thanks!
>
> On Sun, Apr 19, 2015 at 10:43 PM, Dudley Du <[email protected]> wrote:
> > Fix update suspend scareate always set to max 1000 issue, the root cause is
> s/scareate/scanrate
> > the missed using max_t as min_t.
> > TEST=test on Chromebook.
> >
> > Signed-off-by: Dudley Du <[email protected]>
>
> Reviewed-by: Benson Leung <[email protected]>

Applied, thank you.

>
> > ---
> > drivers/input/mouse/cyapa.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
> > index 58f4f6f..efe1484 100644
> > --- a/drivers/input/mouse/cyapa.c
> > +++ b/drivers/input/mouse/cyapa.c
> > @@ -723,7 +723,7 @@ static ssize_t cyapa_update_suspend_scanrate(struct device *dev,
> > } else if (sysfs_streq(buf, OFF_MODE_NAME)) {
> > cyapa->suspend_power_mode = PWR_MODE_OFF;
> > } else if (!kstrtou16(buf, 10, &sleep_time)) {
> > - cyapa->suspend_sleep_time = max_t(u16, sleep_time, 1000);
> > + cyapa->suspend_sleep_time = min_t(u16, sleep_time, 1000);
> > cyapa->suspend_power_mode =
> > cyapa_sleep_time_to_pwr_cmd(cyapa->suspend_sleep_time);
> > } else {
> > @@ -840,7 +840,7 @@ static ssize_t cyapa_update_rt_suspend_scanrate(struct device *dev,
> > if (error)
> > return error;
> >
> > - cyapa->runtime_suspend_sleep_time = max_t(u16, time, 1000);
> > + cyapa->runtime_suspend_sleep_time = min_t(u16, time, 1000);
> > cyapa->runtime_suspend_power_mode =
> > cyapa_sleep_time_to_pwr_cmd(cyapa->runtime_suspend_sleep_time);
> >
> > --
> > 1.9.1
> >
>
>
>
> --
> Benson Leung
> Software Engineer, Chrome OS
> Google Inc.
> [email protected]

--
Dmitry