[PATCH 2/7] vDSO: Make clockmode constants available without CONFIG_GENERIC_GETTIMEOFDAY
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Thu Jul 9 04:32:38 PDT 2026
Some code, for example clocksource drivers, may want to use the vDSO
clockmode constants even when CONFIG_GENERIC_GETTIMEOFDAY=n.
But the symbols are completely hidden in that case, making ugly
ifdeffery necessary.
Provide unlinkable dummy definitions. These can be used with
IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY).
As not all architectures provide asm/vdso/clocksource.h,
provide an empty stub in asm-generic for it.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
include/asm-generic/Kbuild | 1 +
include/asm-generic/vdso/clocksource.h | 0
include/vdso/clocksource.h | 7 +++++--
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
index 15df9dcb42a5..2bc00c67dc54 100644
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -62,6 +62,7 @@ mandatory-y += topology.h
mandatory-y += trace_clock.h
mandatory-y += uaccess.h
mandatory-y += unwind_user.h
+mandatory-y += vdso/clocksource.h
mandatory-y += vermagic.h
mandatory-y += vga.h
mandatory-y += video.h
diff --git a/include/asm-generic/vdso/clocksource.h b/include/asm-generic/vdso/clocksource.h
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/include/vdso/clocksource.h b/include/vdso/clocksource.h
index c682e7c60273..63ee8c4ea15c 100644
--- a/include/vdso/clocksource.h
+++ b/include/vdso/clocksource.h
@@ -4,9 +4,12 @@
#include <vdso/limits.h>
-#ifdef CONFIG_GENERIC_GETTIMEOFDAY
#include <asm/vdso/clocksource.h>
-#endif /* CONFIG_GENERIC_GETTIMEOFDAY */
+
+#if !IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY) && defined(VDSO_ARCH_CLOCKMODES)
+/* Unlinkable dummy stubs */
+extern int VDSO_ARCH_CLOCKMODES;
+#endif
enum vdso_clock_mode {
VDSO_CLOCKMODE_NONE,
--
2.55.0
More information about the linux-riscv
mailing list