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

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 <>
Signed-off-by: default avatarEric Dumazet <>
Signed-off-by: default avatarThomas Gleixner <>
Cc: Eric Dumazet <>
Cc: John Stultz <>
Cc: Peter Zijlstra <>
Cc: Linus Torvalds <>
parent 7a6e5537
......@@ -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 */
#define ktime_to_timeval(kt) ns_to_timeval((kt))
/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */
#define ktime_to_ns(kt) (kt)
/* Convert ktime_t to nanoseconds */
static inline s64 ktime_to_ns(const ktime_t kt)
return kt;
* ktime_compare - Compares two ktime_t variables for less, greater or equal
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment