ACPI code for memory hot-add when node is added [1/2]
If a notification is delivered a container with memory block like a numa node, container driver should searches devices which belongs on the container and adds it.
But current implementation works only when notification comes directly to memory device, because notify handler for memory device calls enable_device() directly.
I think acpi_memory_device driver should have .start method to call acpi_memory_enable_device(). This method is calls from both notification case memory device and container.
Signed-off-by Yasunori Goto <[email protected]>
drivers/acpi/acpi_memhotplug.c +23 -6
@@ -58,6 +58,7 @@ MODULE_LICENSE("GPL");static int acpi_memory_device_add (struct acpi_device *device);static int acpi_memory_device_remove (struct acpi_device *device,int type); +static int acpi_memory_device_start (struct acpi_device *device);static struct acpi_driver acpi_memory_device_driver = { .name =ACPI_MEMORY_DEVICE_DRIVER_NAME ,
@@ -66,6 +67,7 @@ static struct acpi_driver acpi_memory_de .ops = { .add = acpi_memory_device_add, .remove = acpi_memory_device_remove, + .start = acpi_memory_device_start, }, };
@@ -309,12 +311,6 @@ acpi_memory_device_notify(acpi_handle ha "Error in finding driver data\n")); return_VOID; } - -if (!acpi_memory_check_device (mem_device)) { -if (acpi_memory_enable_device (mem_device)) -ACPI_DEBUG_PRINT ((ACPI_DB_ERROR , -"Error in acpi_memory_enable_device\n" )); - }break ;case ACPI_NOTIFY_EJECT_REQUEST : ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -406,6 +402,27 @@ acpi_memory_device_remove (struct acpi_dreturn_VALUE (0 ); } +static int +acpi_memory_device_start (struct acpi_device *device) +{ +struct acpi_memory_device *mem_device =NULL ; +int result =0 ; + +ACPI_FUNCTION_TRACE ("acpi_memory_device_start" ); + + mem_device = (struct acpi_memory_device *)acpi_driver_data (device); + +if (!acpi_memory_check_device (mem_device)){ +/* call add_memory func */ + result =acpi_memory_enable_device (mem_device); +if (result) +ACPI_DEBUG_PRINT ((ACPI_DB_ERROR , +"Error in acpi_memory_enable_device\n" )); + } + +return_VALUE (result); +} +/* * Helper function to check for memory device */
Signature · 9 lines
Yasunori Goto ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf