Skip to content

Commit

Permalink
[PATCH] Catch notification of memory add event of ACPI via container …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Yasunori Goto authored and Linus Torvalds committed Jun 28, 2006
1 parent 1f42599 commit dd56a8e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/acpi/acpi_memhotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,17 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
* (i.e. memory-hot-remove function)
*/
list_for_each_entry(info, &mem_device->res_list, list) {
u64 start_pfn, end_pfn;

start_pfn = info->start_addr >> PAGE_SHIFT;
end_pfn = (info->start_addr + info->length - 1) >> PAGE_SHIFT;

if (pfn_valid(start_pfn) || pfn_valid(end_pfn)) {
/* already enabled. try next area */
num_enabled++;
continue;
}

result = add_memory(info->start_addr, info->length);
if (result)
continue;
Expand Down

0 comments on commit dd56a8e

Please sign in to comment.