Skip to content

Commit

Permalink
timekeeping: Calc stuff once
Browse files Browse the repository at this point in the history
Calculate the cycle interval shifted value once. No functional change,
just makes the code more readable.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
  • Loading branch information
Thomas Gleixner authored and John Stultz committed Mar 22, 2013
1 parent 90adda9 commit 23a9537
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -1250,15 +1250,16 @@ static inline void accumulate_nsecs_to_secs(struct timekeeper *tk)
static cycle_t logarithmic_accumulation(struct timekeeper *tk, cycle_t offset,
u32 shift)
{
cycle_t interval = tk->cycle_interval << shift;
u64 raw_nsecs;

/* If the offset is smaller then a shifted interval, do nothing */
if (offset < tk->cycle_interval<<shift)
if (offset < interval)
return offset;

/* Accumulate one shifted interval */
offset -= tk->cycle_interval << shift;
tk->clock->cycle_last += tk->cycle_interval << shift;
offset -= interval;
tk->clock->cycle_last += interval;

tk->xtime_nsec += tk->xtime_interval << shift;
accumulate_nsecs_to_secs(tk);
Expand Down

0 comments on commit 23a9537

Please sign in to comment.