ACPI_STATUS AcpiOsReleaseObject ( ACPI_MEMORY_LIST *Cache, void *Object) { ACPI_STATUS Status; ACPI_FUNCTION_ENTRY (); if (!Cache || !Object) { return (AE_BAD_PARAMETER); } /* If cache is full, just free this object */ if (Cache->CurrentDepth >= Cache->MaxDepth) { ACPI_FREE (Object); ACPI_MEM_TRACKING (Cache->TotalFreed++); } /* Otherwise put this object back into the cache */ else { Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES); if (ACPI_FAILURE (Status)) { return (Status); } /* Mark the object as cached */ ACPI_MEMSET (Object, 0xCA, Cache->ObjectSize); ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED); /* Put the object at the head of the cache list */ ACPI_SET_DESCRIPTOR_PTR (Object, Cache->ListHead); Cache->ListHead = Object; Cache->CurrentDepth++; (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); } return (AE_OK); }
acpi_status acpi_os_release_object(struct acpi_memory_list * cache, void *object) { acpi_status status; ACPI_FUNCTION_ENTRY(); if (!cache || !object) { return (AE_BAD_PARAMETER); } /* If cache is full, just free this object */ if (cache->current_depth >= cache->max_depth) { ACPI_FREE(object); ACPI_MEM_TRACKING(cache->total_freed++); } /* Otherwise put this object back into the cache */ else { status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); if (ACPI_FAILURE(status)) { return (status); } /* Mark the object as cached */ ACPI_MEMSET(object, 0xCA, cache->object_size); ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_CACHED); /* Put the object at the head of the cache list */ ACPI_SET_DESCRIPTOR_PTR(object, cache->list_head); cache->list_head = object; cache->current_depth++; (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); } return (AE_OK); }