diff options
author | Alexey Y. Starikovskiy <alexey.y.starikovskiy@intel.com> | 2006-09-26 04:20:47 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-10-14 01:50:10 -0400 |
commit | 37605a6900f6b4d886d995751fcfeef88c4e462c (patch) | |
tree | 97c0452d730c16e7e80f0062d776bdcee2446851 /drivers/acpi/osl.c | |
parent | fcfc638c6b1345b6646523dbab0065b36a868ffc (diff) |
ACPI: created a dedicated workqueue for notify() execution
http://bugzilla.kernel.org/show_bug.cgi?id=5534#c160
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/osl.c')
-rw-r--r-- | drivers/acpi/osl.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 068fe4f100b0..c84286cbbe25 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -73,6 +73,7 @@ static unsigned int acpi_irq_irq; | |||
73 | static acpi_osd_handler acpi_irq_handler; | 73 | static acpi_osd_handler acpi_irq_handler; |
74 | static void *acpi_irq_context; | 74 | static void *acpi_irq_context; |
75 | static struct workqueue_struct *kacpid_wq; | 75 | static struct workqueue_struct *kacpid_wq; |
76 | static struct workqueue_struct *kacpi_notify_wq; | ||
76 | 77 | ||
77 | acpi_status acpi_os_initialize(void) | 78 | acpi_status acpi_os_initialize(void) |
78 | { | 79 | { |
@@ -91,8 +92,9 @@ acpi_status acpi_os_initialize1(void) | |||
91 | return AE_NULL_ENTRY; | 92 | return AE_NULL_ENTRY; |
92 | } | 93 | } |
93 | kacpid_wq = create_singlethread_workqueue("kacpid"); | 94 | kacpid_wq = create_singlethread_workqueue("kacpid"); |
95 | kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify"); | ||
94 | BUG_ON(!kacpid_wq); | 96 | BUG_ON(!kacpid_wq); |
95 | 97 | BUG_ON(!kacpi_notify_wq); | |
96 | return AE_OK; | 98 | return AE_OK; |
97 | } | 99 | } |
98 | 100 | ||
@@ -104,6 +106,7 @@ acpi_status acpi_os_terminate(void) | |||
104 | } | 106 | } |
105 | 107 | ||
106 | destroy_workqueue(kacpid_wq); | 108 | destroy_workqueue(kacpid_wq); |
109 | destroy_workqueue(kacpi_notify_wq); | ||
107 | 110 | ||
108 | return AE_OK; | 111 | return AE_OK; |
109 | } | 112 | } |
@@ -566,10 +569,7 @@ void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */ | |||
566 | 569 | ||
567 | static void acpi_os_execute_deferred(void *context) | 570 | static void acpi_os_execute_deferred(void *context) |
568 | { | 571 | { |
569 | struct acpi_os_dpc *dpc = NULL; | 572 | struct acpi_os_dpc *dpc = (struct acpi_os_dpc *)context; |
570 | |||
571 | |||
572 | dpc = (struct acpi_os_dpc *)context; | ||
573 | if (!dpc) { | 573 | if (!dpc) { |
574 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); | 574 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); |
575 | return; | 575 | return; |
@@ -604,14 +604,12 @@ acpi_status acpi_os_execute(acpi_execute_type type, | |||
604 | struct acpi_os_dpc *dpc; | 604 | struct acpi_os_dpc *dpc; |
605 | struct work_struct *task; | 605 | struct work_struct *task; |
606 | 606 | ||
607 | ACPI_FUNCTION_TRACE("os_queue_for_execution"); | ||
608 | |||
609 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 607 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
610 | "Scheduling function [%p(%p)] for deferred execution.\n", | 608 | "Scheduling function [%p(%p)] for deferred execution.\n", |
611 | function, context)); | 609 | function, context)); |
612 | 610 | ||
613 | if (!function) | 611 | if (!function) |
614 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 612 | return AE_BAD_PARAMETER; |
615 | 613 | ||
616 | /* | 614 | /* |
617 | * Allocate/initialize DPC structure. Note that this memory will be | 615 | * Allocate/initialize DPC structure. Note that this memory will be |
@@ -624,26 +622,20 @@ acpi_status acpi_os_execute(acpi_execute_type type, | |||
624 | * from the same memory. | 622 | * from the same memory. |
625 | */ | 623 | */ |
626 | 624 | ||
627 | dpc = | 625 | dpc = kmalloc(sizeof(struct acpi_os_dpc) + |
628 | kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct), | 626 | sizeof(struct work_struct), GFP_ATOMIC); |
629 | GFP_ATOMIC); | ||
630 | if (!dpc) | 627 | if (!dpc) |
631 | return_ACPI_STATUS(AE_NO_MEMORY); | 628 | return AE_NO_MEMORY; |
632 | |||
633 | dpc->function = function; | 629 | dpc->function = function; |
634 | dpc->context = context; | 630 | dpc->context = context; |
635 | |||
636 | task = (void *)(dpc + 1); | 631 | task = (void *)(dpc + 1); |
637 | INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); | 632 | INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); |
638 | 633 | if (!queue_work((type == OSL_NOTIFY_HANDLER)? | |
639 | if (!queue_work(kacpid_wq, task)) { | 634 | kacpi_notify_wq : kacpid_wq, task)) { |
640 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
641 | "Call to queue_work() failed.\n")); | ||
642 | kfree(dpc); | ||
643 | status = AE_ERROR; | 635 | status = AE_ERROR; |
636 | kfree(dpc); | ||
644 | } | 637 | } |
645 | 638 | return status; | |
646 | return_ACPI_STATUS(status); | ||
647 | } | 639 | } |
648 | 640 | ||
649 | EXPORT_SYMBOL(acpi_os_execute); | 641 | EXPORT_SYMBOL(acpi_os_execute); |