lkml.org 
[lkml]   [2012]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/7] time: Shadow cycle_last in timekeeper structure

* John Stultz <john.stultz@linaro.org> wrote:

> @@ -184,7 +186,7 @@ static inline s64 timekeeping_get_ns(void)
> cycle_now = clock->read(clock);
>
> /* calculate the delta since the last update_wall_time: */
> - cycle_delta = (cycle_now - clock->cycle_last) & clock->mask;
> + cycle_delta = (cycle_now - timekeeper.cycle_last) & clock->mask;

Just a general code design observation: the way how the global
'timekeeper' structure is accessed is rather ugly.

The standard method is to pass it in to timekeeping_get_ns()
(and other methods) as a parameter, with the highest level
taking the address via &timekeeping.

That will also make the code shorter and more obvious: the
familar tk->cycle_last pattern instead of the current mixed uses
of timekeeping.cycle_last and tk->cycle_last.

There's many similar patterns throughout this code, they need to
be fixed as well.

Thanks,

Ingo


\
 
 \ /
  Last update: 2012-02-28 09:19    [W:1.722 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site