All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	"H. Peter Anvin" <hpa@zytor.com>, Tejun Heo <tj@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	David Rientjes <rientjes@google.com>,
	Cyrill Gorcunov <gorcunov@gmail.com>
Subject: [PATCH 3/4] x86, numa: cleanup x86_acpi_numa_init()
Date: Fri, 18 Feb 2011 10:59:27 -0800 (PST)	[thread overview]
Message-ID: <4D5EC18F.2070103@kernel.org> (raw)
In-Reply-To: <4D5EC05A.60103@kernel.org>


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.

We can limit change to x86 code only.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 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)

  parent reply	other threads:[~2011-02-18 19:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4D5EC05A.60103@kernel.org>
2011-02-18 18:59 ` [PATCH 1/4] x86, numa: Do not scan two times for setup_node_bootmem() Yinghai Lu
2011-02-20  4:03   ` David Rientjes
2011-02-21 10:20     ` [PATCH] x86-64, NUMA: " Tejun Heo
2011-02-18 18:59 ` [PATCH 2/4] x86, numa: Do not adjust start/end for early_node_mem() Yinghai Lu
2011-02-20  4:03   ` David Rientjes
2011-02-20  4:17     ` Yinghai Lu
2011-02-21  9:43       ` Tejun Heo
2011-02-21 10:44         ` Tejun Heo
2011-02-21 20:28           ` Yinghai Lu
2011-02-22 10:36             ` Tejun Heo
2011-02-22 10:39               ` Tejun Heo
2011-02-21 17:21         ` Yinghai Lu
2011-02-22  0:27           ` David Rientjes
2011-02-18 18:59 ` Yinghai Lu [this message]
2011-02-20  4:03   ` [PATCH 3/4] x86, numa: cleanup x86_acpi_numa_init() David Rientjes
2011-02-21  9:46     ` Tejun Heo
2011-02-18 18:59 ` [PATCH 4/4] x86, numa: seperate alloc_numa_distance from numa_reset_distance Yinghai Lu
2011-02-20  4:03   ` David Rientjes
2011-02-21 10:48   ` Tejun Heo
2011-02-21 17:36     ` Yinghai Lu
2011-02-22 10:23       ` [PATCH] x86-64, NUMA: Seperate out numa_alloc_distance() from numa_set_distance() Tejun Heo
2011-02-22 10:30         ` Ingo Molnar
2011-02-22 10:32           ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D5EC18F.2070103@kernel.org \
    --to=yinghai@kernel.org \
    --cc=gorcunov@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rientjes@google.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.