From: Toshi Kani <toshi.kani@hp.com>
To: linux-acpi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, lenb@kernel.org,
bhelgaas@google.com, liuj97@gmail.com,
isimatu.yasuaki@jp.fujitsu.com, Toshi Kani <toshi.kani@hp.com>
Subject: [RFC PATCH 5/5] ACPI: Update container to use .sys_notify
Date: Thu, 30 Aug 2012 14:16:06 -0600 [thread overview]
Message-ID: <1346357766-14030-6-git-send-email-toshi.kani@hp.com> (raw)
In-Reply-To: <1346357766-14030-1-git-send-email-toshi.kani@hp.com>
Changed the ACPI container driver to use .sys_notify. Removed
ACPI namespace walks and their call-back function that register
and unregister the hotplug handler to all container objects
through acpi_[install|remove]_notify_handler().
Signed-off-by: Toshi Kani <toshi.kani@hp.com>
---
drivers/acpi/container.c | 66 ++-------------------------------------------
1 files changed, 3 insertions(+), 63 deletions(-)
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index 1f9f7d7..d4e8b71 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -53,6 +53,7 @@ MODULE_LICENSE("GPL");
static int acpi_container_add(struct acpi_device *device);
static int acpi_container_remove(struct acpi_device *device, int type);
+static void container_notify(acpi_handle handle, u32 type, void *context);
static const struct acpi_device_id container_device_ids[] = {
{"ACPI0004", 0},
@@ -69,6 +70,7 @@ static struct acpi_driver acpi_container_driver = {
.ops = {
.add = acpi_container_add,
.remove = acpi_container_remove,
+ .sys_notify = container_notify,
},
};
@@ -152,7 +154,7 @@ static int container_device_add(struct acpi_device **device, acpi_handle handle)
return result;
}
-static void container_notify_cb(acpi_handle handle, u32 type, void *context)
+static void container_notify(acpi_handle handle, u32 type, void *context)
{
struct acpi_device *device = NULL;
int result;
@@ -211,82 +213,20 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
return;
}
-static acpi_status
-container_walk_namespace_cb(acpi_handle handle,
- u32 lvl, void *context, void **rv)
-{
- char *hid = NULL;
- struct acpi_device_info *info;
- acpi_status status;
- int *action = context;
-
- status = acpi_get_object_info(handle, &info);
- if (ACPI_FAILURE(status)) {
- return AE_OK;
- }
-
- if (info->valid & ACPI_VALID_HID)
- hid = info->hardware_id.string;
-
- if (hid == NULL) {
- goto end;
- }
-
- if (strcmp(hid, "ACPI0004") && strcmp(hid, "PNP0A05") &&
- strcmp(hid, "PNP0A06")) {
- goto end;
- }
-
- switch (*action) {
- case INSTALL_NOTIFY_HANDLER:
- acpi_install_notify_handler(handle,
- ACPI_SYSTEM_NOTIFY,
- container_notify_cb, NULL);
- break;
- case UNINSTALL_NOTIFY_HANDLER:
- acpi_remove_notify_handler(handle,
- ACPI_SYSTEM_NOTIFY,
- container_notify_cb);
- break;
- default:
- break;
- }
-
- end:
- kfree(info);
-
- return AE_OK;
-}
-
static int __init acpi_container_init(void)
{
int result = 0;
- int action = INSTALL_NOTIFY_HANDLER;
result = acpi_bus_register_driver(&acpi_container_driver);
if (result < 0) {
return (result);
}
- /* register notify handler to every container device */
- acpi_walk_namespace(ACPI_TYPE_DEVICE,
- ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX,
- container_walk_namespace_cb, NULL, &action, NULL);
-
return (0);
}
static void __exit acpi_container_exit(void)
{
- int action = UNINSTALL_NOTIFY_HANDLER;
-
-
- acpi_walk_namespace(ACPI_TYPE_DEVICE,
- ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX,
- container_walk_namespace_cb, NULL, &action, NULL);
-
acpi_bus_unregister_driver(&acpi_container_driver);
return;
--
1.7.7.6
prev parent reply other threads:[~2012-08-30 20:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-30 20:16 [RFC PATCH 0/5] ACPI: Refactor system notify handling Toshi Kani
2012-08-30 20:16 ` [RFC PATCH 1/5] ACPI: Add acpi_lookup_driver() function Toshi Kani
2012-08-31 5:42 ` Bjorn Helgaas
2012-08-31 16:24 ` Toshi Kani
2012-09-06 23:52 ` Toshi Kani
2012-08-30 20:16 ` [RFC PATCH 2/5] ACPI: Support system notify handler via .sys_notify Toshi Kani
2012-08-30 20:16 ` [RFC PATCH 3/5] ACPI: Update processor_driver to use .sys_notify Toshi Kani
2012-08-30 20:16 ` [RFC PATCH 4/5] ACPI: Update acpi_memhotplug " Toshi Kani
2012-08-30 20:16 ` Toshi Kani [this message]
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=1346357766-14030-6-git-send-email-toshi.kani@hp.com \
--to=toshi.kani@hp.com \
--cc=bhelgaas@google.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuj97@gmail.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;
as well as URLs for NNTP newsgroup(s).