[PATCH 2/7] vDSO: Make clockmode constants available without CONFIG_GENERIC_GETTIMEOFDAY
Thomas Weißschuh <[email protected]> Thu, 09 Jul 2026 13:32:38 +0200
| Newsgroups | org.kernel.vger.linux-kbuild,dev.linux.lists.loongarch,org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-riscv,org.kernel.vger.linux-arch,org.kernel.vger.linux-kernel,org.kernel.vger.linux-mips |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- 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