diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-09-17 22:16:12 -0700 |
---|---|---|
committer | Yinghai Lu <yinghai@kernel.org> | 2012-09-17 22:16:12 -0700 |
commit | 20c61826413d4a684a4febfffc66d1d18b3215c7 (patch) | |
tree | 62a85096f2f3c076ec53dd47017d6517c508dea7 | |
parent | 6f348a7fc6509e4b7036b739a6183286e45d03c6 (diff) | |
download | linux-yinghai-20c61826413d4a684a4febfffc66d1d18b3215c7.tar.gz |
PCI, ACPI: Add alloc_acpi_hp_work()
Will use it with acpiphp and pci_root_hp events handling
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
-rw-r--r-- | drivers/acpi/osl.c | 21 | ||||
-rw-r--r-- | 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 9eaf708f588553..0719fa7bd06733 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1592,3 +1592,24 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, { __acpi_os_prepare_sleep = func; } + +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 0650f5fa7ce992..6ff92ea707b3fd 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -196,6 +196,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 |