From patchwork Mon Mar 30 17:48:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 15194 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 n2UHmG5W023015 for ; Mon, 30 Mar 2009 17:48:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751717AbZC3Rs0 (ORCPT ); Mon, 30 Mar 2009 13:48:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752147AbZC3Rs0 (ORCPT ); Mon, 30 Mar 2009 13:48:26 -0400 Received: from g1t0027.austin.hp.com ([15.216.28.34]:28456 "EHLO g1t0027.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751717AbZC3RsZ (ORCPT ); Mon, 30 Mar 2009 13:48:25 -0400 Received: from smtp1.fc.hp.com (smtp1.fc.hp.com [15.15.136.127]) by g1t0027.austin.hp.com (Postfix) with ESMTP id 523AA38098; Mon, 30 Mar 2009 17:48:24 +0000 (UTC) Received: from localhost.localdomain (lart.fc.hp.com [15.11.146.31]) by smtp1.fc.hp.com (Postfix) with ESMTP id 6485724AF44; Mon, 30 Mar 2009 17:18:59 +0000 (UTC) Received: from bob.kio (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id 03E8126145; Mon, 30 Mar 2009 11:48:24 -0600 (MDT) Subject: [PATCH 03/10] ACPI: processor: use .notify method instead of installing handler directly To: Len Brown From: Bjorn Helgaas Cc: Tony Vroon , Alex Chiang , linux-acpi@vger.kernel.org, Carlos Corbacho , Anil S Keshavamurthy , Jonathan Woithe , Zhao Yakui , Mattia Dongili , Harald Welte , Venki Pallipadi , Alexey Starikovskiy , Zhang Rui , Matthew Garrett Date: Mon, 30 Mar 2009 11:48:24 -0600 Message-ID: <20090330174823.20905.32501.stgit@bob.kio> In-Reply-To: <20090330174646.20905.18465.stgit@bob.kio> References: <20090330174646.20905.18465.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: Zhang Rui CC: Zhao Yakui CC: Venki Pallipadi CC: Anil S Keshavamurthy --- drivers/acpi/processor_core.c | 19 ++++--------------- 1 files changed, 4 insertions(+), 15 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/acpi/processor_core.c b/drivers/acpi/processor_core.c index 0cc2fd3..0e97d70 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -82,7 +82,7 @@ static int acpi_processor_add(struct acpi_device *device); static int acpi_processor_start(struct acpi_device *device); static int acpi_processor_remove(struct acpi_device *device, int type); static int acpi_processor_info_open_fs(struct inode *inode, struct file *file); -static void acpi_processor_notify(acpi_handle handle, u32 event, void *data); +static void acpi_processor_notify(struct acpi_device *device, u32 event); static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); static int acpi_processor_handle_eject(struct acpi_processor *pr); @@ -104,6 +104,7 @@ static struct acpi_driver acpi_processor_driver = { .start = acpi_processor_start, .suspend = acpi_processor_suspend, .resume = acpi_processor_resume, + .notify = acpi_processor_notify, }, }; @@ -666,7 +667,6 @@ static DEFINE_PER_CPU(void *, processor_device_array); static int __cpuinit acpi_processor_start(struct acpi_device *device) { int result = 0; - acpi_status status = AE_OK; struct acpi_processor *pr; struct sys_device *sysdev; @@ -703,9 +703,6 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) return -EFAULT; - status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, - acpi_processor_notify, pr); - /* _PDC call should be done before doing anything else (if reqd.). */ arch_acpi_processor_init_pdc(pr); acpi_processor_set_pdc(pr); @@ -751,18 +748,14 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) return result; } -static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) +static void acpi_processor_notify(struct acpi_device *device, u32 event) { - struct acpi_processor *pr = data; - struct acpi_device *device = NULL; + struct acpi_processor *pr = acpi_driver_data(device); int saved; if (!pr) return; - if (acpi_bus_get_device(pr->handle, &device)) - return; - switch (event) { case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: saved = pr->performance_platform_limit; @@ -841,7 +834,6 @@ static int acpi_processor_add(struct acpi_device *device) static int acpi_processor_remove(struct acpi_device *device, int type) { - acpi_status status = AE_OK; struct acpi_processor *pr = NULL; @@ -860,9 +852,6 @@ static int acpi_processor_remove(struct acpi_device *device, int type) acpi_processor_power_exit(pr, device); - status = acpi_remove_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, - acpi_processor_notify); - sysfs_remove_link(&device->dev.kobj, "sysdev"); acpi_processor_remove_fs(device);