[lkml]   [2019]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH V2] clk: ux500: add range to usleep_range
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. With the expected range for
enable_delay_us being milliseconds, the range should lie in the 250us
range which is sufficient for hrtimer optimization.

Signed-off-by: Nicholas Mc Guire <>

Problem located with an experimental coccinelle script
V2: As clarified by Ulf Hansson <> the delays
here are typically in the millisecond range - so as proposed
replace the factor 2 by a 25% increase of max.

Patch was compile tested with: u8500_defconfig (implies COMMON_CLK=y)
(with some unrelated sparse warnings about not implemented system calls)
Patch is against 5.1-rc4 (localversion-next is next=20190410)

drivers/clk/ux500/clk-sysctrl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c
index 7c0403b..698306f 100644
--- a/drivers/clk/ux500/clk-sysctrl.c
+++ b/drivers/clk/ux500/clk-sysctrl.c
@@ -42,7 +42,8 @@ static int clk_sysctrl_prepare(struct clk_hw *hw)

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 +
+ (clk->enable_delay_us >> 2));

return ret;
 \ /
  Last update: 2019-04-11 13:05    [W:0.057 / U:10.996 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site