diff options
Diffstat (limited to 'arch/x86/kernel/tsc_32.c')
-rw-r--r-- | arch/x86/kernel/tsc_32.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c index c2241e04ea5f..3d7e6e9fa6c2 100644 --- a/arch/x86/kernel/tsc_32.c +++ b/arch/x86/kernel/tsc_32.c | |||
@@ -84,8 +84,8 @@ DEFINE_PER_CPU(unsigned long, cyc2ns); | |||
84 | 84 | ||
85 | static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu) | 85 | static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu) |
86 | { | 86 | { |
87 | unsigned long flags, prev_scale, *scale; | ||
88 | unsigned long long tsc_now, ns_now; | 87 | unsigned long long tsc_now, ns_now; |
88 | unsigned long flags, *scale; | ||
89 | 89 | ||
90 | local_irq_save(flags); | 90 | local_irq_save(flags); |
91 | sched_clock_idle_sleep_event(); | 91 | sched_clock_idle_sleep_event(); |
@@ -95,7 +95,6 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu) | |||
95 | rdtscll(tsc_now); | 95 | rdtscll(tsc_now); |
96 | ns_now = __cycles_2_ns(tsc_now); | 96 | ns_now = __cycles_2_ns(tsc_now); |
97 | 97 | ||
98 | prev_scale = *scale; | ||
99 | if (cpu_khz) | 98 | if (cpu_khz) |
100 | *scale = (NSEC_PER_MSEC << CYC2NS_SCALE_FACTOR)/cpu_khz; | 99 | *scale = (NSEC_PER_MSEC << CYC2NS_SCALE_FACTOR)/cpu_khz; |
101 | 100 | ||
@@ -392,13 +391,15 @@ void __init tsc_init(void) | |||
392 | int cpu; | 391 | int cpu; |
393 | 392 | ||
394 | if (!cpu_has_tsc) | 393 | if (!cpu_has_tsc) |
395 | goto out_no_tsc; | 394 | return; |
396 | 395 | ||
397 | cpu_khz = calculate_cpu_khz(); | 396 | cpu_khz = calculate_cpu_khz(); |
398 | tsc_khz = cpu_khz; | 397 | tsc_khz = cpu_khz; |
399 | 398 | ||
400 | if (!cpu_khz) | 399 | if (!cpu_khz) { |
401 | goto out_no_tsc; | 400 | mark_tsc_unstable("could not calculate TSC khz"); |
401 | return; | ||
402 | } | ||
402 | 403 | ||
403 | printk("Detected %lu.%03lu MHz processor.\n", | 404 | printk("Detected %lu.%03lu MHz processor.\n", |
404 | (unsigned long)cpu_khz / 1000, | 405 | (unsigned long)cpu_khz / 1000, |
@@ -431,9 +432,4 @@ void __init tsc_init(void) | |||
431 | tsc_enabled = 1; | 432 | tsc_enabled = 1; |
432 | 433 | ||
433 | clocksource_register(&clocksource_tsc); | 434 | clocksource_register(&clocksource_tsc); |
434 | |||
435 | return; | ||
436 | |||
437 | out_no_tsc: | ||
438 | setup_clear_cpu_cap(X86_FEATURE_TSC); | ||
439 | } | 435 | } |