From patchwork Thu Nov 24 16:03:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aniroop Mathur X-Patchwork-Id: 9445943 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 4CC5B6071C for ; Thu, 24 Nov 2016 15:53:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BC2627FAE for ; Thu, 24 Nov 2016 15:53:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D5132808F; Thu, 24 Nov 2016 15:53:59 +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 68D5C27FAE for ; Thu, 24 Nov 2016 15:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965913AbcKXPx4 (ORCPT ); Thu, 24 Nov 2016 10:53:56 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:33457 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965932AbcKXPxy (ORCPT ); Thu, 24 Nov 2016 10:53:54 -0500 Received: by mail-pg0-f68.google.com with SMTP id 3so3610764pgd.0; Thu, 24 Nov 2016 07:53:37 -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=5h6kD7pdmLUgYZWQ6fnd93zCL1g+sIOCVl+AJZjp6yA=; b=hmCB31EP3sohrpGi8qMjz+QZaR5c2jMFlskDeGe4iw2/9IEwbDPkNtKhsmZVs+74+V MxOPEx/uqKvQfIgiJ1i2LP+KNVIOWeufOFUFQB6M/g8pCBdCx1bjkeiYjPDIHsx3AjNw 40WuqE/0hhANk7zGFlPeIBqTOGd2uFGZAdPlI9Bq20EuwdZRLdvJkxW8LAmNB1wroypV wtG7TeA4eOIPR5V9Tszt3OcIuRcegjxeI3J1tTWHPpm2dH19LovHyx61Kk7CqIKMkg2Q e7Oqf+SNHeWByYHta6RfePQMQXUcRn1j98nsSJxAE4tUOdnDHYbU1XrVdGSzTQNaa+Zg VX2w== 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=5h6kD7pdmLUgYZWQ6fnd93zCL1g+sIOCVl+AJZjp6yA=; b=JfQ7t933JeN7Jypec1MMtwViztGrBscJglQDAC9Micp74wUd7neItKdaJSnJzVvdgv 7CnHoqLh99Vir/uvpTfCBq5PpwyVkSWrndBvPGED/WgEGXetVksv13ryUZISHxYeD+N6 F+bceIm+BKwa39tS4R4bGECmG3ms0eDDMkn8Xv1sdj22FDXUvvSrpAucUMMh/mQ60eCj BEgCHlyrQQeFbK09yiNwQeyGp9i58G0XuDWewsMGKqmJJzz9kJSkqH3vFaiesGlZi/Mv KONnf13/v7GaXER+vmXGdgoLot+a8nlY0dXa8PM/IWlvlEdKPuzWxkiy+9VgbwPD9tbT Ecfg== X-Gm-Message-State: AKaTC01//KPLFmNX4oTHorcY0oTlL5OvV0K75l3Y1S5wiHMJ5bwRyheS+gHOTaTte7BOuQ== X-Received: by 10.98.72.129 with SMTP id q1mr2984423pfi.169.1480002817008; Thu, 24 Nov 2016 07:53:37 -0800 (PST) Received: from Aniroops-MacBook-Pro.local.name ([110.172.168.196]) by smtp.gmail.com with ESMTPSA id 189sm43495139pgh.5.2016.11.24.07.53.33 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 24 Nov 2016 07:53:36 -0800 (PST) From: Aniroop Mathur To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: aniroop.mathur@gmail.com, s.samuel@samsung.com, r.mahale@samsung.com, Aniroop Mathur Subject: [PATCH] Input: Change msleep to usleep_range for small msecs Date: Thu, 24 Nov 2016 21:33:03 +0530 Message-Id: <1480003383-1716-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, etc. Thus, change msleep to usleep_range for precise wakeups. Signed-off-by: Aniroop Mathur --- drivers/input/misc/bma150.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c index 2124390..1fa8537 100644 --- a/drivers/input/misc/bma150.c +++ b/drivers/input/misc/bma150.c @@ -207,7 +207,7 @@ static int bma150_set_mode(struct bma150_data *bma150, u8 mode) return error; if (mode == BMA150_MODE_NORMAL) - msleep(2); + usleep_range(2000, 2100); bma150->mode = mode; return 0; @@ -222,7 +222,7 @@ static int bma150_soft_reset(struct bma150_data *bma150) if (error) return error; - msleep(2); + usleep_range(2000, 2100); return 0; }