Browse Source

x86_64: Move apic calibration code around

Let the calibration code fill in calibration_result directly and
move the variable on top of the file.

Fixup a printk w/o log level while at it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Thomas Gleixner 17 years ago
parent
commit
d03030e917
1 changed files with 6 additions and 9 deletions
  1. 6 9
      arch/x86/kernel/apic_64.c

+ 6 - 9
arch/x86/kernel/apic_64.c

@@ -55,6 +55,8 @@ static struct resource lapic_resource = {
 	.flags = IORESOURCE_MEM | IORESOURCE_BUSY,
 	.flags = IORESOURCE_MEM | IORESOURCE_BUSY,
 };
 };
 
 
+static unsigned int calibration_result;
+
 /*
 /*
  * cpu_mask that denotes the CPUs that needs timer interrupt coming in as
  * cpu_mask that denotes the CPUs that needs timer interrupt coming in as
  * IPIs in place of local APIC timers
  * IPIs in place of local APIC timers
@@ -821,7 +823,7 @@ static void setup_APIC_timer(unsigned int clocks)
 
 
 #define TICK_COUNT 100000000
 #define TICK_COUNT 100000000
 
 
-static int __init calibrate_APIC_clock(void)
+static void __init calibrate_APIC_clock(void)
 {
 {
 	unsigned apic, apic_start;
 	unsigned apic, apic_start;
 	unsigned long tsc, tsc_start;
 	unsigned long tsc, tsc_start;
@@ -855,17 +857,14 @@ static int __init calibrate_APIC_clock(void)
 		result = (apic_start - apic) * 1000L * tsc_khz /
 		result = (apic_start - apic) * 1000L * tsc_khz /
 					(tsc - tsc_start);
 					(tsc - tsc_start);
 	}
 	}
-	printk("result %d\n", result);
-
+	printk(KERN_DEBUG "APIC timer calibration result %d\n", result);
 
 
 	printk(KERN_INFO "Detected %d.%03d MHz APIC timer.\n",
 	printk(KERN_INFO "Detected %d.%03d MHz APIC timer.\n",
 		result / 1000 / 1000, result / 1000 % 1000);
 		result / 1000 / 1000, result / 1000 % 1000);
 
 
-	return result * APIC_DIVISOR / HZ;
+	calibration_result = result * APIC_DIVISOR / HZ;
 }
 }
 
 
-static unsigned int calibration_result;
-
 void __init setup_boot_APIC_clock (void)
 void __init setup_boot_APIC_clock (void)
 {
 {
 	if (disable_apic_timer) {
 	if (disable_apic_timer) {
@@ -878,7 +877,7 @@ void __init setup_boot_APIC_clock (void)
 
 
 	local_irq_disable();
 	local_irq_disable();
 
 
-	calibration_result = calibrate_APIC_clock();
+	calibrate_APIC_clock();
 	/*
 	/*
 	 * Now set up the timer for real.
 	 * Now set up the timer for real.
 	 */
 	 */
@@ -985,8 +984,6 @@ void setup_APIC_extended_lvt(unsigned char lvt_off, unsigned char vector,
 	apic_write(reg, v);
 	apic_write(reg, v);
 }
 }
 
 
-#undef APIC_DIVISOR
-
 /*
 /*
  * Local timer interrupt handler. It does both profiling and
  * Local timer interrupt handler. It does both profiling and
  * process statistics/rescheduling.
  * process statistics/rescheduling.