Merge branch 'sundance'
[powerpc.git] / drivers / acpi / utilities / utalloc.c
index 068450b..03b0044 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@
 ACPI_MODULE_NAME("utalloc")
 
 /* Local prototypes */
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation);
 
 static acpi_status
@@ -58,9 +58,7 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *address,
 static acpi_status
 acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
                          u32 component, char *module, u32 line);
-#endif                         /* ACPI_DBG_TRACK_ALLOCATIONS */
 
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 static acpi_status
 acpi_ut_create_list(char *list_name,
                    u16 object_size, struct acpi_memory_list **return_cache);
@@ -303,8 +301,8 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
        /* Check for an inadvertent size of zero bytes */
 
        if (!size) {
-               _ACPI_REPORT_ERROR(module, line, component,
-                                  ("ut_allocate: Attempt to allocate zero bytes\n"));
+               ACPI_ERROR((module, line,
+                           "ut_allocate: Attempt to allocate zero bytes, allocating 1 byte"));
                size = 1;
        }
 
@@ -312,9 +310,9 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
        if (!allocation) {
                /* Report allocation error */
 
-               _ACPI_REPORT_ERROR(module, line, component,
-                                  ("ut_allocate: Could not allocate size %X\n",
-                                   (u32) size));
+               ACPI_ERROR((module, line,
+                           "ut_allocate: Could not allocate size %X",
+                           (u32) size));
 
                return_PTR(NULL);
        }
@@ -346,18 +344,17 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
        /* Check for an inadvertent size of zero bytes */
 
        if (!size) {
-               _ACPI_REPORT_ERROR(module, line, component,
-                                  ("ut_callocate: Attempt to allocate zero bytes\n"));
-               return_PTR(NULL);
+               ACPI_ERROR((module, line,
+                           "Attempt to allocate zero bytes, allocating 1 byte"));
+               size = 1;
        }
 
        allocation = acpi_os_allocate(size);
        if (!allocation) {
                /* Report allocation error */
 
-               _ACPI_REPORT_ERROR(module, line, component,
-                                  ("ut_callocate: Could not allocate size %X\n",
-                                   (u32) size));
+               ACPI_ERROR((module, line,
+                           "Could not allocate size %X", (u32) size));
                return_PTR(NULL);
        }
 
@@ -482,9 +479,8 @@ void *acpi_ut_callocate_and_track(acpi_size size,
        if (!allocation) {
                /* Report allocation error */
 
-               _ACPI_REPORT_ERROR(module, line, component,
-                                  ("ut_callocate: Could not allocate size %X\n",
-                                   (u32) size));
+               ACPI_ERROR((module, line,
+                           "Could not allocate size %X", (u32) size));
                return (NULL);
        }
 
@@ -526,8 +522,7 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
        ACPI_FUNCTION_TRACE_PTR("ut_free", allocation);
 
        if (NULL == allocation) {
-               _ACPI_REPORT_ERROR(module, line, component,
-                                  ("acpi_ut_free: Attempt to delete a NULL address\n"));
+               ACPI_ERROR((module, line, "Attempt to delete a NULL address"));
 
                return_VOID;
        }
@@ -542,14 +537,11 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
        status = acpi_ut_remove_allocation(debug_block,
                                           component, module, line);
        if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Could not free memory, %s\n",
-                                 acpi_format_exception(status)));
+               ACPI_EXCEPTION((AE_INFO, status, "Could not free memory"));
        }
 
        acpi_os_free(debug_block);
-
        ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation));
-
        return_VOID;
 }
 
@@ -626,10 +618,12 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
         */
        element = acpi_ut_find_allocation(allocation);
        if (element) {
-               ACPI_REPORT_ERROR(("ut_track_allocation: Allocation already present in list! (%p)\n", allocation));
+               ACPI_ERROR((AE_INFO,
+                           "ut_track_allocation: Allocation already present in list! (%p)",
+                           allocation));
 
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Element %p Address %p\n",
-                                 element, allocation));
+               ACPI_ERROR((AE_INFO, "Element %p Address %p",
+                           element, allocation));
 
                goto unlock_and_exit;
        }
@@ -689,8 +683,8 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
        if (NULL == mem_list->list_head) {
                /* No allocations! */
 
-               _ACPI_REPORT_ERROR(module, line, component,
-                                  ("ut_remove_allocation: Empty allocation list, nothing to free!\n"));
+               ACPI_ERROR((module, line,
+                           "Empty allocation list, nothing to free!"));
 
                return_ACPI_STATUS(AE_OK);
        }
@@ -865,12 +859,11 @@ void acpi_ut_dump_allocations(u32 component, char *module)
        /* Print summary */
 
        if (!num_outstanding) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "No outstanding allocations.\n"));
+               ACPI_INFO((AE_INFO, "No outstanding allocations"));
        } else {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "%d(%X) Outstanding allocations\n",
-                                 num_outstanding, num_outstanding));
+               ACPI_ERROR((AE_INFO,
+                           "%d(%X) Outstanding allocations",
+                           num_outstanding, num_outstanding));
        }
 
        return_VOID;