[PATCH 7/7] LoongArch: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED()

Thomas Weißschuh <[email protected]> Thu, 09 Jul 2026 13:32:43 +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]>
Now that there is a dummy declaration of VDSO_CLOCKMODE_CPU, even if no
vDSO is built, the ugly ifdeffery can be replaced with a cleaner
IS_ENABLED() check.

Signed-off-by: Thomas Weißschuh <[email protected]>
---
 arch/loongarch/kernel/time.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/loongarch/kernel/time.c b/arch/loongarch/kernel/time.c
index dbaaabcaf6f0..dfc04d9f342e 100644
--- a/arch/loongarch/kernel/time.c
+++ b/arch/loongarch/kernel/time.c
@@ -212,9 +212,8 @@ static struct clocksource clocksource_const = {
 	.read = read_const_counter,
 	.mask = CLOCKSOURCE_MASK(64),
 	.flags = CLOCK_SOURCE_IS_CONTINUOUS,
-#ifdef CONFIG_GENERIC_GETTIMEOFDAY
-	.vdso_clock_mode = VDSO_CLOCKMODE_CPU,
-#endif
+	.vdso_clock_mode = IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY) ?
+				VDSO_CLOCKMODE_CPU : VDSO_CLOCKMODE_NONE,
 };
 
 int __init constant_clocksource_init(void)

-- 
2.55.0