2016-11-28 17:21:45

by Aniroop Mathur

[permalink] [raw]
Subject: [PATCH] Input: mouse: synaptics - change msleep to usleep_range for small msecs

msleep(1~20) may not do what the caller intends, and will often sleep longer.
(~20 ms actual sleep for any value given in the 1~20ms range)
This is not the desired behaviour for many cases like device resume time,
device suspend time, device enable time, retry logic, etc.
Thus, change msleep to usleep_range for precise wakeups.

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

diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c
index aa7c5da..4d688a6 100644
--- a/drivers/input/mouse/synaptics_i2c.c
+++ b/drivers/input/mouse/synaptics_i2c.c
@@ -29,7 +29,7 @@
* after soft reset, we should wait for 1 ms
* before the device becomes operational
*/
-#define SOFT_RESET_DELAY_MS 3
+#define SOFT_RESET_DELAY_US 3000
/* and after hard reset, we should wait for max 500ms */
#define HARD_RESET_DELAY_MS 500

@@ -311,7 +311,7 @@ static int synaptics_i2c_reset_config(struct i2c_client *client)
if (ret) {
dev_err(&client->dev, "Unable to reset device\n");
} else {
- msleep(SOFT_RESET_DELAY_MS);
+ usleep_range(SOFT_RESET_DELAY_MS, SOFT_RESET_DELAY_MS + 100);
ret = synaptics_i2c_config(client);
if (ret)
dev_err(&client->dev, "Unable to config device\n");
--
2.6.2


2016-11-28 19:36:20

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] Input: mouse: synaptics - change msleep to usleep_range for small msecs

Hi Aniroop,

[auto build test ERROR on input/next]
[also build test ERROR on v4.9-rc7 next-20161128]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Aniroop-Mathur/Input-mouse-synaptics-change-msleep-to-usleep_range-for-small-msecs/20161129-025754
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: x86_64-acpi-redef (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All errors (new ones prefixed by >>):

drivers/input/mouse/synaptics_i2c.c: In function 'synaptics_i2c_reset_config':
>> drivers/input/mouse/synaptics_i2c.c:314:16: error: 'SOFT_RESET_DELAY_MS' undeclared (first use in this function)
usleep_range(SOFT_RESET_DELAY_MS, SOFT_RESET_DELAY_MS + 100);
^~~~~~~~~~~~~~~~~~~
drivers/input/mouse/synaptics_i2c.c:314:16: note: each undeclared identifier is reported only once for each function it appears in

vim +/SOFT_RESET_DELAY_MS +314 drivers/input/mouse/synaptics_i2c.c

308
309 /* Reset the Touchpad */
310 ret = synaptics_i2c_reg_set(client, DEV_COMMAND_REG, RESET_COMMAND);
311 if (ret) {
312 dev_err(&client->dev, "Unable to reset device\n");
313 } else {
> 314 usleep_range(SOFT_RESET_DELAY_MS, SOFT_RESET_DELAY_MS + 100);
315 ret = synaptics_i2c_config(client);
316 if (ret)
317 dev_err(&client->dev, "Unable to config device\n");

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (1.69 kB)
.config.gz (27.74 kB)
Download all attachments