Skip to contentSkip to conversation

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

PATCH New Aniroop Mathur 2 participants 2 messages Nov 28, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/input/mouse/synaptics_i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/mouse/synaptics_i2c.c +2 -2
index aa7c5da..4d688a6 100644
@@ -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");
Signature · 1 line
2.6.2
#1 lore raw
reproduce:

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