svn commit: r297484 - head/sys/x86/x86

Konstantin Belousov kib at FreeBSD.org
Fri Apr 1 08:47:24 UTC 2016


Author: kib
Date: Fri Apr  1 08:47:23 2016
New Revision: 297484
URL: https://svnweb.freebsd.org/changeset/base/297484

Log:
  Style(9), use tabs for the #define LOOPS line.
  Print unsigned values with %u.
  Make code slightly more compact by inlining loop limit.
  
  Noted by:	bde
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/x86/x86/local_apic.c

Modified: head/sys/x86/x86/local_apic.c
==============================================================================
--- head/sys/x86/x86/local_apic.c	Fri Apr  1 06:43:05 2016	(r297483)
+++ head/sys/x86/x86/local_apic.c	Fri Apr  1 08:47:23 2016	(r297484)
@@ -511,7 +511,7 @@ native_lapic_init(vm_paddr_t addr)
 	}
 
 #ifdef SMP
-#define LOOPS 1000000
+#define	LOOPS	1000000
 	/*
 	 * Calibrate the busy loop waiting for IPI ack in xAPIC mode.
 	 * lapic_ipi_wait_mult contains the number of iterations which
@@ -535,7 +535,7 @@ native_lapic_init(vm_paddr_t addr)
 	r2 = r * 1000000;
 	lapic_ipi_wait_mult = r1 >= r2 ? r1 / r2 : 1;
 	if (bootverbose) {
-		printf("LAPIC: ipi_wait() us multiplier %jd (r %jd tsc %jd)\n",
+		printf("LAPIC: ipi_wait() us multiplier %ju (r %ju tsc %ju)\n",
 		    (uintmax_t)lapic_ipi_wait_mult, (uintmax_t)r,
 		    (uintmax_t)tsc_freq);
 	}
@@ -1762,14 +1762,13 @@ SYSINIT(apic_setup_io, SI_SUB_INTR, SI_O
 static int
 native_lapic_ipi_wait(int delay)
 {
-	uint64_t i, counter;
+	uint64_t rx;
 
 	/* LAPIC_ICR.APIC_DELSTAT_MASK is undefined in x2APIC mode */
 	if (x2apic_mode)
 		return (1);
 
-	counter = lapic_ipi_wait_mult * delay;
-	for (i = 0; delay == -1 || i < counter; i++) {
+	for (rx = 0; delay == -1 || rx < lapic_ipi_wait_mult * delay; rx++) {
 		if ((lapic_read_icr_lo() & APIC_DELSTAT_MASK) ==
 		    APIC_DELSTAT_IDLE)
 			return (1);


More information about the svn-src-all mailing list