utdelete.c (241973) | utdelete.c (243347) |
---|---|
1/******************************************************************************* 2 * 3 * Module Name: utdelete - object deletion and reference count utilities 4 * 5 ******************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2012, Intel Corp. --- 354 unchanged lines hidden (view full) --- 363 364void 365AcpiUtDeleteInternalObjectList ( 366 ACPI_OPERAND_OBJECT **ObjList) 367{ 368 ACPI_OPERAND_OBJECT **InternalObj; 369 370 | 1/******************************************************************************* 2 * 3 * Module Name: utdelete - object deletion and reference count utilities 4 * 5 ******************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2012, Intel Corp. --- 354 unchanged lines hidden (view full) --- 363 364void 365AcpiUtDeleteInternalObjectList ( 366 ACPI_OPERAND_OBJECT **ObjList) 367{ 368 ACPI_OPERAND_OBJECT **InternalObj; 369 370 |
371 ACPI_FUNCTION_TRACE (UtDeleteInternalObjectList); | 371 ACPI_FUNCTION_NAME (UtDeleteInternalObjectList); |
372 373 374 /* Walk the null-terminated internal list */ 375 376 for (InternalObj = ObjList; *InternalObj; InternalObj++) 377 { 378 AcpiUtRemoveReference (*InternalObj); 379 } 380 381 /* Free the combined parameter pointer list and object array */ 382 383 ACPI_FREE (ObjList); | 372 373 374 /* Walk the null-terminated internal list */ 375 376 for (InternalObj = ObjList; *InternalObj; InternalObj++) 377 { 378 AcpiUtRemoveReference (*InternalObj); 379 } 380 381 /* Free the combined parameter pointer list and object array */ 382 383 ACPI_FREE (ObjList); |
384 return_VOID; | 384 return; |
385} 386 387 388/******************************************************************************* 389 * 390 * FUNCTION: AcpiUtUpdateRefCount 391 * 392 * PARAMETERS: Object - Object whose ref count is to be updated --- 130 unchanged lines hidden (view full) --- 523 ACPI_STATUS Status = AE_OK; 524 ACPI_GENERIC_STATE *StateList = NULL; 525 ACPI_OPERAND_OBJECT *NextObject = NULL; 526 ACPI_OPERAND_OBJECT *PrevObject; 527 ACPI_GENERIC_STATE *State; 528 UINT32 i; 529 530 | 385} 386 387 388/******************************************************************************* 389 * 390 * FUNCTION: AcpiUtUpdateRefCount 391 * 392 * PARAMETERS: Object - Object whose ref count is to be updated --- 130 unchanged lines hidden (view full) --- 523 ACPI_STATUS Status = AE_OK; 524 ACPI_GENERIC_STATE *StateList = NULL; 525 ACPI_OPERAND_OBJECT *NextObject = NULL; 526 ACPI_OPERAND_OBJECT *PrevObject; 527 ACPI_GENERIC_STATE *State; 528 UINT32 i; 529 530 |
531 ACPI_FUNCTION_TRACE_PTR (UtUpdateObjectReference, Object); | 531 ACPI_FUNCTION_NAME (UtUpdateObjectReference); |
532 533 534 while (Object) 535 { 536 /* Make sure that this isn't a namespace handle */ 537 538 if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED) 539 { 540 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, 541 "Object %p is NS handle\n", Object)); | 532 533 534 while (Object) 535 { 536 /* Make sure that this isn't a namespace handle */ 537 538 if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED) 539 { 540 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, 541 "Object %p is NS handle\n", Object)); |
542 return_ACPI_STATUS (AE_OK); | 542 return (AE_OK); |
543 } 544 545 /* 546 * All sub-objects must have their reference count incremented also. 547 * Different object types have different subobjects. 548 */ 549 switch (Object->Common.Type) 550 { --- 21 unchanged lines hidden (view full) --- 572 case ACPI_TYPE_PACKAGE: 573 /* 574 * We must update all the sub-objects of the package, 575 * each of whom may have their own sub-objects. 576 */ 577 for (i = 0; i < Object->Package.Count; i++) 578 { 579 /* | 543 } 544 545 /* 546 * All sub-objects must have their reference count incremented also. 547 * Different object types have different subobjects. 548 */ 549 switch (Object->Common.Type) 550 { --- 21 unchanged lines hidden (view full) --- 572 case ACPI_TYPE_PACKAGE: 573 /* 574 * We must update all the sub-objects of the package, 575 * each of whom may have their own sub-objects. 576 */ 577 for (i = 0; i < Object->Package.Count; i++) 578 { 579 /* |
580 * Push each element onto the stack for later processing. 581 * Note: There can be null elements within the package, 582 * these are simply ignored | 580 * Null package elements are legal and can be simply 581 * ignored. |
583 */ | 582 */ |
584 Status = AcpiUtCreateUpdateStateAndPush ( 585 Object->Package.Elements[i], Action, &StateList); 586 if (ACPI_FAILURE (Status)) | 583 NextObject = Object->Package.Elements[i]; 584 if (!NextObject) |
587 { | 585 { |
588 goto ErrorExit; | 586 continue; |
589 } | 587 } |
588 589 switch (NextObject->Common.Type) 590 { 591 case ACPI_TYPE_INTEGER: 592 case ACPI_TYPE_STRING: 593 case ACPI_TYPE_BUFFER: 594 /* 595 * For these very simple sub-objects, we can just 596 * update the reference count here and continue. 597 * Greatly increases performance of this operation. 598 */ 599 AcpiUtUpdateRefCount (NextObject, Action); 600 break; 601 602 default: 603 /* 604 * For complex sub-objects, push them onto the stack 605 * for later processing (this eliminates recursion.) 606 */ 607 Status = AcpiUtCreateUpdateStateAndPush ( 608 NextObject, Action, &StateList); 609 if (ACPI_FAILURE (Status)) 610 { 611 goto ErrorExit; 612 } 613 break; 614 } |
|
590 } | 615 } |
616 NextObject = NULL; |
|
591 break; 592 593 case ACPI_TYPE_BUFFER_FIELD: 594 595 NextObject = Object->BufferField.BufferObj; 596 break; 597 598 case ACPI_TYPE_LOCAL_REGION_FIELD: --- 59 unchanged lines hidden (view full) --- 658 else if (StateList) 659 { 660 State = AcpiUtPopGenericState (&StateList); 661 Object = State->Update.Object; 662 AcpiUtDeleteGenericState (State); 663 } 664 } 665 | 617 break; 618 619 case ACPI_TYPE_BUFFER_FIELD: 620 621 NextObject = Object->BufferField.BufferObj; 622 break; 623 624 case ACPI_TYPE_LOCAL_REGION_FIELD: --- 59 unchanged lines hidden (view full) --- 684 else if (StateList) 685 { 686 State = AcpiUtPopGenericState (&StateList); 687 Object = State->Update.Object; 688 AcpiUtDeleteGenericState (State); 689 } 690 } 691 |
666 return_ACPI_STATUS (AE_OK); | 692 return (AE_OK); |
667 668 669ErrorExit: 670 671 ACPI_EXCEPTION ((AE_INFO, Status, 672 "Could not update object reference count")); 673 674 /* Free any stacked Update State objects */ 675 676 while (StateList) 677 { 678 State = AcpiUtPopGenericState (&StateList); 679 AcpiUtDeleteGenericState (State); 680 } 681 | 693 694 695ErrorExit: 696 697 ACPI_EXCEPTION ((AE_INFO, Status, 698 "Could not update object reference count")); 699 700 /* Free any stacked Update State objects */ 701 702 while (StateList) 703 { 704 State = AcpiUtPopGenericState (&StateList); 705 AcpiUtDeleteGenericState (State); 706 } 707 |
682 return_ACPI_STATUS (Status); | 708 return (Status); |
683} 684 685 686/******************************************************************************* 687 * 688 * FUNCTION: AcpiUtAddReference 689 * 690 * PARAMETERS: Object - Object whose reference count is to be --- 5 unchanged lines hidden (view full) --- 696 * 697 ******************************************************************************/ 698 699void 700AcpiUtAddReference ( 701 ACPI_OPERAND_OBJECT *Object) 702{ 703 | 709} 710 711 712/******************************************************************************* 713 * 714 * FUNCTION: AcpiUtAddReference 715 * 716 * PARAMETERS: Object - Object whose reference count is to be --- 5 unchanged lines hidden (view full) --- 722 * 723 ******************************************************************************/ 724 725void 726AcpiUtAddReference ( 727 ACPI_OPERAND_OBJECT *Object) 728{ 729 |
704 ACPI_FUNCTION_TRACE_PTR (UtAddReference, Object); | 730 ACPI_FUNCTION_NAME (UtAddReference); |
705 706 707 /* Ensure that we have a valid object */ 708 709 if (!AcpiUtValidInternalObject (Object)) 710 { | 731 732 733 /* Ensure that we have a valid object */ 734 735 if (!AcpiUtValidInternalObject (Object)) 736 { |
711 return_VOID; | 737 return; |
712 } 713 714 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, 715 "Obj %p Current Refs=%X [To Be Incremented]\n", 716 Object, Object->Common.ReferenceCount)); 717 718 /* Increment the reference count */ 719 720 (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT); | 738 } 739 740 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, 741 "Obj %p Current Refs=%X [To Be Incremented]\n", 742 Object, Object->Common.ReferenceCount)); 743 744 /* Increment the reference count */ 745 746 (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT); |
721 return_VOID; | 747 return; |
722} 723 724 725/******************************************************************************* 726 * 727 * FUNCTION: AcpiUtRemoveReference 728 * 729 * PARAMETERS: Object - Object whose ref count will be decremented --- 4 unchanged lines hidden (view full) --- 734 * 735 ******************************************************************************/ 736 737void 738AcpiUtRemoveReference ( 739 ACPI_OPERAND_OBJECT *Object) 740{ 741 | 748} 749 750 751/******************************************************************************* 752 * 753 * FUNCTION: AcpiUtRemoveReference 754 * 755 * PARAMETERS: Object - Object whose ref count will be decremented --- 4 unchanged lines hidden (view full) --- 760 * 761 ******************************************************************************/ 762 763void 764AcpiUtRemoveReference ( 765 ACPI_OPERAND_OBJECT *Object) 766{ 767 |
742 ACPI_FUNCTION_TRACE_PTR (UtRemoveReference, Object); | 768 ACPI_FUNCTION_NAME (UtRemoveReference); |
743 744 745 /* 746 * Allow a NULL pointer to be passed in, just ignore it. This saves 747 * each caller from having to check. Also, ignore NS nodes. 748 * 749 */ 750 if (!Object || 751 (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)) 752 753 { | 769 770 771 /* 772 * Allow a NULL pointer to be passed in, just ignore it. This saves 773 * each caller from having to check. Also, ignore NS nodes. 774 * 775 */ 776 if (!Object || 777 (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)) 778 779 { |
754 return_VOID; | 780 return; |
755 } 756 757 /* Ensure that we have a valid object */ 758 759 if (!AcpiUtValidInternalObject (Object)) 760 { | 781 } 782 783 /* Ensure that we have a valid object */ 784 785 if (!AcpiUtValidInternalObject (Object)) 786 { |
761 return_VOID; | 787 return; |
762 } 763 764 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, 765 "Obj %p Current Refs=%X [To Be Decremented]\n", 766 Object, Object->Common.ReferenceCount)); 767 768 /* 769 * Decrement the reference count, and only actually delete the object 770 * if the reference count becomes 0. (Must also decrement the ref count 771 * of all subobjects!) 772 */ 773 (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT); | 788 } 789 790 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, 791 "Obj %p Current Refs=%X [To Be Decremented]\n", 792 Object, Object->Common.ReferenceCount)); 793 794 /* 795 * Decrement the reference count, and only actually delete the object 796 * if the reference count becomes 0. (Must also decrement the ref count 797 * of all subobjects!) 798 */ 799 (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT); |
774 return_VOID; | 800 return; |
775} | 801} |