From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from acsinet15.oracle.com ([141.146.126.227]:29470 "EHLO acsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161506Ab2CSFsG (ORCPT ); Mon, 19 Mar 2012 01:48:06 -0400 From: Yinghai Lu To: Jesse Barnes , x86 Cc: Bjorn Helgaas , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu , Len Brown , linux-acpi@vger.kernel.org Subject: [PATCH -v3 29/47] PCI, ACPI: Add alloc_acpi_hp_work() Date: Sun, 18 Mar 2012 22:46:18 -0700 Message-Id: <1332135996-13860-30-git-send-email-yinghai@kernel.org> In-Reply-To: <1332135996-13860-1-git-send-email-yinghai@kernel.org> References: <1332135996-13860-1-git-send-email-yinghai@kernel.org> Sender: linux-pci-owner@vger.kernel.org List-ID: Will use it with acpiphp and pci_root_hp events handling Signed-off-by: Yinghai Lu Cc: Len Brown Cc: linux-acpi@vger.kernel.org --- drivers/acpi/osl.c | 21 +++++++++++++++++++++ include/acpi/acpiosxf.h | 9 +++++++++ 2 files changed, 30 insertions(+), 0 deletions(-) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 412a1e0..fdcf4a5 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1641,3 +1641,24 @@ acpi_status acpi_os_terminate(void) return AE_OK; } + +void alloc_acpi_hp_work(acpi_handle handle, u32 type, void *context, + void (*func)(struct work_struct *work)) +{ + struct acpi_hp_work *hp_work; + int ret; + + hp_work = kmalloc(sizeof(*hp_work), GFP_KERNEL); + if (!hp_work) + return; + + hp_work->handle = handle; + hp_work->type = type; + hp_work->context = context; + + INIT_WORK(&hp_work->work, func); + ret = queue_work(kacpi_hotplug_wq, &hp_work->work); + if (!ret) + kfree(hp_work); +} +EXPORT_SYMBOL(alloc_acpi_hp_work); diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 7c9aebe..62326ae 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -191,6 +191,15 @@ void acpi_os_fixed_event_count(u32 fixed_event_number); */ extern struct workqueue_struct *kacpi_hotplug_wq; +struct acpi_hp_work { + struct work_struct work; + acpi_handle handle; + u32 type; + void *context; +}; +void alloc_acpi_hp_work(acpi_handle handle, u32 type, void *context, + void (*func)(struct work_struct *work)); + acpi_thread_id acpi_os_get_thread_id(void); acpi_status -- 1.7.7