From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756830AbcAYL2h (ORCPT ); Mon, 25 Jan 2016 06:28:37 -0500 Received: from hqemgate14.nvidia.com ([216.228.121.143]:3649 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755952AbcAYL2c (ORCPT ); Mon, 25 Jan 2016 06:28:32 -0500 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Mon, 25 Jan 2016 03:29:26 -0800 Message-ID: <56A60451.1080309@nvidia.com> Date: Mon, 25 Jan 2016 16:47:37 +0530 From: Laxman Dewangan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Javier Martinez Canillas , CC: Kukjin Kim , , Chanwoo Choi , Alexandre Belloni , Krzysztof Kozlowski , Subject: Re: [PATCH v2 03/10] rtc: max77686: Use usleep_range() instead of msleep() References: <1453407813-14646-1-git-send-email-javier@osg.samsung.com> <1453407813-14646-4-git-send-email-javier@osg.samsung.com> <56A1F935.2040904@nvidia.com> <56A21B1D.8030303@osg.samsung.com> In-Reply-To: <56A21B1D.8030303@osg.samsung.com> X-Originating-IP: [10.19.65.30] X-ClientProxiedBy: DRUKMAIL101.nvidia.com (10.25.59.19) To bgmail102.nvidia.com (10.25.59.11) Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 22 January 2016 05:35 PM, Javier Martinez Canillas wrote: > Hello Laxman, > > On 01/22/2016 06:41 AM, Laxman Dewangan wrote: >> >> On Friday 22 January 2016 01:53 AM, Javier Martinez Canillas wrote: >>> 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); >>> } >>> >> >> Instead of making usleep_range(16000, 32000), can we make small range as >> usleep_range(16000, 17000)? >> > > Yes, I also didn't know how to make the delay smaller. If I do for > example > > usleep_range(delay, delay + 10000), then the 10000 delta would be too big > for max77802 (50 times the minimum required 200 delay). > > So I used delay * 2 for two reasons: > > 1) That way is generic enough and can work for any delay > > 2) My understanding is that most of times the delay should be precise and > is not that bad if sometimes the delay is the worst case (2 * X) since > after all the delay is the minimum required. > > I also see that usleep_range(X, X * 2) is a used pattern across the > kernel. OK, fine to me here. Acked-by: Laxman Dewangan