From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: linux-acpi@vger.kernel.org
Cc: lhms <lhms-devel@lists.sourceforge.net>,
Patrick Mochel <mochel@linux.intel.com>,
"Brown, Len" <len.brown@intel.com>, Greg KH <gregkh@suse.de>
Subject: [PATCH] create symlink from memory section to device [2/2] acpi_memhotplug change.
Date: Mon, 20 Feb 2006 10:35:36 +0900 [thread overview]
Message-ID: <43F91CE8.3010303@jp.fujitsu.com> (raw)
This patch add phys_device symbolic link support to acpi memory hotplug.
This will help shell script for memory hotplug.
example)
%readlink /sys/devices/system/memory/memory10/phys_device
../../../../firmware/acpi/namespace/ACPI/_SB/LSB1/MEM3
Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Index: testtree/drivers/acpi/acpi_memhotplug.c
===================================================================
--- testtree.orig/drivers/acpi/acpi_memhotplug.c 2006-02-17 15:07:53.000000000 +0900
+++ testtree/drivers/acpi/acpi_memhotplug.c 2006-02-17 15:08:30.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
@@ -180,6 +181,19 @@
return_VALUE(0);
}
+static acpi_status acpi_memory_link_name(struct acpi_memory_device *mem_device)
+{
+ struct acpi_device *device = NULL;
+ acpi_status status;
+ int ret;
+ status = acpi_bus_get_device(mem_device->handle, &device);
+ if (ACPI_FAILURE(status))
+ return status;
+ ret = attach_device_to_memsection(mem_device->start_addr,
+ mem_device->end_addr, &device->kobj);
+ return_VALUE(ret);
+}
+
static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
{
int result;
@@ -206,7 +220,8 @@
mem_device->state = MEMORY_INVALID_STATE;
return result;
}
-
+ /* link to /sys/devices/system/memory/memoryX */
+ result = acpi_memory_link_name(mem_device);
return result;
}
@@ -471,6 +486,22 @@
return_ACPI_STATUS(status);
}
+static acpi_status __init acpi_memory_link_name_cb(acpi_handle handle, u32 level,
+ void *ctxt, void **retv)
+{
+ acpi_status status;
+ struct acpi_memory_device *mem_device;
+ status = is_memory_device(handle);
+ if (ACPI_FAILURE(status))
+ return_ACPI_STATUS(AE_OK); /* continue */
+ if (acpi_memory_get_device(handle, &mem_device)) {
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Error in finding driver data\n"));
+ return_ACPI_STATUS(AE_OK); /* continue */
+ }
+ return acpi_memory_link_name(mem_device);
+}
+
static int __init acpi_memory_device_init(void)
{
int result;
@@ -494,6 +525,16 @@
return_VALUE(-ENODEV);
}
+ status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX,
+ acpi_memory_link_name_cb,
+ NULL, NULL);
+ if (ACPI_FAILURE(status)) {
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n"));
+ acpi_bus_unregister_driver(&acpi_memory_device_driver);
+ return_VALUE(-ENODEV);
+ }
+
return_VALUE(0);
}
reply other threads:[~2006-02-20 1:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=43F91CE8.3010303@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=gregkh@suse.de \
--cc=len.brown@intel.com \
--cc=lhms-devel@lists.sourceforge.net \
--cc=linux-acpi@vger.kernel.org \
--cc=mochel@linux.intel.com \
/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.