diff options
Diffstat (limited to 'drivers/acpi/acpica/dsmethod.c')
| -rw-r--r-- | drivers/acpi/acpica/dsmethod.c | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index 32e9ddc0cf2b..2b3210f42a46 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c | |||
| @@ -99,14 +99,11 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node, | |||
| 99 | "Method auto-serialization parse [%4.4s] %p\n", | 99 | "Method auto-serialization parse [%4.4s] %p\n", |
| 100 | acpi_ut_get_node_name(node), node)); | 100 | acpi_ut_get_node_name(node), node)); |
| 101 | 101 | ||
| 102 | acpi_ex_enter_interpreter(); | ||
| 103 | |||
| 104 | /* Create/Init a root op for the method parse tree */ | 102 | /* Create/Init a root op for the method parse tree */ |
| 105 | 103 | ||
| 106 | op = acpi_ps_alloc_op(AML_METHOD_OP, obj_desc->method.aml_start); | 104 | op = acpi_ps_alloc_op(AML_METHOD_OP, obj_desc->method.aml_start); |
| 107 | if (!op) { | 105 | if (!op) { |
| 108 | status = AE_NO_MEMORY; | 106 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 109 | goto unlock; | ||
| 110 | } | 107 | } |
| 111 | 108 | ||
| 112 | acpi_ps_set_name(op, node->name.integer); | 109 | acpi_ps_set_name(op, node->name.integer); |
| @@ -118,8 +115,7 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node, | |||
| 118 | acpi_ds_create_walk_state(node->owner_id, NULL, NULL, NULL); | 115 | acpi_ds_create_walk_state(node->owner_id, NULL, NULL, NULL); |
| 119 | if (!walk_state) { | 116 | if (!walk_state) { |
| 120 | acpi_ps_free_op(op); | 117 | acpi_ps_free_op(op); |
| 121 | status = AE_NO_MEMORY; | 118 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 122 | goto unlock; | ||
| 123 | } | 119 | } |
| 124 | 120 | ||
| 125 | status = acpi_ds_init_aml_walk(walk_state, op, node, | 121 | status = acpi_ds_init_aml_walk(walk_state, op, node, |
| @@ -138,8 +134,6 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node, | |||
| 138 | status = acpi_ps_parse_aml(walk_state); | 134 | status = acpi_ps_parse_aml(walk_state); |
| 139 | 135 | ||
| 140 | acpi_ps_delete_parse_tree(op); | 136 | acpi_ps_delete_parse_tree(op); |
| 141 | unlock: | ||
| 142 | acpi_ex_exit_interpreter(); | ||
| 143 | return_ACPI_STATUS(status); | 137 | return_ACPI_STATUS(status); |
| 144 | } | 138 | } |
| 145 | 139 | ||
| @@ -731,26 +725,6 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
| 731 | acpi_ds_method_data_delete_all(walk_state); | 725 | acpi_ds_method_data_delete_all(walk_state); |
| 732 | 726 | ||
| 733 | /* | 727 | /* |
| 734 | * If method is serialized, release the mutex and restore the | ||
| 735 | * current sync level for this thread | ||
| 736 | */ | ||
| 737 | if (method_desc->method.mutex) { | ||
| 738 | |||
| 739 | /* Acquisition Depth handles recursive calls */ | ||
| 740 | |||
| 741 | method_desc->method.mutex->mutex.acquisition_depth--; | ||
| 742 | if (!method_desc->method.mutex->mutex.acquisition_depth) { | ||
| 743 | walk_state->thread->current_sync_level = | ||
| 744 | method_desc->method.mutex->mutex. | ||
| 745 | original_sync_level; | ||
| 746 | |||
| 747 | acpi_os_release_mutex(method_desc->method. | ||
| 748 | mutex->mutex.os_mutex); | ||
| 749 | method_desc->method.mutex->mutex.thread_id = 0; | ||
| 750 | } | ||
| 751 | } | ||
| 752 | |||
| 753 | /* | ||
| 754 | * Delete any namespace objects created anywhere within the | 728 | * Delete any namespace objects created anywhere within the |
| 755 | * namespace by the execution of this method. Unless: | 729 | * namespace by the execution of this method. Unless: |
| 756 | * 1) This method is a module-level executable code method, in which | 730 | * 1) This method is a module-level executable code method, in which |
| @@ -786,6 +760,26 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
| 786 | ~ACPI_METHOD_MODIFIED_NAMESPACE; | 760 | ~ACPI_METHOD_MODIFIED_NAMESPACE; |
| 787 | } | 761 | } |
| 788 | } | 762 | } |
| 763 | |||
| 764 | /* | ||
| 765 | * If method is serialized, release the mutex and restore the | ||
| 766 | * current sync level for this thread | ||
| 767 | */ | ||
| 768 | if (method_desc->method.mutex) { | ||
| 769 | |||
| 770 | /* Acquisition Depth handles recursive calls */ | ||
| 771 | |||
| 772 | method_desc->method.mutex->mutex.acquisition_depth--; | ||
| 773 | if (!method_desc->method.mutex->mutex.acquisition_depth) { | ||
| 774 | walk_state->thread->current_sync_level = | ||
| 775 | method_desc->method.mutex->mutex. | ||
| 776 | original_sync_level; | ||
| 777 | |||
| 778 | acpi_os_release_mutex(method_desc->method. | ||
| 779 | mutex->mutex.os_mutex); | ||
| 780 | method_desc->method.mutex->mutex.thread_id = 0; | ||
| 781 | } | ||
| 782 | } | ||
| 789 | } | 783 | } |
| 790 | 784 | ||
| 791 | /* Decrement the thread count on the method */ | 785 | /* Decrement the thread count on the method */ |
