From patchwork Mon Nov 28 11:43:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aniroop Mathur X-Patchwork-Id: 9449385 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 BA3C16071E for ; Mon, 28 Nov 2016 11:44:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA37320564 for ; Mon, 28 Nov 2016 11:44:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D74B2756B; Mon, 28 Nov 2016 11:44:04 +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=-5.9 required=2.0 tests=BAYES_00, FROM_EXCESS_BASE64, RCVD_IN_DNSWL_HI,T_TVD_MIME_EPI 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 6404720564 for ; Mon, 28 Nov 2016 11:44:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754309AbcK1LoB (ORCPT ); Mon, 28 Nov 2016 06:44:01 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:52708 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753751AbcK1Ln7 (ORCPT ); Mon, 28 Nov 2016 06:43:59 -0500 Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OHC00XUAOL99ME0@mailout3.samsung.com> for linux-input@vger.kernel.org; Mon, 28 Nov 2016 20:43:57 +0900 (KST) Received: from epsmges5p3.samsung.com (unknown [182.195.42.46]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20161128114357epcas5p18d44c4bec58e4770363a3bdc9183a9ba~LM2r4m3CX2114021140epcas5p1U; Mon, 28 Nov 2016 11:43:57 +0000 (GMT) X-AuditID: b6c32a2e-f79f16d000001282-67-583c187c1e43 Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p3.samsung.com (EPCPMTA) with SMTP id 83.3A.04738.C781C385; Mon, 28 Nov 2016 20:43:57 +0900 (KST) MIME-version: 1.0 Subject: =?UTF-8?B?W1BBVENIXSBJbnB1dDogam95c3RpY2s6IGFkaSAtIGNoYW5n?= =?UTF-8?B?ZSBtc2xlZXAgdG8gdXNsZWVwX3JhbmdlIGZvciBzbWFsbCBt?= =?UTF-8?B?c2Vjcw==?= Reply-to: a.mathur@samsung.com From: =?UTF-8?B?QW5pcm9vcCBNYXRodXI=?= To: =?UTF-8?B?ZG1pdHJ5LnRvcm9raG92QGdtYWlsLmNvbQ==?= , =?UTF-8?B?dm9qdGVjaEB1Y3cuY3o=?= , =?UTF-8?B?bGludXgtaW5wdXRAdmdlci5rZXJuZWwub3Jn?= , =?UTF-8?B?bGludXgta2VybmVsQHZnZXIua2VybmVsLm9yZw==?= Cc: =?UTF-8?B?U0FNVUVMIFNFUVVFSVJB?= , =?UTF-8?B?UmFodWwgTWFoYWxl?= , =?UTF-8?B?YW5pcm9vcC5tYXRodXJAZ21haWwuY29t?= X-Priority: 3 X-Content-Kind-Code: NORMAL X-Drm-Type: N,general X-EPLocale: en_US.EUC-KR X-EPWebmail-Msg-Type: personal X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Illegal-Object: Syntax error in X-Sender: address found on vger.kernel.org: X-Sender: =?utf-8?B?7IK87ISx7KCE7J6QG1NSSS1Ob2lkYS1BZHZhbmM=?= ^-Extraneous program text X-Sender-IP: 107.108.251.92 X-Local-Sender: =?UTF-8?B?QW5pcm9vcCBNYXRodXIbU1JJLU5vaWRhLUFkdmFuY2UgU29sdXRpb25z?= =?UTF-8?B?IC0gU3lzdGVtIDEgUiZEIEdyb3VwG+yCvOyEseyghOyekBtM?= =?UTF-8?B?ZWFkIEVuZ2luZWVyL0NvcnBvcmF0ZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?QW5pcm9vcCBNYXRodXIbU1JJLU5vaWRhLUFkdmFuY2UgU29sdXRpb25z?= =?UTF-8?B?IC0gU3lzdGVtIDEgUiZEIEdyb3VwG1NhbXN1bmfCoEVsZWN0?= =?UTF-8?B?cm9uaWNzG0xlYWQgRW5naW5lZXIvQ29ycG9yYXRlIEVuZ2lu?= =?UTF-8?B?ZWVy?= X-Sender-Code: =?UTF-8?B?QzEwGxtDMTBJWjAxSVowMTgxMjU=?= Message-id: <20161128114356epcms5p836ef0c36a1cbb8b68638ed046afbb777@epcms5p8> Date: Mon, 28 Nov 2016 11:43:56 +0000 X-CMS-MailID: 20161128114356epcms5p836ef0c36a1cbb8b68638ed046afbb777 Content-type: multipart/related; boundary="----=_Part_74419_1914926335.1480333436729" X-MTR: 20161128114356epcms5p836ef0c36a1cbb8b68638ed046afbb777 X-EPHeader: Mail X-ConfirmMail: N,general CMS-TYPE: 105P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrIKsWRmVeSWpSXmKPExsWy7bCmpm6thE2EwZQii5+7Z7BYHF70gtHi 5qdvrBaXd81hszj1roHJYvPeqywWfYsPMjmwe+ycdZfdo2/LKkaPFau/s3t83iQXwBLFZZOS mpNZllqkb5fAlXFg8mmmgieiFdf+PWFrYJws2sXIySEhYCJx5/YZJghbTOLCvfVsILaQwFJG ifOfxLsYOTh4BQQl/u4Q7mLk4hAWmM0o0dffDVUjJ9G2ficLiC0sYC/x/m4LmM0mYCux+PdB RpAGEYFNTBJNN/6zgjjMAnsZJSbMmM8GsY1XYkb7UxYIW1pi+/KtjBC2qMTN1W/ZIWwJidUL n0PVy0lM+7qGGabm/bH5UPUiEq33zkLFBSUe/NwNtllCYAejxJevIM0cYAumPLeBiJ9jlLj4 6Q7Uy88YJVbMd4GoMZfY8L8MJMwr4CvxqPEx2EwWAVWJdafvQM13kdh4+ABYK7NAuMSuCUeh 7rSVaH/2CcoWkFhzYg4zzP1bW56wQtTzSfT+fgK1Vkli04YJrBMYVWYhAngWkqkQtqLElO6H 7CAlzAKaEut36S9gZFnFKJZaUJybnlpsWmCsV5yYW1yal66XnJ+7iRGccLT0djD+W+B9iFGA g1GJh/eFhXWEEGtiWXFl7iFGCQ5mJRFedXGbCCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8CyqA qgXSE0tSs1NTC1KLYLJMHJxSDYxTZedf2bYrh3He6xMXWJ6c9Fd8y5zRc+lfVfwSVqYO972d 0lvyl/zRMH3Xd0b4tOc7VfW3x+8ylO1+UFlUWeYS4mVWqNunlLjD/uJjkT4FgYj3ge6GwtYG zlaTP1d13Z63eE7Mrkd5QcYbLtpfi4oskJo5a39azZX/hwsepndppZ23CJpy3FKJpTgj0VCL uag4EQCgHj/cNAMAAA== X-Auth-Email: a.mathur@samsung.com X-HopCount: 6 X-CMS-RootMailID: 20161128114356epcms5p836ef0c36a1cbb8b68638ed046afbb777 X-RootMTR: 20161128114356epcms5p836ef0c36a1cbb8b68638ed046afbb777 References: 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, data reading time, etc. Thus, change msleep to usleep_range for precise wakeups. Signed-off-by: Aniroop Mathur --- joystick/adi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.6.4.windows.1 diff --git a/joystick/adi.c b/joystick/adi.c index d09cefa..6799bd9 100644 --- a/joystick/adi.c +++ b/joystick/adi.c @@ -47,8 +47,8 @@ MODULE_LICENSE("GPL"); #define ADI_MAX_START 200 /* Trigger to packet timeout [200us] */ #define ADI_MAX_STROBE 40 /* Single bit timeout [40us] */ -#define ADI_INIT_DELAY 10 /* Delay after init packet [10ms] */ -#define ADI_DATA_DELAY 4 /* Delay after data packet [4ms] */ +#define ADI_INIT_DELAY 10000 /* Delay after init packet [10ms] */ +#define ADI_DATA_DELAY 4000 /* Delay after data packet [4000us] */ #define ADI_MAX_LENGTH 256 #define ADI_MIN_LENGTH 8 @@ -319,7 +319,7 @@ static void adi_init_digital(struct gameport *gameport) for (i = 0; seq[i]; i++) { gameport_trigger(gameport); if (seq[i] > 0) - msleep(seq[i]); + usleep_range(seq[i] * 1000, (seq[i] * 1000) + 100); if (seq[i] < 0) { mdelay(-seq[i]); udelay(-seq[i]*14); /* It looks like mdelay() is off by approx 1.4% */ @@ -512,9 +512,9 @@ static int adi_connect(struct gameport *gameport, struct gameport_driver *drv) gameport_set_poll_handler(gameport, adi_poll); gameport_set_poll_interval(gameport, 20); - msleep(ADI_INIT_DELAY); + usleep_range(ADI_INIT_DELAY, ADI_INIT_DELAY + 100); if (adi_read(port)) { - msleep(ADI_DATA_DELAY); + usleep_range(ADI_DATA_DELAY, ADI_DATA_DELAY + 100); adi_read(port); }