[2/3] Cleanup: Unify tsc_unstable and tsc_disable
From: Guillaume Chazarain
Date: Sat Mar 03 2007 - 16:42:15 EST
tsc_unstable and tsc_disable serve the same purpose.
Signed-off-by: Guillaume Chazarain <guichaz@xxxxxxxx>
---
diff -r 6cd70e2b4c1f arch/i386/kernel/tsc.c
--- a/arch/i386/kernel/tsc.c Sat Mar 03 21:39:09 2007 +0100
+++ b/arch/i386/kernel/tsc.c Sat Mar 03 22:13:03 2007 +0100
@@ -49,16 +49,6 @@ static int __init tsc_setup(char *str)
__setup("notsc", tsc_setup);
-/*
- * code to mark and check if the TSC is unstable
- * due to cpufreq or due to unsynced TSCs
- */
-static int tsc_unstable;
-
-static inline int check_tsc_unstable(void)
-{
- return tsc_unstable;
-}
/* Accellerators for sched_clock()
* convert from cycles(64bits) => nanoseconds (64bits)
@@ -108,7 +98,7 @@ unsigned long long sched_clock(void)
/*
* Fall back to jiffies if there's no TSC available:
*/
- if (tsc_unstable || unlikely(tsc_disable))
+ if (unlikely(tsc_disable))
/* No locking but a rare wrong value is not a big deal: */
return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
@@ -312,8 +302,8 @@ static struct clocksource clocksource_ts
void mark_tsc_unstable(void)
{
- if (!tsc_unstable) {
- tsc_unstable = 1;
+ if (!tsc_disable) {
+ tsc_disable = 1;
/* Can be called before registration */
if (clocksource_tsc.mult)
clocksource_change_rating(&clocksource_tsc, 0);
@@ -327,7 +317,7 @@ static int __init dmi_mark_tsc_unstable(
{
printk(KERN_NOTICE "%s detected: marking TSC unstable.\n",
d->ident);
- tsc_unstable = 1;
+ tsc_disable = 1;
return 0;
}
@@ -350,7 +340,7 @@ static struct dmi_system_id __initdata b
*/
__cpuinit int unsynchronized_tsc(void)
{
- if (!cpu_has_tsc || tsc_unstable)
+ if (!cpu_has_tsc || tsc_disable)
return 1;
/*
* Intel systems are normally all synchronized.
@@ -359,9 +349,9 @@ __cpuinit int unsynchronized_tsc(void)
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) {
/* assume multi socket systems are not synchronized: */
if (num_possible_cpus() > 1)
- tsc_unstable = 1;
- }
- return tsc_unstable;
+ tsc_disable = 1;
+ }
+ return tsc_disable;
}
/*
@@ -396,7 +386,7 @@ static int __init init_tsc_clocksource(v
clocksource_tsc.mult = clocksource_khz2mult(current_tsc_khz,
clocksource_tsc.shift);
/* lower the rating if we already know its unstable: */
- if (check_tsc_unstable()) {
+ if (tsc_disable) {
clocksource_tsc.rating = 0;
clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
}
--
Guillaume
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/