diff mbox

Input: mouse: synaptics - change msleep to usleep_range for small msecs

Message ID 1480354255-2029-1-git-send-email-a.mathur@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Aniroop Mathur Nov. 28, 2016, 5:30 p.m. UTC
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 <a.mathur@samsung.com>
---
 drivers/input/mouse/synaptics_i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

kernel test robot Nov. 28, 2016, 7:35 p.m. UTC | #1
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
diff mbox

Patch

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");