diff -ur linux-2.4.21/drivers/acpi/utilities/utdelete.c linux-2.4.21.new/drivers/acpi/utilities/utdelete.c --- linux-2.4.21/drivers/acpi/utilities/utdelete.c 2003-08-22 10:17:26.000000000 +0800 +++ linux-2.4.21.new/drivers/acpi/utilities/utdelete.c 2003-08-22 15:54:09.000000000 +0800 @@ -416,7 +416,7 @@ u32 i; union acpi_generic_state *state_list = NULL; union acpi_generic_state *state; - + union acpi_operand_object *tmp; ACPI_FUNCTION_TRACE_PTR ("ut_update_object_reference", object); @@ -448,8 +448,15 @@ switch (ACPI_GET_OBJECT_TYPE (object)) { case ACPI_TYPE_DEVICE: - acpi_ut_update_ref_count (object->device.system_notify, action); - acpi_ut_update_ref_count (object->device.device_notify, action); + tmp = object->device.system_notify; + if(tmp && tmp->common.reference_count<=1 && action == REF_DECREMENT) + object->device.system_notify = NULL; + acpi_ut_update_ref_count (tmp, action); + + tmp = object->device.device_notify; + if(tmp && tmp->common.reference_count <=1 && action == REF_DECREMENT) + object->device.device_notify = NULL; + acpi_ut_update_ref_count (tmp, action); break; @@ -467,6 +474,9 @@ */ status = acpi_ut_create_update_state_and_push ( object->package.elements[i], action, &state_list); + tmp = object->package.elements[i]; + if(tmp && tmp->common.reference_count<=1 && action == REF_DECREMENT) /*reference count didn't refresh now*/ + object->package.elements[i] = NULL; if (ACPI_FAILURE (status)) { goto error_exit; } @@ -481,6 +491,9 @@ if (ACPI_FAILURE (status)) { goto error_exit; } + tmp = object->buffer_field.buffer_obj; + if( tmp && tmp->common.reference_count <=1 && action == REF_DECREMENT)/*reference count didn't refresh now*/ + object->buffer_field.buffer_obj = NULL; break; @@ -491,6 +504,9 @@ if (ACPI_FAILURE (status)) { goto error_exit; } + tmp = object->field.region_obj; + if( tmp && tmp->common.reference_count <=1 && action == REF_DECREMENT)/*reference count didn't refresh now*/ + object->field.region_obj = NULL; break; @@ -501,12 +517,18 @@ if (ACPI_FAILURE (status)) { goto error_exit; } + tmp = object->bank_field.bank_obj; + if( tmp && tmp->common.reference_count <=1 && action == REF_DECREMENT)/*reference count didn't refresh now*/ + object->bank_field.bank_obj = NULL; status = acpi_ut_create_update_state_and_push ( object->bank_field.region_obj, action, &state_list); if (ACPI_FAILURE (status)) { goto error_exit; } + tmp = object->bank_field.region_obj; + if( tmp && tmp->common.reference_count <=1 && action == REF_DECREMENT)/*reference count didn't refresh now*/ + object->bank_field.region_obj = NULL; break; @@ -517,12 +539,18 @@ if (ACPI_FAILURE (status)) { goto error_exit; } + tmp = object->index_field.index_obj; + if( tmp && tmp->common.reference_count <=1 && action == REF_DECREMENT)/*reference count didn't refresh now*/ + object->index_field.index_obj = NULL; status = acpi_ut_create_update_state_and_push ( object->index_field.data_obj, action, &state_list); if (ACPI_FAILURE (status)) { goto error_exit; } + tmp = object->index_field.data_obj; + if( tmp && tmp->common.reference_count <=1 && action == REF_DECREMENT)/*reference count didn't refresh now*/ + object->index_field.data_obj = NULL; break;