X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Facpi%2Futilities%2Futdelete.c;h=1db9695b002927d9efb311bfe2b18626e769c455;hb=9464c7cf61b9433057924c36e6e02f303a00e768;hp=9d3f1149ba217736e5ff8b376445e522f6f8a79f;hpb=41689045f6a3cbe0550e1d34e9cc20d2e8c432ba;p=linux-2.6.git diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 9d3f1149b..1db9695b0 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -76,7 +76,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) union acpi_operand_object *second_desc; union acpi_operand_object *next_desc; - ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object); + ACPI_FUNCTION_TRACE_PTR("ut_delete_internal_obj", object); if (!object) { return_VOID; @@ -96,7 +96,6 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) /* Free the actual string buffer */ if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { - /* But only if it is NOT a pointer into an ACPI table */ obj_pointer = object->string.pointer; @@ -112,7 +111,6 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) /* Free the actual buffer */ if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { - /* But only if it is NOT a pointer into an ACPI table */ obj_pointer = object->buffer.pointer; @@ -155,30 +153,21 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) case ACPI_TYPE_MUTEX: ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, - "***** Mutex %p, OS Mutex %p\n", - object, object->mutex.os_mutex)); - - if (object->mutex.os_mutex != ACPI_GLOBAL_LOCK) { - acpi_ex_unlink_mutex(object); - acpi_os_delete_mutex(object->mutex.os_mutex); - } else { - /* Global Lock "mutex" is actually a counting semaphore */ + "***** Mutex %p, Semaphore %p\n", + object, object->mutex.semaphore)); - (void) - acpi_os_delete_semaphore - (acpi_gbl_global_lock_semaphore); - acpi_gbl_global_lock_semaphore = NULL; - } + acpi_ex_unlink_mutex(object); + (void)acpi_os_delete_semaphore(object->mutex.semaphore); break; case ACPI_TYPE_EVENT: ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, - "***** Event %p, OS Semaphore %p\n", - object, object->event.os_semaphore)); + "***** Event %p, Semaphore %p\n", + object, object->event.semaphore)); - (void)acpi_os_delete_semaphore(object->event.os_semaphore); - object->event.os_semaphore = NULL; + (void)acpi_os_delete_semaphore(object->event.semaphore); + object->event.semaphore = NULL; break; case ACPI_TYPE_METHOD: @@ -186,13 +175,12 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "***** Method %p\n", object)); - /* Delete the method mutex if it exists */ + /* Delete the method semaphore if it exists */ - if (object->method.mutex) { - acpi_os_delete_mutex(object->method.mutex->mutex. - os_mutex); - acpi_ut_delete_object_desc(object->method.mutex); - object->method.mutex = NULL; + if (object->method.semaphore) { + (void)acpi_os_delete_semaphore(object->method. + semaphore); + object->method.semaphore = NULL; } break; @@ -210,22 +198,11 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) */ handler_desc = object->region.handler; if (handler_desc) { - if (handler_desc->address_space.handler_flags & + if (handler_desc->address_space. + hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { - - /* Deactivate region and free region context */ - - if (handler_desc->address_space.setup) { - (void)handler_desc-> - address_space.setup(object, - ACPI_REGION_DEACTIVATE, - handler_desc-> - address_space. - context, - &second_desc-> - extra. - region_context); - } + obj_pointer = + second_desc->extra.region_context; } acpi_ut_remove_reference(handler_desc); @@ -257,7 +234,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) if (obj_pointer) { ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n", obj_pointer)); - ACPI_FREE(obj_pointer); + ACPI_MEM_FREE(obj_pointer); } /* Now the object can be safely deleted */ @@ -286,7 +263,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) { union acpi_operand_object **internal_obj; - ACPI_FUNCTION_TRACE(ut_delete_internal_object_list); + ACPI_FUNCTION_TRACE("ut_delete_internal_object_list"); /* Walk the null-terminated internal list */ @@ -296,7 +273,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) /* Free the combined parameter pointer list and object array */ - ACPI_FREE(obj_list); + ACPI_MEM_FREE(obj_list); return_VOID; } @@ -319,7 +296,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) u16 count; u16 new_count; - ACPI_FUNCTION_NAME(ut_update_ref_count); + ACPI_FUNCTION_NAME("ut_update_ref_count"); if (!object) { return; @@ -329,9 +306,11 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) new_count = count; /* - * Perform the reference count action (increment, decrement, force delete) + * Perform the reference count action + * (increment, decrement, or force delete) */ switch (action) { + case REF_INCREMENT: new_count++; @@ -368,6 +347,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) if (new_count == 0) { acpi_ut_delete_internal_obj(object); } + break; case REF_FORCE_DELETE: @@ -392,10 +372,13 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) * (A deleted object will have a huge reference count) */ if (count > ACPI_MAX_REFERENCE_COUNT) { + ACPI_WARNING((AE_INFO, - "Large Reference Count (%X) in object %p", count, - object)); + "Large Reference Count (%X) in object %p", + count, object)); } + + return; } /******************************************************************************* @@ -421,7 +404,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) ******************************************************************************/ acpi_status -acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) +acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) { acpi_status status = AE_OK; union acpi_generic_state *state_list = NULL; @@ -429,10 +412,9 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) union acpi_generic_state *state; acpi_native_uint i; - ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object); + ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); while (object) { - /* Make sure that this isn't a namespace handle */ if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { @@ -447,16 +429,11 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) */ switch (ACPI_GET_OBJECT_TYPE(object)) { case ACPI_TYPE_DEVICE: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_POWER: - case ACPI_TYPE_THERMAL: - - /* Update the notify objects for these types (if present) */ - acpi_ut_update_ref_count(object->common_notify. - system_notify, action); - acpi_ut_update_ref_count(object->common_notify. - device_notify, action); + acpi_ut_update_ref_count(object->device.system_notify, + action); + acpi_ut_update_ref_count(object->device.device_notify, + action); break; case ACPI_TYPE_PACKAGE: @@ -530,11 +507,11 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) case ACPI_TYPE_REGION: default: - break; /* No subobjects for all other types */ + break; /* No subobjects */ } /* - * Now we can update the count in the main object. This can only + * Now we can update the count in the main object. This can only * happen after we update the sub-objects in case this causes the * main object to be deleted. */ @@ -579,7 +556,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) void acpi_ut_add_reference(union acpi_operand_object *object) { - ACPI_FUNCTION_TRACE_PTR(ut_add_reference, object); + ACPI_FUNCTION_TRACE_PTR("ut_add_reference", object); /* Ensure that we have a valid object */ @@ -612,11 +589,11 @@ void acpi_ut_add_reference(union acpi_operand_object *object) void acpi_ut_remove_reference(union acpi_operand_object *object) { - ACPI_FUNCTION_TRACE_PTR(ut_remove_reference, object); + ACPI_FUNCTION_TRACE_PTR("ut_remove_reference", object); /* - * Allow a NULL pointer to be passed in, just ignore it. This saves - * each caller from having to check. Also, ignore NS nodes. + * Allow a NULL pointer to be passed in, just ignore it. This saves + * each caller from having to check. Also, ignore NS nodes. * */ if (!object || @@ -636,7 +613,7 @@ void acpi_ut_remove_reference(union acpi_operand_object *object) /* * Decrement the reference count, and only actually delete the object - * if the reference count becomes 0. (Must also decrement the ref count + * if the reference count becomes 0. (Must also decrement the ref count * of all subobjects!) */ (void)acpi_ut_update_object_reference(object, REF_DECREMENT);