aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2006-07-12 22:46:42 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2006-07-13 00:02:24 -0400
commit72945b2b90a5554975b8f72673ab7139d232a121 (patch)
tree69ef823d84f7bc970bc4712bd0db5e8a023de65d /drivers/acpi
parentdd4a59a8e5dd44299b2df4411e8d7b05902ef2e7 (diff)
[PATCH] Revert "ACPI: execute Notify() handlers on new thread"
This effectively reverts commit b8d35192c55fb055792ff0641408eaaec7c88988 by reverts acpi_os_queue_for_execution() to what it was before that, except it changes the name to acpi_os_execute() to match ACPICA 20060512. Signed-off-by: Len Brown <len.brown@intel.com> [ The thread execution doesn't actually solve the bug it set out to solve (see http://bugzilla.kernel.org/show_bug.cgi?id=5534 for more details) because the new events can get caught behind the AML semaphore or other serialization. And when that happens, the notify threads keep on piling up until the system dies. ] Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/osl.c60
1 files changed, 24 insertions, 36 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 47dfde95b8f8..b7d1514cd199 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -36,7 +36,6 @@
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/workqueue.h> 37#include <linux/workqueue.h>
38#include <linux/nmi.h> 38#include <linux/nmi.h>
39#include <linux/kthread.h>
40#include <acpi/acpi.h> 39#include <acpi/acpi.h>
41#include <asm/io.h> 40#include <asm/io.h>
42#include <acpi/acpi_bus.h> 41#include <acpi/acpi_bus.h>
@@ -583,16 +582,6 @@ static void acpi_os_execute_deferred(void *context)
583 return; 582 return;
584} 583}
585 584
586static int acpi_os_execute_thread(void *context)
587{
588 struct acpi_os_dpc *dpc = (struct acpi_os_dpc *)context;
589 if (dpc) {
590 dpc->function(dpc->context);
591 kfree(dpc);
592 }
593 do_exit(0);
594}
595
596/******************************************************************************* 585/*******************************************************************************
597 * 586 *
598 * FUNCTION: acpi_os_execute 587 * FUNCTION: acpi_os_execute
@@ -614,10 +603,16 @@ acpi_status acpi_os_execute(acpi_execute_type type,
614 acpi_status status = AE_OK; 603 acpi_status status = AE_OK;
615 struct acpi_os_dpc *dpc; 604 struct acpi_os_dpc *dpc;
616 struct work_struct *task; 605 struct work_struct *task;
617 struct task_struct *p; 606
607 ACPI_FUNCTION_TRACE("os_queue_for_execution");
608
609 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
610 "Scheduling function [%p(%p)] for deferred execution.\n",
611 function, context));
618 612
619 if (!function) 613 if (!function)
620 return AE_BAD_PARAMETER; 614 return_ACPI_STATUS(AE_BAD_PARAMETER);
615
621 /* 616 /*
622 * Allocate/initialize DPC structure. Note that this memory will be 617 * Allocate/initialize DPC structure. Note that this memory will be
623 * freed by the callee. The kernel handles the tq_struct list in a 618 * freed by the callee. The kernel handles the tq_struct list in a
@@ -628,34 +623,27 @@ acpi_status acpi_os_execute(acpi_execute_type type,
628 * We can save time and code by allocating the DPC and tq_structs 623 * We can save time and code by allocating the DPC and tq_structs
629 * from the same memory. 624 * from the same memory.
630 */ 625 */
631 if (type == OSL_NOTIFY_HANDLER) { 626
632 dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_KERNEL); 627 dpc =
633 } else { 628 kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct),
634 dpc = kmalloc(sizeof(struct acpi_os_dpc) + 629 GFP_ATOMIC);
635 sizeof(struct work_struct), GFP_ATOMIC);
636 }
637 if (!dpc) 630 if (!dpc)
638 return AE_NO_MEMORY; 631 return_ACPI_STATUS(AE_NO_MEMORY);
632
639 dpc->function = function; 633 dpc->function = function;
640 dpc->context = context; 634 dpc->context = context;
641 635
642 if (type == OSL_NOTIFY_HANDLER) { 636 task = (void *)(dpc + 1);
643 p = kthread_create(acpi_os_execute_thread, dpc, "kacpid_notify"); 637 INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc);
644 if (!IS_ERR(p)) { 638
645 wake_up_process(p); 639 if (!queue_work(kacpid_wq, task)) {
646 } else { 640 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
647 status = AE_NO_MEMORY; 641 "Call to queue_work() failed.\n"));
648 kfree(dpc); 642 kfree(dpc);
649 } 643 status = AE_ERROR;
650 } else {
651 task = (void *)(dpc + 1);
652 INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc);
653 if (!queue_work(kacpid_wq, task)) {
654 status = AE_ERROR;
655 kfree(dpc);
656 }
657 } 644 }
658 return status; 645
646 return_ACPI_STATUS(status);
659} 647}
660 648
661EXPORT_SYMBOL(acpi_os_execute); 649EXPORT_SYMBOL(acpi_os_execute);