From 2f0441f7e3c95ce25d8dc5128604e23cc322c130 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Thu, 9 Jul 2009 16:06:40 +0000 Subject: [PATCH] Already get the DCP module when init the ACPI modul. Doing it on demand in AcpiOsExecute leads to kernel panic on my machine. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31481 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/bus_managers/acpi/acpi_busman.c | 17 +---------------- .../kernel/bus_managers/acpi/acpi_module.c | 16 ++++++++++++++++ src/add-ons/kernel/bus_managers/acpi/oshaiku.c | 16 +--------------- 3 files changed, 18 insertions(+), 31 deletions(-) diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c index 87042680dd..328cda1a31 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c @@ -13,7 +13,6 @@ #include #include -#include #include #include @@ -33,9 +32,6 @@ #define ERROR(x...) dprintf("acpi: " x) -extern dpc_module_info* gDPC; -void* gDPCHandle = NULL; - extern pci_module_info* gPCIManager; @@ -138,7 +134,7 @@ acpi_std_ops(int32 op,...) AcpiFormatException(status)); goto err; } - + /* Phew. Now in ACPI mode */ TRACE("ACPI initialized\n"); return B_OK; @@ -151,17 +147,6 @@ acpi_std_ops(int32 op,...) { if (AcpiTerminate() != AE_OK) ERROR("Could not bring system out of ACPI mode. Oh well.\n"); - - /* This isn't so terrible. We'll just fail silently */ - if (gDPC != NULL) { - if (gDPCHandle != NULL) { - gDPC->delete_dpc_queue(gDPCHandle); - gDPCHandle = NULL; - } - - put_module(B_DPC_MODULE_NAME); - } - break; } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_module.c b/src/add-ons/kernel/bus_managers/acpi/acpi_module.c index 5305705d9a..317876ca4f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_module.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_module.c @@ -13,6 +13,8 @@ #include #include +dpc_module_info* gDPC = NULL; +void* gDPCHandle = NULL; //#define TRACE_ACPI_MODULE #ifdef TRACE_ACPI_MODULE @@ -170,6 +172,16 @@ acpi_module_register_child_devices(void *cookie) static status_t acpi_module_init(device_node *node, void **_cookie) { + if (get_module(B_DPC_MODULE_NAME, (module_info **)&gDPC) != B_OK) { + dprintf("failed to get dpc module\n"); + return B_ERROR; + } + if (gDPC->new_dpc_queue(&gDPCHandle, "acpi_task", + B_NORMAL_PRIORITY) != B_OK) { + dprintf("failed to create os execution queue\n"); + return B_ERROR; + } + *_cookie = node; return B_OK; } @@ -178,6 +190,10 @@ acpi_module_init(device_node *node, void **_cookie) static void acpi_module_uninit(void *cookie) { + gDPC->delete_dpc_queue(gDPCHandle); + gDPCHandle = NULL; + put_module(B_DPC_MODULE_NAME); + gDPC = NULL; } diff --git a/src/add-ons/kernel/bus_managers/acpi/oshaiku.c b/src/add-ons/kernel/bus_managers/acpi/oshaiku.c index 8d58edf241..dc5bb80f7a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/oshaiku.c +++ b/src/add-ons/kernel/bus_managers/acpi/oshaiku.c @@ -132,7 +132,7 @@ #include extern pci_module_info *gPCIManager; #include -dpc_module_info *gDPC = NULL; +extern dpc_module_info *gDPC; extern void *gDPCHandle; #endif @@ -822,20 +822,6 @@ AcpiOsExecute(ACPI_EXECUTE_TYPE Type, ACPI_OSD_EXEC_CALLBACK Function, break; } - if (gDPC == NULL && get_module(B_DPC_MODULE_NAME, - (module_info **)&gDPC) != B_OK) { - dprintf("failed to get dpc module for os execution\n"); - return AE_ERROR; - } - - if (gDPCHandle == NULL) { - if (gDPC->new_dpc_queue(&gDPCHandle, "acpi_task", - B_NORMAL_PRIORITY) != B_OK) { - dprintf("failed to create os execution queue\n"); - return AE_ERROR; - } - } - if (gDPC->queue_dpc(gDPCHandle, Function, Context) != B_OK) return AE_ERROR;