[PATCH] memory hotplug : change phys_device to symbolic [2/2] foracpi

From: KAMEZAWA Hiroyuki
Date: Mon Apr 10 2006 - 05:23:04 EST


This is acpi part.
-Kame
===

This patch adds symbolic link from memmory sysfs device to
memory device in acpi namespace.

like this:
[kamezawa@casares ~]$ readlink /sys/devices/system/memory/memory10/phys_device
../../../../firmware/acpi/namespace/ACPI/_SB/LSB1/MEM2

Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>

Index: linux-2.6.17-rc1-mm2/drivers/acpi/acpi_memhotplug.c
===================================================================
--- linux-2.6.17-rc1-mm2.orig/drivers/acpi/acpi_memhotplug.c 2006-04-10 18:09:39.000000000 +0900
+++ linux-2.6.17-rc1-mm2/drivers/acpi/acpi_memhotplug.c 2006-04-10 18:09:57.000000000 +0900
@@ -30,6 +30,7 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/memory_hotplug.h>
+#include <linux/memory.h>
#include <acpi/acpi_drivers.h>

#define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000UL
@@ -215,6 +216,7 @@
{
int result, num_enabled = 0;
struct acpi_memory_info *info;
+ struct acpi_device *device;

ACPI_FUNCTION_TRACE("acpi_memory_enable_device");

@@ -250,6 +252,15 @@
info->enabled = 1;
num_enabled++;
}
+ result = acpi_bus_get_device(mem_device->handle, &device);
+ if (!result) {
+ /* create symbolic link between acpi namespace <->
+ memory sysfs */
+ list_for_each_entry(info, &mem_device->res_list, list)
+ attach_device_to_memsection(info->start_addr,
+ info->start_addr + info->length,
+ &device->kobj);
+ }

if (!num_enabled) {
ACPI_ERROR((AE_INFO, "add_memory failed"));

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