From: Ralf Baechle Date: Wed, 12 Mar 2008 13:58:10 +0000 (+0000) Subject: [MIPS] Clocksource: Only install r4k counter as clocksource if present. X-Git-Tag: v2.6.25-rc6~33^2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69e634f1e27c8e5b954ea4be2d05dd744cabc0bc;p=linux-2.6 [MIPS] Clocksource: Only install r4k counter as clocksource if present. Signed-off-by: Ralf Baechle --- diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c index 0e2b5cd81f..86e026f067 100644 --- a/arch/mips/kernel/csrc-r4k.c +++ b/arch/mips/kernel/csrc-r4k.c @@ -22,12 +22,17 @@ static struct clocksource clocksource_mips = { .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; -void __init init_mips_clocksource(void) +int __init init_mips_clocksource(void) { + if (!cpu_has_counter || !mips_hpt_frequency) + return -ENXIO; + /* Calclate a somewhat reasonable rating value */ clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000; clocksource_set_clock(&clocksource_mips, mips_hpt_frequency); clocksource_register(&clocksource_mips); + + return 0; } diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h index a8fd16e198..d3bd5c5aa2 100644 --- a/include/asm-mips/time.h +++ b/include/asm-mips/time.h @@ -64,10 +64,11 @@ static inline int mips_clockevent_init(void) * Initialize the count register as a clocksource */ #ifdef CONFIG_CEVT_R4K -extern void init_mips_clocksource(void); +extern int init_mips_clocksource(void); #else -static inline void init_mips_clocksource(void) +static inline int init_mips_clocksource(void) { + return 0; } #endif