From patchwork Mon Nov 28 17:30:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aniroop Mathur X-Patchwork-Id: 9449787 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A049A60756 for ; Mon, 28 Nov 2016 17:21:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 907FB27F8C for ; Mon, 28 Nov 2016 17:21:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8531B27F8D; Mon, 28 Nov 2016 17:21:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A17627F8C for ; Mon, 28 Nov 2016 17:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933302AbcK1RVe (ORCPT ); Mon, 28 Nov 2016 12:21:34 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34447 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754710AbcK1RVb (ORCPT ); Mon, 28 Nov 2016 12:21:31 -0500 Received: by mail-pg0-f68.google.com with SMTP id e9so13626656pgc.1; Mon, 28 Nov 2016 09:21:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=r6jOqShq6WJgRGXVaAdatQ9SUyLhjVdvsbo73VT08dw=; b=JlYFrZhjnIDJX9/lbWeMdDwYKWPS9dKm90NTTGNhD5hbgXRLlkM4s2W3VzijqAd0ye PHdLU86/8F/6a6EpENgHJZ1x86sovvW/pNM5GNlhoMXJorxa+P/WTY2SEB3HBgA+uslH cRRZ8H8V3xWYyqRyR3DeOyPMGWWIJolgSxh+kwErad3pNyHN+GGt71vZmjXVrkG1i6mO K0ssA+TeHyuO/EivcHqhLcLkWqLobcPykwhR+6Gv6OQFMiI4Q3EdcpYN7lgUWoxYAngy /H/eZuaF+jqJ9GrcU2mu8z0ZMZO6ZUaXOM4dCBsykFFxPYt3DvVV6roNz8jPrBC9jinz BZoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=r6jOqShq6WJgRGXVaAdatQ9SUyLhjVdvsbo73VT08dw=; b=SXGD9Hb0XEN52cI4namGNSaA83u5HnSmycvWnudMBE1ssRVI+T+QPA3A1v4KPQgIWT KJIixzE2wDNOHUe4557wkMk+JtR588BCK9ln0b3nxmgxxhiBHutFDBIOujwUxfwcvBF7 QnHPSw52bBOWmJm45fW++40IBqR1JxSaQwLbGb0E5diTZHVul/eqgmlLAiDMGMFhO3Ly qAtqYmqO1ZhAdLmLqsZIlqAxl60TDf0HGBju2OEJUnSMpEh/P+5NX+nx8DiwgaEKBmHe /wNbnD4scBLe14+cFs+8zrFc8LM6kQ/5eNzIk4ti4GMgxYAvroL0itIDHkhKKGpuIru9 RcVw== X-Gm-Message-State: AKaTC019mJtLg7m64cu8sp27+vwDQHZD52B1oO7A/r9IWN2X8rFxcylM0YM6xbOaOlynlQ== X-Received: by 10.84.213.144 with SMTP id g16mr51926888pli.134.1480353685237; Mon, 28 Nov 2016 09:21:25 -0800 (PST) Received: from Aniroops-MacBook-Pro.local.name ([110.172.168.122]) by smtp.gmail.com with ESMTPSA id t20sm88700092pfk.48.2016.11.28.09.21.21 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 28 Nov 2016 09:21:24 -0800 (PST) From: Aniroop Mathur To: mike@compulab.co.il, grinberg@compulab.co.il, dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: s.samuel@samsung.com, r.mahale@samsung.com, aniroop.mathur@gmail.com, Aniroop Mathur Subject: [PATCH] Input: mouse: synaptics - change msleep to usleep_range for small msecs Date: Mon, 28 Nov 2016 23:00:55 +0530 Message-Id: <1480354255-2029-1-git-send-email-a.mathur@samsung.com> X-Mailer: git-send-email 2.6.2 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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");