Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5686699yba; Thu, 11 Apr 2019 03:40:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyg0bcA63MXJJQLv/wHfGORJO93UfkcbbAkk7yH1E3wMUIzW+0oeDZAyiBxz+kw5iZUbdFQ X-Received: by 2002:a17:902:8a81:: with SMTP id p1mr50105161plo.106.1554979229420; Thu, 11 Apr 2019 03:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554979229; cv=none; d=google.com; s=arc-20160816; b=wG6sFZE0JvVqsJ+oVTaghyC10AkLSmofYJuLS8xfWw31JyIrAUHcRNzX3MasLTx1VE hE5x/CXvCbdKdb4UQ5mPmkzOGYVJhE4a7PUTpiU1kiqgWNaP5oKgVd++duaUGzr9liXN hRc97nOgbCrTkKzsBLoS6IM6jEYpmrWugJ8GA2ZlJBPvi1cUJmh123/820RnL/qjdGft dj0Co2gl9AT+RYn4EK0Knx4siIcu6EixqON4trdW9+G1myOry994VFINXzd1+bRK3iDD /qjWowNHlb/rV+AiF3eBCmqSVptCGCmdX7YTCEM4nKnMR3ya1ZLLFnclgZHfO1QdzzEi xfhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=UCznLonHh2XB6rdN6SyNomHcBBG1BBvrLUmIwZoFUxc=; b=BMdVRahRxAt7CtRgc4axBCwdq7O/431nzSHxj9xLajgb7Ad7MKVhiP3Vv6RiLfw3q4 Tv6zg2By0E5u4KoglEEyCuZs7NbWTc4GZ1lu0kx/lozieWITNac+y5XHUmaT7TJd6qP8 KPeRrzmbrtQ26O7eCuQiKnILu0AobGE5hDLLoLz5HMZf3W45sZ5jim6OEVcRiR0NNpQR e54bW94IaFyZiqmJAqkDLXV6tDcTvWOv03uUb7QN1CddLQRsVBcwDZdusWQtyeH4cn+Y egTyV1KpVleQ+yI6GGWfSnfTKuoM8hTJ3qjr4NESc2JuacWK3gGoQB6kuF19Ydh3zmeL eQrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j11si26990543pff.216.2019.04.11.03.40.12; Thu, 11 Apr 2019 03:40:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726628AbfDKKjd (ORCPT + 99 others); Thu, 11 Apr 2019 06:39:33 -0400 Received: from 178.115.242.59.static.drei.at ([178.115.242.59]:38411 "EHLO mail.osadl.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726215AbfDKKjc (ORCPT ); Thu, 11 Apr 2019 06:39:32 -0400 Received: by mail.osadl.at (Postfix, from userid 1001) id 8FEF75C29C8; Thu, 11 Apr 2019 12:38:44 +0200 (CEST) Date: Thu, 11 Apr 2019 12:38:44 +0200 From: Nicholas Mc Guire To: Ulf Hansson Cc: Nicholas Mc Guire , Michael Turquette , Stephen Boyd , Linux ARM , linux-clk , Linux Kernel Mailing List Subject: Re: [PATCH RFC] clk: ux500: add range to usleep_range Message-ID: <20190411103844.GA8267@osadl.at> References: <1554606804-29453-1-git-send-email-hofrat@opentech.at> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 11, 2019 at 11:36:45AM +0200, Ulf Hansson wrote: > On Sun, 7 Apr 2019 at 05:13, Nicholas Mc Guire wrote: > > > > Providing a range for usleep_range() allows the hrtimer subsystem to > > coalesce timers - the delay is runtime configurable so a factor 2 > > is taken to provide the range. > > > > Signed-off-by: Nicholas Mc Guire > > --- > > > > Problem located with an experimental coccinelle script > > > > Q: Basically usleep_range() with min == max never makes much sense notably > > in non-atomic context. If the factor of 2 is tolerable or a fixed > > offset of e.g. 1000 would be more suitable is not clear to me - maybe > > someone familiar with that driver can clarify this. > > > > Patch was compile tested with: u8500_defconfig (implies COMMON_CLK=y) > > (with some sparse warnings about not implemented system calls) > > > > Patch is against 5.1-rc3 (localversion-next is next=20190405) > > > > drivers/clk/ux500/clk-sysctrl.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c > > index 7c0403b..a1fa3fb 100644 > > --- a/drivers/clk/ux500/clk-sysctrl.c > > +++ b/drivers/clk/ux500/clk-sysctrl.c > > @@ -42,7 +42,7 @@ static int clk_sysctrl_prepare(struct clk_hw *hw) > > clk->reg_bits[0]); > > > > if (!ret && clk->enable_delay_us) > > - usleep_range(clk->enable_delay_us, clk->enable_delay_us); > > + usleep_range(clk->enable_delay_us, clk->enable_delay_us*2); > > The range being used is actually in ms, so not sure we actually need > to double it for the range. > > How about adding ~25% instead, along the lines of below: > usleep_range(clk->enable_delay_us, clk->enable_delay_us + > (clk->enable_delay_us >> 2)); > that would be perfectly sufficient for hrtimers - if the range is in ms - so I?ll send out a V2 shortly. thx! hofrat