]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/utilities/utdelete.c
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux...
[linux-2.6-omap-h63xx.git] / drivers / acpi / utilities / utdelete.c
index 0bb4b59b28049e7ee2853faf687bfcfd42563cb6..9d3f1149ba217736e5ff8b376445e522f6f8a79f 100644 (file)
@@ -155,21 +155,30 @@ 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_GLOBAL_LOCK) {
+                       acpi_ex_unlink_mutex(object);
+                       acpi_os_delete_mutex(object->mutex.os_mutex);
+               } else {
+                       /* Global Lock "mutex" is actually a counting semaphore */
+
+                       (void)
+                           acpi_os_delete_semaphore
+                           (acpi_gbl_global_lock_semaphore);
+                       acpi_gbl_global_lock_semaphore = NULL;
+               }
                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 +186,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;
 
@@ -319,11 +329,9 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
        new_count = count;
 
        /*
-        * Perform the reference count action
-        * (increment, decrement, or force delete)
+        * Perform the reference count action (increment, decrement, force delete)
         */
        switch (action) {
-
        case REF_INCREMENT:
 
                new_count++;
@@ -360,7 +368,6 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
                if (new_count == 0) {
                        acpi_ut_delete_internal_obj(object);
                }
-
                break;
 
        case REF_FORCE_DELETE:
@@ -385,13 +392,10 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
         * (A deleted object will have a huge reference count)
         */
        if (count > ACPI_MAX_REFERENCE_COUNT) {
-
                ACPI_WARNING((AE_INFO,
-                             "Large Reference Count (%X) in object %p",
-                             count, object));
+                             "Large Reference Count (%X) in object %p", count,
+                             object));
        }
-
-       return;
 }
 
 /*******************************************************************************
@@ -417,7 +421,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
  ******************************************************************************/
 
 acpi_status
-acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
+acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
 {
        acpi_status status = AE_OK;
        union acpi_generic_state *state_list = NULL;
@@ -443,11 +447,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:
@@ -521,11 +530,11 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
 
                case ACPI_TYPE_REGION:
                default:
-                       break;  /* No subobjects */
+                       break;  /* No subobjects for all other types */
                }
 
                /*
-                * Now we can update the count in the main object.  This can only
+                * 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.
                 */
@@ -606,8 +615,8 @@ void acpi_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.
+        * 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 ||
@@ -627,7 +636,7 @@ void acpi_ut_remove_reference(union acpi_operand_object *object)
 
        /*
         * Decrement the reference count, and only actually delete the object
-        * if the reference count becomes 0.  (Must also decrement the ref count
+        * if the reference count becomes 0. (Must also decrement the ref count
         * of all subobjects!)
         */
        (void)acpi_ut_update_object_reference(object, REF_DECREMENT);