diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2009-08-31 18:32:10 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-09-19 02:15:05 -0400 |
commit | 9ac6185669d0d277c4082fa92ba8eb2e55534cbf (patch) | |
tree | eacaf117ddf71e2b75738cfdcd918572a165943c /drivers/acpi | |
parent | d26f0528d588e596955bf296a609afe52eafc099 (diff) |
ACPI: simplify deferred execution path
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 <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/osl.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index c5b4f1ed9b71..d753206f0734 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -58,6 +58,7 @@ struct acpi_os_dpc { | |||
58 | acpi_osd_exec_callback function; | 58 | acpi_osd_exec_callback function; |
59 | void *context; | 59 | void *context; |
60 | struct work_struct work; | 60 | struct work_struct work; |
61 | int wait; | ||
61 | }; | 62 | }; |
62 | 63 | ||
63 | #ifdef CONFIG_ACPI_CUSTOM_DSDT | 64 | #ifdef CONFIG_ACPI_CUSTOM_DSDT |
@@ -703,21 +704,8 @@ static void acpi_os_execute_deferred(struct work_struct *work) | |||
703 | return; | 704 | return; |
704 | } | 705 | } |
705 | 706 | ||
706 | dpc->function(dpc->context); | 707 | if (dpc->wait) |
707 | kfree(dpc); | 708 | acpi_os_wait_events_complete(NULL); |
708 | |||
709 | return; | ||
710 | } | ||
711 | |||
712 | static void acpi_os_execute_hp_deferred(struct work_struct *work) | ||
713 | { | ||
714 | struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); | ||
715 | if (!dpc) { | ||
716 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); | ||
717 | return; | ||
718 | } | ||
719 | |||
720 | acpi_os_wait_events_complete(NULL); | ||
721 | 709 | ||
722 | dpc->function(dpc->context); | 710 | dpc->function(dpc->context); |
723 | kfree(dpc); | 711 | kfree(dpc); |
@@ -746,7 +734,6 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, | |||
746 | acpi_status status = AE_OK; | 734 | acpi_status status = AE_OK; |
747 | struct acpi_os_dpc *dpc; | 735 | struct acpi_os_dpc *dpc; |
748 | struct workqueue_struct *queue; | 736 | struct workqueue_struct *queue; |
749 | work_func_t func; | ||
750 | int ret; | 737 | int ret; |
751 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 738 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
752 | "Scheduling function [%p(%p)] for deferred execution.\n", | 739 | "Scheduling function [%p(%p)] for deferred execution.\n", |
@@ -779,8 +766,8 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, | |||
779 | */ | 766 | */ |
780 | queue = hp ? kacpi_hotplug_wq : | 767 | queue = hp ? kacpi_hotplug_wq : |
781 | (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); | 768 | (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); |
782 | func = hp ? acpi_os_execute_hp_deferred : acpi_os_execute_deferred; | 769 | dpc->wait = hp ? 1 : 0; |
783 | INIT_WORK(&dpc->work, func); | 770 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); |
784 | ret = queue_work(queue, &dpc->work); | 771 | ret = queue_work(queue, &dpc->work); |
785 | 772 | ||
786 | if (!ret) { | 773 | if (!ret) { |