[3/3] x86 / ACPI: introduce a helper function acpi_parse_madt_lapic_addr_ovr()

Message ID 1377074777-10639-3-git-send-email-hanjun.guo@linaro.org
State New
Headers show

Commit Message

Hanjun Guo Aug. 21, 2013, 8:46 a.m.
No functional change. There are some copy code both in function
early_acpi_parse_madt_lapic_addr_ovr() and acpi_parse_madt_lapic_entries(),
introduce a helper function and use it to simplify the code.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/x86/kernel/acpi/boot.c |   35 ++++++++++++-----------------------
 1 file changed, 12 insertions(+), 23 deletions(-)

Patch

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index eb1d67d..743d1c51 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -865,12 +865,7 @@  static int __init acpi_parse_fadt(struct acpi_table_header *table)
 }
 
 #ifdef	CONFIG_X86_LOCAL_APIC
-/*
- * Parse LAPIC entries in MADT
- * returns 0 on success, < 0 on error
- */
-
-static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
+static int __init acpi_parse_madt_lapic_addr_ovr(void)
 {
 	int count;
 
@@ -896,29 +891,23 @@  static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
 	return count;
 }
 
+static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
+{
+	return acpi_parse_madt_lapic_addr_ovr();
+}
+
+/*
+ * Parse LAPIC entries in MADT
+ * returns 0 on success, < 0 on error
+ */
 static int __init acpi_parse_madt_lapic_entries(void)
 {
 	int count;
 	int x2count = 0;
 
-	if (!cpu_has_apic)
-		return -ENODEV;
-
-	/*
-	 * Note that the LAPIC address is obtained from the MADT (32-bit value)
-	 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
-	 */
-
-	count =
-	    acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE,
-				  acpi_parse_lapic_addr_ovr, 0);
-	if (count < 0) {
-		printk(KERN_ERR PREFIX
-		       "Error parsing LAPIC address override entry\n");
+	count = acpi_parse_madt_lapic_addr_ovr();
+	if (count < 0)
 		return count;
-	}
-
-	register_lapic_address(acpi_lapic_addr);
 
 	count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC,
 				      acpi_parse_sapic, MAX_LOCAL_APIC);