aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities/utcache.c')
-rw-r--r--drivers/acpi/utilities/utcache.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c
index 2177cb1ef2c4..56270a30718a 100644
--- a/drivers/acpi/utilities/utcache.c
+++ b/drivers/acpi/utilities/utcache.c
@@ -118,13 +118,14 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache)
118 /* Walk the list of objects in this cache */ 118 /* Walk the list of objects in this cache */
119 119
120 while (cache->list_head) { 120 while (cache->list_head) {
121
121 /* Delete and unlink one cached state object */ 122 /* Delete and unlink one cached state object */
122 123
123 next = *(ACPI_CAST_INDIRECT_PTR(char, 124 next = *(ACPI_CAST_INDIRECT_PTR(char,
124 &(((char *)cache-> 125 &(((char *)cache->
125 list_head)[cache-> 126 list_head)[cache->
126 link_offset]))); 127 link_offset])));
127 ACPI_MEM_FREE(cache->list_head); 128 ACPI_FREE(cache->list_head);
128 129
129 cache->list_head = next; 130 cache->list_head = next;
130 cache->current_depth--; 131 cache->current_depth--;
@@ -193,7 +194,7 @@ acpi_os_release_object(struct acpi_memory_list * cache, void *object)
193 /* If cache is full, just free this object */ 194 /* If cache is full, just free this object */
194 195
195 if (cache->current_depth >= cache->max_depth) { 196 if (cache->current_depth >= cache->max_depth) {
196 ACPI_MEM_FREE(object); 197 ACPI_FREE(object);
197 ACPI_MEM_TRACKING(cache->total_freed++); 198 ACPI_MEM_TRACKING(cache->total_freed++);
198 } 199 }
199 200
@@ -243,7 +244,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
243 acpi_status status; 244 acpi_status status;
244 void *object; 245 void *object;
245 246
246 ACPI_FUNCTION_NAME("os_acquire_object"); 247 ACPI_FUNCTION_NAME(os_acquire_object);
247 248
248 if (!cache) { 249 if (!cache) {
249 return (NULL); 250 return (NULL);
@@ -259,6 +260,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
259 /* Check the cache first */ 260 /* Check the cache first */
260 261
261 if (cache->list_head) { 262 if (cache->list_head) {
263
262 /* There is an object available, use it */ 264 /* There is an object available, use it */
263 265
264 object = cache->list_head; 266 object = cache->list_head;
@@ -270,9 +272,9 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
270 cache->current_depth--; 272 cache->current_depth--;
271 273
272 ACPI_MEM_TRACKING(cache->hits++); 274 ACPI_MEM_TRACKING(cache->hits++);
273 ACPI_MEM_TRACKING(ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 275 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
274 "Object %p from %s cache\n", 276 "Object %p from %s cache\n", object,
275 object, cache->list_name))); 277 cache->list_name));
276 278
277 status = acpi_ut_release_mutex(ACPI_MTX_CACHES); 279 status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
278 if (ACPI_FAILURE(status)) { 280 if (ACPI_FAILURE(status)) {
@@ -287,14 +289,14 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
287 289
288 ACPI_MEM_TRACKING(cache->total_allocated++); 290 ACPI_MEM_TRACKING(cache->total_allocated++);
289 291
290 /* Avoid deadlock with ACPI_MEM_CALLOCATE */ 292 /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
291 293
292 status = acpi_ut_release_mutex(ACPI_MTX_CACHES); 294 status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
293 if (ACPI_FAILURE(status)) { 295 if (ACPI_FAILURE(status)) {
294 return (NULL); 296 return (NULL);
295 } 297 }
296 298
297 object = ACPI_MEM_CALLOCATE(cache->object_size); 299 object = ACPI_ALLOCATE_ZEROED(cache->object_size);
298 if (!object) { 300 if (!object) {
299 return (NULL); 301 return (NULL);
300 } 302 }