Messages in this thread | | | Date | Tue, 28 Feb 2012 09:16:59 +0100 | From | Ingo Molnar <> | Subject | Re: [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
| |