summaryrefslogtreecommitdiff
path: root/lib/vdso/gettimeofday.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2024-03-25 08:40:05 +0200
committerThomas Gleixner <tglx@linutronix.de>2024-04-08 15:03:06 +0200
commitc8e3a8b6f2e62661d838ae222774121ae23777a4 (patch)
tree9c2956871845abea8bf2764245bc3be816d0c52a /lib/vdso/gettimeofday.c
parent82ccdf062a64f3c4ac575c16179ce68edbbbe8e4 (diff)
vdso: Consolidate vdso_calc_delta()
Consolidate vdso_calc_delta(), in preparation for further simplification. Suggested-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20240325064023.2997-2-adrian.hunter@intel.com
Diffstat (limited to 'lib/vdso/gettimeofday.c')
-rw-r--r--lib/vdso/gettimeofday.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
index ce2f69552003..faccf12f7c03 100644
--- a/lib/vdso/gettimeofday.c
+++ b/lib/vdso/gettimeofday.c
@@ -6,6 +6,13 @@
#include <vdso/helpers.h>
#ifndef vdso_calc_delta
+
+#ifdef VDSO_DELTA_NOMASK
+# define VDSO_DELTA_MASK(mask) U64_MAX
+#else
+# define VDSO_DELTA_MASK(mask) (mask)
+#endif
+
/*
* Default implementation which works for all sane clocksources. That
* obviously excludes x86/TSC.
@@ -13,7 +20,7 @@
static __always_inline
u64 vdso_calc_delta(u64 cycles, u64 last, u64 mask, u32 mult)
{
- return ((cycles - last) & mask) * mult;
+ return ((cycles - last) & VDSO_DELTA_MASK(mask)) * mult;
}
#endif