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

📄 utdelete.c

📁 h内核
💻 C
📖 第 1 页 / 共 2 页
字号:
			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;	u32                             i;	union acpi_generic_state         *state_list = NULL;	union acpi_generic_state         *state;	union acpi_operand_object        *tmp;	ACPI_FUNCTION_TRACE_PTR ("ut_update_object_reference", object);	/* Ignore a null object ptr */	if (!object) {		return_ACPI_STATUS (AE_OK);	}	/* 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);	}	state = acpi_ut_create_update_state (object, action);	while (state) {		object = state->update.object;		action = state->update.value;		acpi_ut_delete_generic_state (state);		/*		 * 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:			tmp = object->device.system_notify;			if (tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)				object->device.system_notify = NULL;			acpi_ut_update_ref_count (tmp, action);			tmp = object->device.device_notify;			if (tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)				object->device.device_notify = NULL;			acpi_ut_update_ref_count (tmp, 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, etc.			 */			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;				}				tmp = object->package.elements[i];				if (tmp && (tmp->common.reference_count <= 1)  && action == REF_DECREMENT)					object->package.elements[i] = NULL;			}			break;		case ACPI_TYPE_BUFFER_FIELD:			status = acpi_ut_create_update_state_and_push (					 object->buffer_field.buffer_obj, action, &state_list);			if (ACPI_FAILURE (status)) {				goto error_exit;			}			tmp = object->buffer_field.buffer_obj;			if ( tmp && (tmp->common.reference_count <= 1)  && action == REF_DECREMENT)				object->buffer_field.buffer_obj = NULL;			break;		case ACPI_TYPE_LOCAL_REGION_FIELD:			status = acpi_ut_create_update_state_and_push (					 object->field.region_obj, action, &state_list);			if (ACPI_FAILURE (status)) {				goto error_exit;			}			tmp = object->field.region_obj;			if ( tmp && (tmp->common.reference_count <= 1)  && action == REF_DECREMENT)				object->field.region_obj = NULL;		   break;		case ACPI_TYPE_LOCAL_BANK_FIELD:			status = acpi_ut_create_update_state_and_push (					 object->bank_field.bank_obj, action, &state_list);			if (ACPI_FAILURE (status)) {				goto error_exit;			}			tmp = object->bank_field.bank_obj;			if ( tmp && (tmp->common.reference_count <= 1)  && action == REF_DECREMENT)				object->bank_field.bank_obj = NULL;			status = acpi_ut_create_update_state_and_push (					 object->bank_field.region_obj, action, &state_list);			if (ACPI_FAILURE (status)) {				goto error_exit;			}			tmp = object->bank_field.region_obj;			if ( tmp && (tmp->common.reference_count <= 1)  && action == REF_DECREMENT)				object->bank_field.region_obj = NULL;			break;		case ACPI_TYPE_LOCAL_INDEX_FIELD:			status = acpi_ut_create_update_state_and_push (					 object->index_field.index_obj, action, &state_list);			if (ACPI_FAILURE (status)) {				goto error_exit;			}			tmp = object->index_field.index_obj;			if ( tmp && (tmp->common.reference_count <= 1)  && action == REF_DECREMENT)				object->index_field.index_obj = NULL;			status = acpi_ut_create_update_state_and_push (					 object->index_field.data_obj, action, &state_list);			if (ACPI_FAILURE (status)) {				goto error_exit;			}			tmp = object->index_field.data_obj;			if ( tmp && (tmp->common.reference_count <= 1)  && action == REF_DECREMENT)				object->index_field.data_obj = NULL;			break;		case ACPI_TYPE_REGION:		case ACPI_TYPE_LOCAL_REFERENCE:		default:			/* No subobjects */			break;		}		/*		 * 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);		/* Move on to the next object to be updated */		state = acpi_ut_pop_generic_state (&state_list);	}	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 * ******************************************************************************/voidacpi_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 * ******************************************************************************/voidacpi_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 + -