lkml.org 
[lkml]   [2017]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC patch 4/7] timekeeping: Add NMI safe accessor to mono/boot/real clocks
On Fri, Nov 17, 2017 at 3:00 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
>
> Could you indent this better. It looks like timekeeping_delta_to_ns()
> takes 4 arguments, when it really only takes two.

Actually, even better would be to simply not have that ugly three-line
expression from hell.

Maybe it could even be a helper inline function, somethin glike

static inline u64 tk_delta_ns(struct tk_read_base *tkr)
{
u64 cycle = tk_clock_read(tkr);
u64 delta= clocksource_delta(cycle, tkr->cycle_last, tkr->mask);
return timekeeping_delta_to_ns(tkr, cycle);
}

and that whole thing would just become

now += tk_delta_ns(tkr);

which looks a whole lot more legible. And shouldn't generate any worse code.

(I might have screwed up something, I wrote that in the email client,
maybe I got something wrong.

And my name choice is probably garbage. But you get the idea.

Linus

\
 
 \ /
  Last update: 2017-11-18 00:13    [W:0.923 / U:4.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site