⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utdelete.c

📁 linux-2.6.15.6
💻 C
📖 第 1 页 / 共 2 页
字号:
	case REF_INCREMENT:		new_count++;		object->common.reference_count = new_count;		ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,				  "Obj %p Refs=%X, [Incremented]\n",				  object, new_count));		break;	case REF_DECREMENT:		if (count < 1) {			ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,					  "Obj %p Refs=%X, can't decrement! (Set to 0)\n",					  object, new_count));			new_count = 0;		} else {			new_count--;			ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,					  "Obj %p Refs=%X, [Decremented]\n",					  object, new_count));		}		if (ACPI_GET_OBJECT_TYPE(object) == ACPI_TYPE_METHOD) {			ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,					  "Method Obj %p Refs=%X, [Decremented]\n",					  object, new_count));		}		object->common.reference_count = new_count;		if (new_count == 0) {			acpi_ut_delete_internal_obj(object);		}		break;	case REF_FORCE_DELETE:		ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,				  "Obj %p Refs=%X, Force delete! (Set to 0)\n",				  object, count));		new_count = 0;		object->common.reference_count = new_count;		acpi_ut_delete_internal_obj(object);		break;	default:		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown action (%X)\n",				  action));		break;	}	/*	 * Sanity check the reference count, for debug purposes only.	 * (A deleted object will have a huge reference count)	 */	if (count > ACPI_MAX_REFERENCE_COUNT) {		ACPI_DEBUG_PRINT((ACPI_DB_WARN,				  "**** Warning **** Large Reference Count (%X) in object %p\n\n",				  count, object));	}	return;}/******************************************************************************* * * FUNCTION:    acpi_ut_update_object_reference * * PARAMETERS:  Object              - Increment ref count for this object *                                    and all sub-objects *              Action              - Either REF_INCREMENT or REF_DECREMENT or *                                    REF_FORCE_DELETE * * RETURN:      Status * * DESCRIPTION: Increment the object reference count * * Object references are incremented when: * 1) An object is attached to a Node (namespace object) * 2) An object is copied (all subobjects must be incremented) * * Object references are decremented when: * 1) An object is detached from an Node * ******************************************************************************/acpi_statusacpi_ut_update_object_reference(union acpi_operand_object * object, u16 action){	acpi_status status = AE_OK;	union acpi_generic_state *state_list = NULL;	union acpi_operand_object *next_object = NULL;	union acpi_generic_state *state;	acpi_native_uint i;	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) {			ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,					  "Object %p is NS handle\n", object));			return_ACPI_STATUS(AE_OK);		}		/*		 * All sub-objects must have their reference count incremented also.		 * Different object types have different subobjects.		 */		switch (ACPI_GET_OBJECT_TYPE(object)) {		case ACPI_TYPE_DEVICE:			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:			/*			 * We must update all the sub-objects of the package,			 * each of whom may have their own sub-objects.			 */			for (i = 0; i < object->package.count; i++) {				/*				 * Push each element onto the stack for later processing.				 * Note: There can be null elements within the package,				 * these are simply ignored				 */				status =				    acpi_ut_create_update_state_and_push				    (object->package.elements[i], action,				     &state_list);				if (ACPI_FAILURE(status)) {					goto error_exit;				}			}			break;		case ACPI_TYPE_BUFFER_FIELD:			next_object = object->buffer_field.buffer_obj;			break;		case ACPI_TYPE_LOCAL_REGION_FIELD:			next_object = object->field.region_obj;			break;		case ACPI_TYPE_LOCAL_BANK_FIELD:			next_object = object->bank_field.bank_obj;			status =			    acpi_ut_create_update_state_and_push(object->								 bank_field.								 region_obj,								 action,								 &state_list);			if (ACPI_FAILURE(status)) {				goto error_exit;			}			break;		case ACPI_TYPE_LOCAL_INDEX_FIELD:			next_object = object->index_field.index_obj;			status =			    acpi_ut_create_update_state_and_push(object->								 index_field.								 data_obj,								 action,								 &state_list);			if (ACPI_FAILURE(status)) {				goto error_exit;			}			break;		case ACPI_TYPE_LOCAL_REFERENCE:			/*			 * The target of an Index (a package, string, or buffer) must track			 * changes to the ref count of the index.			 */			if (object->reference.opcode == AML_INDEX_OP) {				next_object = object->reference.object;			}			break;		case ACPI_TYPE_REGION:		default:			break;	/* No subobjects */		}		/*		 * 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.		 */		acpi_ut_update_ref_count(object, action);		object = NULL;		/* Move on to the next object to be updated */		if (next_object) {			object = next_object;			next_object = NULL;		} else if (state_list) {			state = acpi_ut_pop_generic_state(&state_list);			object = state->update.object;			acpi_ut_delete_generic_state(state);		}	}	return_ACPI_STATUS(AE_OK);      error_exit:	ACPI_REPORT_ERROR(("Could not update object reference count, %s\n",			   acpi_format_exception(status)));	return_ACPI_STATUS(status);}/******************************************************************************* * * FUNCTION:    acpi_ut_add_reference * * PARAMETERS:  Object          - Object whose reference count is to be *                                incremented * * RETURN:      None * * DESCRIPTION: Add one reference to an ACPI object * ******************************************************************************/void acpi_ut_add_reference(union acpi_operand_object *object){	ACPI_FUNCTION_TRACE_PTR("ut_add_reference", object);	/* Ensure that we have a valid object */	if (!acpi_ut_valid_internal_object(object)) {		return_VOID;	}	ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,			  "Obj %p Current Refs=%X [To Be Incremented]\n",			  object, object->common.reference_count));	/* Increment the reference count */	(void)acpi_ut_update_object_reference(object, REF_INCREMENT);	return_VOID;}/******************************************************************************* * * FUNCTION:    acpi_ut_remove_reference * * PARAMETERS:  Object         - Object whose ref count will be decremented * * RETURN:      None * * DESCRIPTION: Decrement the reference count of an ACPI internal object * ******************************************************************************/void acpi_ut_remove_reference(union acpi_operand_object *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.	 *	 */	if (!object ||	    (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED)) {		return_VOID;	}	/* Ensure that we have a valid object */	if (!acpi_ut_valid_internal_object(object)) {		return_VOID;	}	ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,			  "Obj %p Current Refs=%X [To Be Decremented]\n",			  object, object->common.reference_count));	/*	 * Decrement the reference count, and only actually delete the object	 * if the reference count becomes 0.  (Must also decrement the ref count	 * of all subobjects!)	 */	(void)acpi_ut_update_object_reference(object, REF_DECREMENT);	return_VOID;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -