[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKFp2yC88O3q6kO+tNVwzkJVySQW7PA0Cm5xjHEX31x275w@mail.gmail.com>
Date: Thu, 11 Apr 2019 11:36:45 +0200
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Nicholas Mc Guire <hofrat@...ntech.at>
Cc: Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
linux-clk <linux-clk@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RFC] clk: ux500: add range to usleep_range
On Sun, 7 Apr 2019 at 05:13, Nicholas Mc Guire <hofrat@...ntech.at> 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 <hofrat@...ntech.at>
> ---
>
> 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));
Kind regards
Uffe
Powered by blists - more mailing lists