]> err.no Git - linux-2.6/commitdiff
[MIPS] Clocksource: Only install r4k counter as clocksource if present.
authorRalf Baechle <ralf@linux-mips.org>
Wed, 12 Mar 2008 13:58:10 +0000 (13:58 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 12 Mar 2008 14:14:42 +0000 (14:14 +0000)
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/csrc-r4k.c
include/asm-mips/time.h

index 0e2b5cd81f67dbdd4e48bd83846e074d6c17ea0c..86e026f067bc566c2bbd9620763e2ab6428e836a 100644 (file)
@@ -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;
 }
index a8fd16e1981f36fd7837835366cc412b32465506..d3bd5c5aa2ecd0ae1fa34c9083debcac6c4107e0 100644 (file)
@@ -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