Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
[linux-drm-fsl-dcu.git] / drivers / acpi / utilities / utdelete.c
index 67b9f325c6fae9036628c863a97b80bf8ddda66f..f777cebdc46dd85f8ec66b491096f9d2f20af1a3 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2006, R. Byron Moore
+ * Copyright (C) 2000 - 2007, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -155,21 +155,34 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
        case ACPI_TYPE_MUTEX:
 
                ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
-                                 "***** Mutex %p, Semaphore %p\n",
-                                 object, object->mutex.semaphore));
+                                 "***** Mutex %p, OS Mutex %p\n",
+                                 object, object->mutex.os_mutex));
 
-               acpi_ex_unlink_mutex(object);
-               (void)acpi_os_delete_semaphore(object->mutex.semaphore);
+               if (object->mutex.os_mutex == acpi_gbl_global_lock_mutex) {
+
+                       /* Global Lock has extra semaphore */
+
+                       (void)
+                           acpi_os_delete_semaphore
+                           (acpi_gbl_global_lock_semaphore);
+                       acpi_gbl_global_lock_semaphore = NULL;
+
+                       acpi_os_delete_mutex(object->mutex.os_mutex);
+                       acpi_gbl_global_lock_mutex = NULL;
+               } else {
+                       acpi_ex_unlink_mutex(object);
+                       acpi_os_delete_mutex(object->mutex.os_mutex);
+               }
                break;
 
        case ACPI_TYPE_EVENT:
 
                ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
-                                 "***** Event %p, Semaphore %p\n",
-                                 object, object->event.semaphore));
+                                 "***** Event %p, OS Semaphore %p\n",
+                                 object, object->event.os_semaphore));
 
-               (void)acpi_os_delete_semaphore(object->event.semaphore);
-               object->event.semaphore = NULL;
+               (void)acpi_os_delete_semaphore(object->event.os_semaphore);
+               object->event.os_semaphore = NULL;
                break;
 
        case ACPI_TYPE_METHOD:
@@ -177,12 +190,13 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
                ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
                                  "***** Method %p\n", object));
 
-               /* Delete the method semaphore if it exists */
+               /* Delete the method mutex if it exists */
 
-               if (object->method.semaphore) {
-                       (void)acpi_os_delete_semaphore(object->method.
-                                                      semaphore);
-                       object->method.semaphore = NULL;
+               if (object->method.mutex) {
+                       acpi_os_delete_mutex(object->method.mutex->mutex.
+                                            os_mutex);
+                       acpi_ut_delete_object_desc(object->method.mutex);
+                       object->method.mutex = NULL;
                }
                break;
 
@@ -437,11 +451,16 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
                 */
                switch (ACPI_GET_OBJECT_TYPE(object)) {
                case ACPI_TYPE_DEVICE:
+               case ACPI_TYPE_PROCESSOR:
+               case ACPI_TYPE_POWER:
+               case ACPI_TYPE_THERMAL:
+
+                       /* Update the notify objects for these types (if present) */
 
-                       acpi_ut_update_ref_count(object->device.system_notify,
-                                                action);
-                       acpi_ut_update_ref_count(object->device.device_notify,
-                                                action);
+                       acpi_ut_update_ref_count(object->common_notify.
+                                                system_notify, action);
+                       acpi_ut_update_ref_count(object->common_notify.
+                                                device_notify, action);
                        break;
 
                case ACPI_TYPE_PACKAGE: