diff options
Diffstat (limited to 'drivers/acpi/utilities/utdelete.c')
-rw-r--r-- | drivers/acpi/utilities/utdelete.c | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 1db9695b0029..67b9f325c6fa 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
@@ -76,7 +76,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
76 | union acpi_operand_object *second_desc; | 76 | union acpi_operand_object *second_desc; |
77 | union acpi_operand_object *next_desc; | 77 | union acpi_operand_object *next_desc; |
78 | 78 | ||
79 | ACPI_FUNCTION_TRACE_PTR("ut_delete_internal_obj", object); | 79 | ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object); |
80 | 80 | ||
81 | if (!object) { | 81 | if (!object) { |
82 | return_VOID; | 82 | return_VOID; |
@@ -96,6 +96,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
96 | /* Free the actual string buffer */ | 96 | /* Free the actual string buffer */ |
97 | 97 | ||
98 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { | 98 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { |
99 | |||
99 | /* But only if it is NOT a pointer into an ACPI table */ | 100 | /* But only if it is NOT a pointer into an ACPI table */ |
100 | 101 | ||
101 | obj_pointer = object->string.pointer; | 102 | obj_pointer = object->string.pointer; |
@@ -111,6 +112,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
111 | /* Free the actual buffer */ | 112 | /* Free the actual buffer */ |
112 | 113 | ||
113 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { | 114 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { |
115 | |||
114 | /* But only if it is NOT a pointer into an ACPI table */ | 116 | /* But only if it is NOT a pointer into an ACPI table */ |
115 | 117 | ||
116 | obj_pointer = object->buffer.pointer; | 118 | obj_pointer = object->buffer.pointer; |
@@ -198,11 +200,22 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
198 | */ | 200 | */ |
199 | handler_desc = object->region.handler; | 201 | handler_desc = object->region.handler; |
200 | if (handler_desc) { | 202 | if (handler_desc) { |
201 | if (handler_desc->address_space. | 203 | if (handler_desc->address_space.handler_flags & |
202 | hflags & | ||
203 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { | 204 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { |
204 | obj_pointer = | 205 | |
205 | second_desc->extra.region_context; | 206 | /* Deactivate region and free region context */ |
207 | |||
208 | if (handler_desc->address_space.setup) { | ||
209 | (void)handler_desc-> | ||
210 | address_space.setup(object, | ||
211 | ACPI_REGION_DEACTIVATE, | ||
212 | handler_desc-> | ||
213 | address_space. | ||
214 | context, | ||
215 | &second_desc-> | ||
216 | extra. | ||
217 | region_context); | ||
218 | } | ||
206 | } | 219 | } |
207 | 220 | ||
208 | acpi_ut_remove_reference(handler_desc); | 221 | acpi_ut_remove_reference(handler_desc); |
@@ -234,7 +247,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
234 | if (obj_pointer) { | 247 | if (obj_pointer) { |
235 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, | 248 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
236 | "Deleting Object Subptr %p\n", obj_pointer)); | 249 | "Deleting Object Subptr %p\n", obj_pointer)); |
237 | ACPI_MEM_FREE(obj_pointer); | 250 | ACPI_FREE(obj_pointer); |
238 | } | 251 | } |
239 | 252 | ||
240 | /* Now the object can be safely deleted */ | 253 | /* Now the object can be safely deleted */ |
@@ -263,7 +276,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) | |||
263 | { | 276 | { |
264 | union acpi_operand_object **internal_obj; | 277 | union acpi_operand_object **internal_obj; |
265 | 278 | ||
266 | ACPI_FUNCTION_TRACE("ut_delete_internal_object_list"); | 279 | ACPI_FUNCTION_TRACE(ut_delete_internal_object_list); |
267 | 280 | ||
268 | /* Walk the null-terminated internal list */ | 281 | /* Walk the null-terminated internal list */ |
269 | 282 | ||
@@ -273,7 +286,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) | |||
273 | 286 | ||
274 | /* Free the combined parameter pointer list and object array */ | 287 | /* Free the combined parameter pointer list and object array */ |
275 | 288 | ||
276 | ACPI_MEM_FREE(obj_list); | 289 | ACPI_FREE(obj_list); |
277 | return_VOID; | 290 | return_VOID; |
278 | } | 291 | } |
279 | 292 | ||
@@ -296,7 +309,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
296 | u16 count; | 309 | u16 count; |
297 | u16 new_count; | 310 | u16 new_count; |
298 | 311 | ||
299 | ACPI_FUNCTION_NAME("ut_update_ref_count"); | 312 | ACPI_FUNCTION_NAME(ut_update_ref_count); |
300 | 313 | ||
301 | if (!object) { | 314 | if (!object) { |
302 | return; | 315 | return; |
@@ -306,11 +319,9 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
306 | new_count = count; | 319 | new_count = count; |
307 | 320 | ||
308 | /* | 321 | /* |
309 | * Perform the reference count action | 322 | * Perform the reference count action (increment, decrement, force delete) |
310 | * (increment, decrement, or force delete) | ||
311 | */ | 323 | */ |
312 | switch (action) { | 324 | switch (action) { |
313 | |||
314 | case REF_INCREMENT: | 325 | case REF_INCREMENT: |
315 | 326 | ||
316 | new_count++; | 327 | new_count++; |
@@ -347,7 +358,6 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
347 | if (new_count == 0) { | 358 | if (new_count == 0) { |
348 | acpi_ut_delete_internal_obj(object); | 359 | acpi_ut_delete_internal_obj(object); |
349 | } | 360 | } |
350 | |||
351 | break; | 361 | break; |
352 | 362 | ||
353 | case REF_FORCE_DELETE: | 363 | case REF_FORCE_DELETE: |
@@ -372,13 +382,10 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
372 | * (A deleted object will have a huge reference count) | 382 | * (A deleted object will have a huge reference count) |
373 | */ | 383 | */ |
374 | if (count > ACPI_MAX_REFERENCE_COUNT) { | 384 | if (count > ACPI_MAX_REFERENCE_COUNT) { |
375 | |||
376 | ACPI_WARNING((AE_INFO, | 385 | ACPI_WARNING((AE_INFO, |
377 | "Large Reference Count (%X) in object %p", | 386 | "Large Reference Count (%X) in object %p", count, |
378 | count, object)); | 387 | object)); |
379 | } | 388 | } |
380 | |||
381 | return; | ||
382 | } | 389 | } |
383 | 390 | ||
384 | /******************************************************************************* | 391 | /******************************************************************************* |
@@ -404,7 +411,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
404 | ******************************************************************************/ | 411 | ******************************************************************************/ |
405 | 412 | ||
406 | acpi_status | 413 | acpi_status |
407 | acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | 414 | acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) |
408 | { | 415 | { |
409 | acpi_status status = AE_OK; | 416 | acpi_status status = AE_OK; |
410 | union acpi_generic_state *state_list = NULL; | 417 | union acpi_generic_state *state_list = NULL; |
@@ -412,9 +419,10 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | |||
412 | union acpi_generic_state *state; | 419 | union acpi_generic_state *state; |
413 | acpi_native_uint i; | 420 | acpi_native_uint i; |
414 | 421 | ||
415 | ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); | 422 | ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object); |
416 | 423 | ||
417 | while (object) { | 424 | while (object) { |
425 | |||
418 | /* Make sure that this isn't a namespace handle */ | 426 | /* Make sure that this isn't a namespace handle */ |
419 | 427 | ||
420 | if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { | 428 | if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { |
@@ -507,11 +515,11 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | |||
507 | 515 | ||
508 | case ACPI_TYPE_REGION: | 516 | case ACPI_TYPE_REGION: |
509 | default: | 517 | default: |
510 | break; /* No subobjects */ | 518 | break; /* No subobjects for all other types */ |
511 | } | 519 | } |
512 | 520 | ||
513 | /* | 521 | /* |
514 | * Now we can update the count in the main object. This can only | 522 | * Now we can update the count in the main object. This can only |
515 | * happen after we update the sub-objects in case this causes the | 523 | * happen after we update the sub-objects in case this causes the |
516 | * main object to be deleted. | 524 | * main object to be deleted. |
517 | */ | 525 | */ |
@@ -556,7 +564,7 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | |||
556 | void acpi_ut_add_reference(union acpi_operand_object *object) | 564 | void acpi_ut_add_reference(union acpi_operand_object *object) |
557 | { | 565 | { |
558 | 566 | ||
559 | ACPI_FUNCTION_TRACE_PTR("ut_add_reference", object); | 567 | ACPI_FUNCTION_TRACE_PTR(ut_add_reference, object); |
560 | 568 | ||
561 | /* Ensure that we have a valid object */ | 569 | /* Ensure that we have a valid object */ |
562 | 570 | ||
@@ -589,11 +597,11 @@ void acpi_ut_add_reference(union acpi_operand_object *object) | |||
589 | void acpi_ut_remove_reference(union acpi_operand_object *object) | 597 | void acpi_ut_remove_reference(union acpi_operand_object *object) |
590 | { | 598 | { |
591 | 599 | ||
592 | ACPI_FUNCTION_TRACE_PTR("ut_remove_reference", object); | 600 | ACPI_FUNCTION_TRACE_PTR(ut_remove_reference, object); |
593 | 601 | ||
594 | /* | 602 | /* |
595 | * Allow a NULL pointer to be passed in, just ignore it. This saves | 603 | * Allow a NULL pointer to be passed in, just ignore it. This saves |
596 | * each caller from having to check. Also, ignore NS nodes. | 604 | * each caller from having to check. Also, ignore NS nodes. |
597 | * | 605 | * |
598 | */ | 606 | */ |
599 | if (!object || | 607 | if (!object || |
@@ -613,7 +621,7 @@ void acpi_ut_remove_reference(union acpi_operand_object *object) | |||
613 | 621 | ||
614 | /* | 622 | /* |
615 | * Decrement the reference count, and only actually delete the object | 623 | * Decrement the reference count, and only actually delete the object |
616 | * if the reference count becomes 0. (Must also decrement the ref count | 624 | * if the reference count becomes 0. (Must also decrement the ref count |
617 | * of all subobjects!) | 625 | * of all subobjects!) |
618 | */ | 626 | */ |
619 | (void)acpi_ut_update_object_reference(object, REF_DECREMENT); | 627 | (void)acpi_ut_update_object_reference(object, REF_DECREMENT); |