Skip to content

Commit

Permalink
Input: cyapa - fix setting suspend scan rate
Browse files Browse the repository at this point in the history
The suspend scan rate value should not exceed 1000, unfortunately when
implementing the limit we used max_t instead of min_t, causing the value to
be at least 1000.

Signed-off-by: Dudley Du <dudl@cypress.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Dudley Du authored and Dmitry Torokhov committed Apr 20, 2015
1 parent 9f42380 commit a333a03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/input/mouse/cyapa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit a333a03

Please sign in to comment.