[PATCH] x86, numa: cleanup x86_acpi_numa_init()

From: Yinghai Lu
Date: Wed Feb 16 2011 - 17:32:12 EST


make it more readable. put valid checking together.

Also restore old acpi_numa_init(). we don't need to touch it
because already have x86 own wrapper.

Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>

---
arch/x86/mm/srat_64.c | 13 ++++++++++++-
drivers/acpi/numa.c | 8 +++-----
2 files changed, 15 insertions(+), 6 deletions(-)

Index: linux-2.6/arch/x86/mm/srat_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/srat_64.c
+++ linux-2.6/arch/x86/mm/srat_64.c
@@ -240,9 +240,20 @@ int __init x86_acpi_numa_init(void)
int ret;

ret = acpi_numa_init();
+
+ /* no srat */
+ if (!ret)
+ return -ENOENT;
+
+ /* parse failed */
if (ret < 0)
return ret;
- return srat_disabled() ? -EINVAL : 0;
+
+ /* bad_srat() */
+ if (srat_disabled())
+ return -EINVAL;
+
+ return 0;
}

#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) || defined(CONFIG_ACPI_HOTPLUG_MEMORY)
Index: linux-2.6/drivers/acpi/numa.c
===================================================================
--- linux-2.6.orig/drivers/acpi/numa.c
+++ linux-2.6/drivers/acpi/numa.c
@@ -274,7 +274,7 @@ acpi_table_parse_srat(enum acpi_srat_typ

int __init acpi_numa_init(void)
{
- int cnt = 0;
+ int ret = 0;

/*
* Should not limit number with cpu num that is from NR_CPUS or nr_cpus=
@@ -288,7 +288,7 @@ int __init acpi_numa_init(void)
acpi_parse_x2apic_affinity, 0);
acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY,
acpi_parse_processor_affinity, 0);
- cnt = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY,
+ ret = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY,
acpi_parse_memory_affinity,
NR_NODE_MEMBLKS);
}
@@ -298,9 +298,7 @@ int __init acpi_numa_init(void)

acpi_numa_arch_fixup();

- if (cnt <= 0)
- return cnt ?: -ENOENT;
- return 0;
+ return ret;
}

int acpi_get_pxm(acpi_handle h)
--
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/