diff options
author | Yasunori Goto <y-goto@jp.fujitsu.com> | 2006-06-27 05:53:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-27 20:32:35 -0400 |
commit | dd56a8e36f91f63c0a31e8a118d87b7cf01526b8 (patch) | |
tree | 70e70c16e460df0b8da151bfff09e6b637c97b10 | |
parent | 1f425994f96d85540d47eee98daabc1e211b454e (diff) |
[PATCH] Catch notification of memory add event of ACPI via container driver. (avoid redundant call add_memory)
When acpi_memory_device_init() is called at boottime to register struct
memory acpi_memory_device, acpi_bus_add() are called via
acpi_driver_attach().
But it also calls ops->start() function. It is called even if the memory
blocks are initialized at early boottime. In this case add_memory() return
-EEXIST, and the memory blocks becomes INVALID state even if it is normal.
This is patch to avoid calling add_memory() for already available memory.
[akpm@osdl.org: coding cleanups]
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: "Brown, Len" <len.brown@intel.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/acpi/acpi_memhotplug.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 3721f8dd0de3..5652569b3762 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -234,6 +234,17 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) | |||
234 | * (i.e. memory-hot-remove function) | 234 | * (i.e. memory-hot-remove function) |
235 | */ | 235 | */ |
236 | list_for_each_entry(info, &mem_device->res_list, list) { | 236 | list_for_each_entry(info, &mem_device->res_list, list) { |
237 | u64 start_pfn, end_pfn; | ||
238 | |||
239 | start_pfn = info->start_addr >> PAGE_SHIFT; | ||
240 | end_pfn = (info->start_addr + info->length - 1) >> PAGE_SHIFT; | ||
241 | |||
242 | if (pfn_valid(start_pfn) || pfn_valid(end_pfn)) { | ||
243 | /* already enabled. try next area */ | ||
244 | num_enabled++; | ||
245 | continue; | ||
246 | } | ||
247 | |||
237 | result = add_memory(info->start_addr, info->length); | 248 | result = add_memory(info->start_addr, info->length); |
238 | if (result) | 249 | if (result) |
239 | continue; | 250 | continue; |