diff options
author | Eric Dumazet <edumazet@google.com> | 2018-07-11 11:16:41 -0700 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2018-07-12 21:35:28 +0200 |
commit | a8802d97e73346bc81609df9dfba7d3306f40d87 (patch) | |
tree | de8f2bc033a598a1d4a609bdb445a8c70407a909 | |
parent | 7a6e55375d5c584c7c11cfdcaa8ad9d6cccb419d (diff) | |
download | linux-a8802d97e73346bc81609df9dfba7d3306f40d87.tar.bz2 |
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: Willem de Bruijn <willemb@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Thomas 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
-rw-r--r-- | include/linux/ktime.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index 5b9fddbaac41..b2bb44f87f5a 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h @@ -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 |