From: Ramon Casellas Hi, Original patch from Li, Shaohua for 2.4.22/23, ported to 2.6.0-test5-mm3 (with acpi 20030916), please test. [1] Bug Report ---------------------------------------------------------- http://sourceforge.net/mailarchive/forum.php?thread_id=3144527&forum_id=6102 [2] Answer ----------------------------------------------------------- > From: Li, Shaohua > RE: Re: IBM Thinkpad and ACPI 20030916 for 2.4.23-pre4 2003-09-17 17:28 >Hi, > Patch for the battery error is available in OSDL bugzilla #1038. Pl. try. > Thanks, > Shaohua ----------------------------------------------------------- Note: Works for me. 25-akpm/drivers/acpi/utilities/utdelete.c | 36 +++++++++++++++++++++++++++--- 1 files changed, 33 insertions(+), 3 deletions(-) diff -puN drivers/acpi/utilities/utdelete.c~acpi-thinkpad-fix drivers/acpi/utilities/utdelete.c --- 25/drivers/acpi/utilities/utdelete.c~acpi-thinkpad-fix Fri Sep 19 11:11:57 2003 +++ 25-akpm/drivers/acpi/utilities/utdelete.c Fri Sep 19 11:11:57 2003 @@ -417,6 +417,8 @@ acpi_ut_update_object_reference ( 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); @@ -447,9 +449,16 @@ acpi_ut_update_object_reference ( */ 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 +476,9 @@ acpi_ut_update_object_reference ( */ 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; } @@ -478,6 +490,9 @@ acpi_ut_update_object_reference ( status = acpi_ut_create_update_state_and_push ( object->buffer_field.buffer_obj, action, &state_list); + 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; if (ACPI_FAILURE (status)) { goto error_exit; } @@ -491,6 +506,9 @@ acpi_ut_update_object_reference ( 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 +519,18 @@ acpi_ut_update_object_reference ( 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 +541,18 @@ acpi_ut_update_object_reference ( 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; _