From patchwork Wed Jan 27 03:36:39 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: 8129131 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 88692BEEE5 for ; Wed, 27 Jan 2016 03:39:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A8291202BE for ; Wed, 27 Jan 2016 03:39:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2BEC2028D for ; Wed, 27 Jan 2016 03:39:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752500AbcA0DhS (ORCPT ); Tue, 26 Jan 2016 22:37:18 -0500 Received: from lists.s-osg.org ([54.187.51.154]:54395 "EHLO lists.s-osg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752485AbcA0DhQ (ORCPT ); Tue, 26 Jan 2016 22:37:16 -0500 Received: from sauron.localdomain (unknown [181.120.163.117]) by lists.s-osg.org (Postfix) with ESMTPSA id 5211146321; Tue, 26 Jan 2016 19:37:11 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Kukjin Kim , rtc-linux@googlegroups.com, Andi Shyti , Chanwoo Choi , Alexandre Belloni , Krzysztof Kozlowski , Laxman Dewangan , linux-samsung-soc@vger.kernel.org, Javier Martinez Canillas Subject: [PATCH v4 03/10] rtc: max77686: Use usleep_range() instead of msleep() Date: Wed, 27 Jan 2016 00:36:39 -0300 Message-Id: <1453865806-4661-4-git-send-email-javier@osg.samsung.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1453865806-4661-1-git-send-email-javier@osg.samsung.com> References: <1453865806-4661-1-git-send-email-javier@osg.samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 v4: - Add Andi Shyti's Reviewed-by to patch #3. 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;