[PATCH 5/9] MIPS: csrc-r4k: Only use VDSO_CLOCKMODE_R4K when it is a available

From: Thomas Weißschuh

Date: Thu May 21 2026 - 02:57:30 EST


VDSO_CLOCKMODE_R4K is only defined if CONFIG_GENERIC_GETTIMEOFDAY is
enabled. Right now this is always the case, but it will change soon.

Prepare for the potential unavailability of VDSO_CLOCKMODE_R4K.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
---
arch/mips/kernel/csrc-r4k.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c
index 59eca397f297..7c431119bb14 100644
--- a/arch/mips/kernel/csrc-r4k.c
+++ b/arch/mips/kernel/csrc-r4k.c
@@ -130,8 +130,11 @@ int __init init_r4k_clocksource(void)
* R2 onwards makes the count accessible to user mode so it can be used
* by the VDSO (HWREna is configured by configure_hwrena()).
*/
- if (cpu_has_mips_r2_r6 && rdhwr_count_usable())
+ if (cpu_has_mips_r2_r6 && rdhwr_count_usable()) {
+#ifdef CONFIG_GENERIC_GETTIMEOFDAY
clocksource_mips.vdso_clock_mode = VDSO_CLOCKMODE_R4K;
+#endif
+ }

clocksource_register_hz(&clocksource_mips, mips_hpt_frequency);


--
2.54.0