Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8802d97 authored by Eric Dumazet's avatar Eric Dumazet Committed by Thomas Gleixner
Browse files

ktime: Provide typesafe ktime_to_ns()



Using ktime_to_ns() is nice to help backports to stable kernels.

Having a typesafe function instead of a macro avoid stupid typos
and waste of time tracking these typos.

Reported-by: default avatarWillem de Bruijn <willemb@google.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lkml.kernel.org/r/20180711181641.10369-1-edumazet@google.com
parent 7a6e5537
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -93,8 +93,11 @@ static inline ktime_t timeval_to_ktime(struct timeval tv)
/* Map the ktime_t to timeval conversion to ns_to_timeval function */
/* Map the ktime_t to timeval conversion to ns_to_timeval function */
#define ktime_to_timeval(kt)		ns_to_timeval((kt))
#define ktime_to_timeval(kt)		ns_to_timeval((kt))


/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */
/* Convert ktime_t to nanoseconds */
#define ktime_to_ns(kt)			(kt)
static inline s64 ktime_to_ns(const ktime_t kt)
{
	return kt;
}


/**
/**
 * ktime_compare - Compares two ktime_t variables for less, greater or equal
 * ktime_compare - Compares two ktime_t variables for less, greater or equal