From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Dave Hansen <haveblue@us.ibm.com>,
gregkh@suse.de, lhms <lhms-devel@lists.sourceforge.net>,
Yasunori Goto <y-goto@jp.fujitsu.com>
Subject: [PATCH] change memoryX->phys_device from number to symlink [2/2] acpi func
Date: Fri, 17 Feb 2006 15:45:51 +0900 [thread overview]
Message-ID: <43F5711F.8010508@jp.fujitsu.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: physdevice_symlink_02.patch --]
[-- Type: text/x-patch, Size: 2611 bytes --]
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-17 6:45 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=43F5711F.8010508@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=gregkh@suse.de \
--cc=haveblue@us.ibm.com \
--cc=lhms-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=y-goto@jp.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox