From patchwork Fri Jul 31 21:36:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 38595 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 n6VLab3r017169 for ; Fri, 31 Jul 2009 21:36:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752945AbZGaVgl (ORCPT ); Fri, 31 Jul 2009 17:36:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752953AbZGaVgk (ORCPT ); Fri, 31 Jul 2009 17:36:40 -0400 Received: from g1t0027.austin.hp.com ([15.216.28.34]:33507 "EHLO g1t0027.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752945AbZGaVgk (ORCPT ); Fri, 31 Jul 2009 17:36:40 -0400 Received: from g5t0029.atlanta.hp.com (g5t0029.atlanta.hp.com [16.228.8.141]) by g1t0027.austin.hp.com (Postfix) with ESMTP id 1DC943840B; Fri, 31 Jul 2009 21:36:41 +0000 (UTC) Received: from ldl.fc.hp.com (ldl.fc.hp.com [15.11.146.30]) by g5t0029.atlanta.hp.com (Postfix) with ESMTP id C857710207; Fri, 31 Jul 2009 21:36:40 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl.fc.hp.com (Postfix) with ESMTP id 6406239C003; Fri, 31 Jul 2009 15:36:40 -0600 (MDT) X-Virus-Scanned: Debian amavisd-new at ldl.fc.hp.com Received: from ldl.fc.hp.com ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rPgudqnhNhO7; Fri, 31 Jul 2009 15:36:38 -0600 (MDT) Received: from eh.fc.hp.com (eh.fc.hp.com [15.11.146.105]) by ldl.fc.hp.com (Postfix) with ESMTP id 9F20F39C008; Fri, 31 Jul 2009 15:36:38 -0600 (MDT) Received: from bob.kio (localhost [127.0.0.1]) by eh.fc.hp.com (Postfix) with ESMTP id 925F526169; Fri, 31 Jul 2009 15:36:38 -0600 (MDT) Subject: [PATCH 01/19] ACPI: simplify deferred execution path To: Len Brown From: Bjorn Helgaas Cc: linux-acpi@vger.kernel.org Date: Fri, 31 Jul 2009 15:36:38 -0600 Message-ID: <20090731213638.29930.591.stgit@bob.kio> In-Reply-To: <20090731213501.29930.39957.stgit@bob.kio> References: <20090731213501.29930.39957.stgit@bob.kio> User-Agent: StGit/0.14.3.386.gb02d MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org We had two functions, acpi_os_execute_deferred() and acpi_os_execute_hp_deferred() that differed only in that the latter did acpi_os_wait_events_complete(NULL) before executing the deferred function. This patch consolidates those two functions and uses a flag in the struct acpi_os_dpc to determine whether to do the wait. Signed-off-by: Bjorn Helgaas --- drivers/acpi/osl.c | 23 +++++------------------ 1 files changed, 5 insertions(+), 18 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/osl.c b/drivers/acpi/osl.c index 5691f16..10df23d 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -58,6 +58,7 @@ struct acpi_os_dpc { acpi_osd_exec_callback function; void *context; struct work_struct work; + int wait; }; #ifdef CONFIG_ACPI_CUSTOM_DSDT @@ -702,21 +703,8 @@ static void acpi_os_execute_deferred(struct work_struct *work) return; } - dpc->function(dpc->context); - kfree(dpc); - - return; -} - -static void acpi_os_execute_hp_deferred(struct work_struct *work) -{ - struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); - if (!dpc) { - printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); - return; - } - - acpi_os_wait_events_complete(NULL); + if (dpc->wait) + acpi_os_wait_events_complete(NULL); dpc->function(dpc->context); kfree(dpc); @@ -745,7 +733,6 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, acpi_status status = AE_OK; struct acpi_os_dpc *dpc; struct workqueue_struct *queue; - work_func_t func; int ret; ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Scheduling function [%p(%p)] for deferred execution.\n", @@ -778,8 +765,8 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, */ queue = hp ? kacpi_hotplug_wq : (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); - func = hp ? acpi_os_execute_hp_deferred : acpi_os_execute_deferred; - INIT_WORK(&dpc->work, func); + dpc->wait = hp ? 1 : 0; + INIT_WORK(&dpc->work, acpi_os_execute_deferred); ret = queue_work(queue, &dpc->work); if (!ret) {