Ticket #4152: acpi_dpc_loading.patch
File acpi_dpc_loading.patch, 2.3 KB (added by , 15 years ago) |
---|
-
acpi_module.c
13 13 #include <dpc.h> 14 14 #include <PCI.h> 15 15 16 dpc_module_info* gDPC = NULL;17 void* gDPCHandle = NULL;18 19 16 //#define TRACE_ACPI_MODULE 20 17 #ifdef TRACE_ACPI_MODULE 21 18 # define TRACE(x) dprintf x … … 23 20 # define TRACE(x) ; 24 21 #endif 25 22 23 dpc_module_info* gDPC = NULL; 24 void* gDPCHandle = NULL; 25 26 26 device_manager_info *gDeviceManager = NULL; 27 27 pci_module_info *gPCIManager = NULL; 28 28 29 29 module_dependency module_dependencies[] = { 30 30 {B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&gDeviceManager}, 31 31 {B_PCI_MODULE_NAME, (module_info **)&gPCIManager}, 32 {B_DPC_MODULE_NAME, (module_info **)&gDPC}, 32 33 {} 33 34 }; 34 35 … … 172 173 static status_t 173 174 acpi_module_init(device_node *node, void **_cookie) 174 175 { 175 if (get_module(B_DPC_MODULE_NAME, (module_info **)&gDPC) != B_OK) {176 dprintf("failed to get dpc module\n");177 return B_ERROR;178 }179 if (gDPC->new_dpc_queue(&gDPCHandle, "acpi_task",180 B_NORMAL_PRIORITY) != B_OK) {181 dprintf("failed to create os execution queue\n");182 return B_ERROR;183 }184 185 176 *_cookie = node; 186 177 return B_OK; 187 178 } … … 190 181 static void 191 182 acpi_module_uninit(void *cookie) 192 183 { 193 gDPC->delete_dpc_queue(gDPCHandle);194 gDPCHandle = NULL;195 put_module(B_DPC_MODULE_NAME);196 gDPC = NULL;197 184 } 198 185 199 186 … … 204 191 case B_MODULE_INIT: 205 192 { 206 193 module_info *module; 194 195 if (get_module(B_DPC_MODULE_NAME, (module_info **)&gDPC) != B_OK) { 196 dprintf("failed to get dpc module\n"); 197 return B_ERROR; 198 } 199 if (gDPC->new_dpc_queue(&gDPCHandle, "acpi_task", 200 B_NORMAL_PRIORITY) != B_OK) { 201 dprintf("failed to create os execution queue\n"); 202 return B_ERROR; 203 } 204 207 205 return get_module(B_ACPI_MODULE_NAME, &module); 208 206 // this serializes our module initialization 209 207 } 210 208 211 209 case B_MODULE_UNINIT: 212 return put_module(B_ACPI_MODULE_NAME); 210 { 211 status_t result = put_module(B_ACPI_MODULE_NAME); 212 gDPC->delete_dpc_queue(gDPCHandle); 213 gDPCHandle = NULL; 214 put_module(B_DPC_MODULE_NAME); 215 gDPC = NULL; 216 return result; 217 } 213 218 } 214 219 215 220 return B_BAD_VALUE; … … 260 265 evaluate_method, 261 266 }; 262 267 263 _EXPORTmodule_info *modules[] = {268 module_info *modules[] = { 264 269 (module_info *)&gACPIModule, 265 270 (module_info *)&sACPIRootModule, 266 271 (module_info *)&acpi_ns_dump_module,