From patchwork Tue Jan 26 19:20:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 573441 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-oi0-x237.google.com (mail-oi0-x237.google.com [IPv6:2607:f8b0:4003:c06::237]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6F52C140BAB for ; Wed, 27 Jan 2016 06:20:47 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b=RLM7cP88; dkim-atps=neutral Received: by mail-oi0-x237.google.com with SMTP id j3sf40181289oig.1 for ; Tue, 26 Jan 2016 11:20:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :reply-to:content-type:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe; bh=gLCcSmAnJO16bayqilFQtHVVa9G3DJs3PK1PFsp3zAM=; b=RLM7cP88sLpIWpD8U6s73CH16Mk+7u2qfJflWG7fbjKvnY305L2nbCupU/kfYACuMU m9qd5DB2yPT7uMzZxYS4Zo35x1rJFfF5jad81rxAQ/KQlX25/G12yQ9xXcNMCA2X1TAE 3XFjcZCYRfesEdq+LcEP4Jp9tRsQn77J64tRtliUmV8E0X3UBxKPt4UNXWoo19QZSN5+ lDrmqI+McNaSsC44wf2Ej6KDqIxONOAEck00igQ9k8CWnTu88/LLqvHMC7X/SZCC9hwl RV9TwPt40xosXEDd1vdZRWq3SaasGaKUNK/zy56JfwJzZZlXUj1o26k4OUXC5JaRZ78z VdHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id :in-reply-to:references:x-original-sender :x-original-authentication-results:reply-to:content-type:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:sender:list-subscribe:list-unsubscribe; bh=gLCcSmAnJO16bayqilFQtHVVa9G3DJs3PK1PFsp3zAM=; b=lj+okAn2tCkpqy7ViEKJSPrjDB3U23dbuYs6K+y5l9OeDdBwRJAvDAqcWcvFY75YTx LGvHGkPj7qOBK3zACAYODC16VwDBJjhbnV5OhVSR2sMA12yYDH0XXj+DyJR6QBOvO6ys /DbBV4xmeSSvfFRiUvcvDr8ykru4KrEHUYp1y/rkVev31IGQ6g0K9Ur4lmLNo9fWy3t3 25q/apIIP6XHQp2q0f9pSyR4mcNh5yQCEQzL8W0IdlWMyXwi4ENE3zz9OCDHOyJRrmlP mpzFjRx220ESITvMDoXAdgV8J3gE5ExmiHNoICmRhZOURCzdQ0k2UnweuEUpnJOp2eUo LAww== X-Gm-Message-State: AG10YOS3t+3puDX4gLyCBQ6oqdYOQAO2MTIEED22GQ7lHzrkC6x/cpbfQCADrbnVZ6rD4A== X-Received: by 10.50.44.18 with SMTP id a18mr142527igm.4.1453836046000; Tue, 26 Jan 2016 11:20:46 -0800 (PST) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.107.129.163 with SMTP id l35ls336145ioi.95.gmail; Tue, 26 Jan 2016 11:20:45 -0800 (PST) X-Received: by 10.66.121.132 with SMTP id lk4mr23192524pab.7.1453836045752; Tue, 26 Jan 2016 11:20:45 -0800 (PST) Received: from lists.s-osg.org (lists.s-osg.org. [54.187.51.154]) by gmr-mx.google.com with ESMTP id jg4si277243pac.2.2016.01.26.11.20.45 for ; Tue, 26 Jan 2016 11:20:45 -0800 (PST) Received-SPF: neutral (google.com: 54.187.51.154 is neither permitted nor denied by best guess record for domain of javier@osg.samsung.com) client-ip=54.187.51.154; Received: from sauron.sisa.samsung.com (unknown [162.246.216.28]) by lists.s-osg.org (Postfix) with ESMTPSA id 75B2646321; Tue, 26 Jan 2016 11:20:42 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Kukjin Kim , rtc-linux@googlegroups.com, Chanwoo Choi , Alexandre Belloni , Krzysztof Kozlowski , Laxman Dewangan , linux-samsung-soc@vger.kernel.org, Javier Martinez Canillas Subject: [rtc-linux] [PATCH v3 03/10] rtc: max77686: Use usleep_range() instead of msleep() Date: Tue, 26 Jan 2016 16:20:13 -0300 Message-Id: <1453836020-29579-4-git-send-email-javier@osg.samsung.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1453836020-29579-1-git-send-email-javier@osg.samsung.com> References: <1453836020-29579-1-git-send-email-javier@osg.samsung.com> X-Original-Sender: javier@osg.samsung.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 54.187.51.154 is neither permitted nor denied by best guess record for domain of javier@osg.samsung.com) smtp.mailfrom=javier@osg.samsung.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: rtc-linux@googlegroups.com X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Documentation/timers/timers-howto.txt suggest to use usleep_range() instead of msleep() for small msec (1ms - 20ms) since msleep() will often sleep for 20ms for any value in that range. This is fine in this case since 16ms is the _minimum_ delay required by max77686 for an RTC update but by using usleep_range() instead of msleep(), the driver can support other RTC IP blocks with a shorter minimum delay (i.e: in the range of usecs instead of msecs). Signed-off-by: Javier Martinez Canillas Reviewed-by: Krzysztof Kozlowski Tested-by: Krzysztof Kozlowski Reviewed-by: Andi Shyti --- Changes in v3: - Add Krzysztof Kozlowski's Tested-by tag to patch #3. - Add Laxman Dewangan's Acked-by tag to patch #3. Changes in v2: - Add Krzysztof Kozlowski's Reviewed-by tag to patch #3. - Fix typo error in changelog. Suggested by Krzysztof Kozlowski. drivers/rtc/rtc-max77686.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c index d84a50c9f7f7..025a17a95da3 100644 --- a/drivers/rtc/rtc-max77686.c +++ b/drivers/rtc/rtc-max77686.c @@ -41,7 +41,7 @@ #define ALARM_ENABLE_SHIFT 7 #define ALARM_ENABLE_MASK (1 << ALARM_ENABLE_SHIFT) -#define MAX77686_RTC_UPDATE_DELAY 16 +#define MAX77686_RTC_UPDATE_DELAY 16000 enum { RTC_SEC = 0, @@ -130,7 +130,8 @@ static int max77686_rtc_update(struct max77686_rtc_info *info, __func__, ret, data); else { /* Minimum 16ms delay required before RTC update. */ - msleep(MAX77686_RTC_UPDATE_DELAY); + usleep_range(MAX77686_RTC_UPDATE_DELAY, + MAX77686_RTC_UPDATE_DELAY * 2); } return ret;