From patchwork Tue Apr 7 15:37:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 16904 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n37FbA6m006075 for ; Tue, 7 Apr 2009 15:37:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755739AbZDGPhj (ORCPT ); Tue, 7 Apr 2009 11:37:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755860AbZDGPhj (ORCPT ); Tue, 7 Apr 2009 11:37:39 -0400 Received: from g4t0015.houston.hp.com ([15.201.24.18]:39636 "EHLO g4t0015.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755739AbZDGPhi (ORCPT ); Tue, 7 Apr 2009 11:37:38 -0400 Received: from smtp1.fc.hp.com (smtp.fc.hp.com [15.15.136.127]) by g4t0015.houston.hp.com (Postfix) with ESMTP id D7F97852A; Tue, 7 Apr 2009 15:37:37 +0000 (UTC) Received: from localhost.localdomain (lart.fc.hp.com [15.11.146.31]) by smtp1.fc.hp.com (Postfix) with ESMTP id 064E124C95D; Tue, 7 Apr 2009 15:07:36 +0000 (UTC) Received: from bob.kio (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id 5D11126146; Tue, 7 Apr 2009 09:37:37 -0600 (MDT) Subject: [PATCH 7/7] ACPI: WMI: use .notify method instead of installing handler directly To: Len Brown From: Bjorn Helgaas Cc: Tony Vroon , Mattia Dongili , Carlos Corbacho , Harald Welte , Jonathan Woithe , linux-acpi@vger.kernel.org, Zhang Rui Date: Tue, 07 Apr 2009 09:37:37 -0600 Message-ID: <20090407153737.21399.57171.stgit@bob.kio> In-Reply-To: <20090407153532.21399.92051.stgit@bob.kio> References: <20090407153532.21399.92051.stgit@bob.kio> User-Agent: StGit/0.14.3.347.g594a MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org This patch adds a .notify() method. The presence of .notify() causes Linux/ACPI to manage event handlers and notify handlers on our behalf, so we don't have to install and remove them ourselves. Signed-off-by: Bjorn Helgaas CC: Carlos Corbacho --- drivers/platform/x86/wmi.c | 15 +++------------ 1 files changed, 3 insertions(+), 12 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 2f269e1..043b208 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -81,6 +81,7 @@ static struct wmi_block wmi_blocks; static int acpi_wmi_remove(struct acpi_device *device, int type); static int acpi_wmi_add(struct acpi_device *device); +static void acpi_wmi_notify(struct acpi_device *device, u32 event); static const struct acpi_device_id wmi_device_ids[] = { {"PNP0C14", 0}, @@ -96,6 +97,7 @@ static struct acpi_driver acpi_wmi_driver = { .ops = { .add = acpi_wmi_add, .remove = acpi_wmi_remove, + .notify = acpi_wmi_notify, }, }; @@ -643,12 +645,11 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address, } } -static void acpi_wmi_notify(acpi_handle handle, u32 event, void *data) +static void acpi_wmi_notify(struct acpi_device *device, u32 event) { struct guid_block *block; struct wmi_block *wblock; struct list_head *p; - struct acpi_device *device = data; list_for_each(p, &wmi_blocks.list) { wblock = list_entry(p, struct wmi_block, list); @@ -669,9 +670,6 @@ static void acpi_wmi_notify(acpi_handle handle, u32 event, void *data) static int acpi_wmi_remove(struct acpi_device *device, int type) { - acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, - acpi_wmi_notify); - acpi_remove_address_space_handler(device->handle, ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler); @@ -683,13 +681,6 @@ static int __init acpi_wmi_add(struct acpi_device *device) acpi_status status; int result = 0; - status = acpi_install_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, - acpi_wmi_notify, device); - if (ACPI_FAILURE(status)) { - printk(KERN_ERR PREFIX "Error installing notify handler\n"); - return -ENODEV; - } - status = acpi_install_address_space_handler(device->handle, ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler,