diff options
| author | Bob Moore <robert.moore@intel.com> | 2009-11-11 20:52:45 -0500 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2009-11-24 21:31:11 -0500 |
| commit | dc95a270c684e771b25dce0b60559cc80c033f22 (patch) | |
| tree | 11c4b75117ab6e2f1b09d483422b7f42572d9c67 | |
| parent | 502f7efa6ae7c3f6d93dac417af521af1f56bcc7 (diff) | |
ACPICA: Deploy new create integer interface where appropriate
Simplifies creation of simple integer objects.
ACPICA BZ 823.
http://www.acpica.org/bugzilla/show_bug.cgi?id=823
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
| -rw-r--r-- | drivers/acpi/acpica/dsmthdat.c | 4 | ||||
| -rw-r--r-- | drivers/acpi/acpica/evregion.c | 11 | ||||
| -rw-r--r-- | drivers/acpi/acpica/exconfig.c | 4 | ||||
| -rw-r--r-- | drivers/acpi/acpica/exconvrt.c | 3 | ||||
| -rw-r--r-- | drivers/acpi/acpica/exfield.c | 3 | ||||
| -rw-r--r-- | drivers/acpi/acpica/exoparg1.c | 38 | ||||
| -rw-r--r-- | drivers/acpi/acpica/exoparg6.c | 7 | ||||
| -rw-r--r-- | drivers/acpi/acpica/psparse.c | 8 | ||||
| -rw-r--r-- | drivers/acpi/acpica/psxface.c | 4 |
9 files changed, 30 insertions, 52 deletions
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c index 7d077bb2f525..0ba19f84ad82 100644 --- a/drivers/acpi/acpica/dsmthdat.c +++ b/drivers/acpi/acpica/dsmthdat.c | |||
| @@ -409,13 +409,11 @@ acpi_ds_method_data_get_value(u8 type, | |||
| 409 | /* If slack enabled, init the local_x/arg_x to an Integer of value zero */ | 409 | /* If slack enabled, init the local_x/arg_x to an Integer of value zero */ |
| 410 | 410 | ||
| 411 | if (acpi_gbl_enable_interpreter_slack) { | 411 | if (acpi_gbl_enable_interpreter_slack) { |
| 412 | object = | 412 | object = acpi_ut_create_integer_object((u64) 0); |
| 413 | acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | ||
| 414 | if (!object) { | 413 | if (!object) { |
| 415 | return_ACPI_STATUS(AE_NO_MEMORY); | 414 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 416 | } | 415 | } |
| 417 | 416 | ||
| 418 | object->integer.value = 0; | ||
| 419 | node->object = object; | 417 | node->object = object; |
| 420 | } | 418 | } |
| 421 | 419 | ||
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 582b0af01e99..0bc807c33a56 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c | |||
| @@ -289,23 +289,20 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
| 289 | * connection status 1 for connecting the handler, 0 for disconnecting | 289 | * connection status 1 for connecting the handler, 0 for disconnecting |
| 290 | * the handler (Passed as a parameter) | 290 | * the handler (Passed as a parameter) |
| 291 | */ | 291 | */ |
| 292 | args[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 292 | args[0] = |
| 293 | acpi_ut_create_integer_object((u64) region_obj->region.space_id); | ||
| 293 | if (!args[0]) { | 294 | if (!args[0]) { |
| 294 | status = AE_NO_MEMORY; | 295 | status = AE_NO_MEMORY; |
| 295 | goto cleanup1; | 296 | goto cleanup1; |
| 296 | } | 297 | } |
| 297 | 298 | ||
| 298 | args[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 299 | args[1] = acpi_ut_create_integer_object((u64) function); |
| 299 | if (!args[1]) { | 300 | if (!args[1]) { |
| 300 | status = AE_NO_MEMORY; | 301 | status = AE_NO_MEMORY; |
| 301 | goto cleanup2; | 302 | goto cleanup2; |
| 302 | } | 303 | } |
| 303 | 304 | ||
| 304 | /* Setup the parameter objects */ | 305 | args[2] = NULL; /* Terminate list */ |
| 305 | |||
| 306 | args[0]->integer.value = region_obj->region.space_id; | ||
| 307 | args[1]->integer.value = function; | ||
| 308 | args[2] = NULL; | ||
| 309 | 306 | ||
| 310 | /* Execute the method, no return value */ | 307 | /* Execute the method, no return value */ |
| 311 | 308 | ||
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c index 24afef81af39..46adfa541cbc 100644 --- a/drivers/acpi/acpica/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c | |||
| @@ -170,14 +170,12 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
| 170 | 170 | ||
| 171 | /* Table not found, return an Integer=0 and AE_OK */ | 171 | /* Table not found, return an Integer=0 and AE_OK */ |
| 172 | 172 | ||
| 173 | ddb_handle = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 173 | ddb_handle = acpi_ut_create_integer_object((u64) 0); |
| 174 | if (!ddb_handle) { | 174 | if (!ddb_handle) { |
| 175 | return_ACPI_STATUS(AE_NO_MEMORY); | 175 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | ddb_handle->integer.value = 0; | ||
| 179 | *return_desc = ddb_handle; | 178 | *return_desc = ddb_handle; |
| 180 | |||
| 181 | return_ACPI_STATUS(AE_OK); | 179 | return_ACPI_STATUS(AE_OK); |
| 182 | } | 180 | } |
| 183 | 181 | ||
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c index 37d0d39e60a6..51d5f224f9fa 100644 --- a/drivers/acpi/acpica/exconvrt.c +++ b/drivers/acpi/acpica/exconvrt.c | |||
| @@ -167,7 +167,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
| 167 | 167 | ||
| 168 | /* Create a new integer */ | 168 | /* Create a new integer */ |
| 169 | 169 | ||
| 170 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 170 | return_desc = acpi_ut_create_integer_object(result); |
| 171 | if (!return_desc) { | 171 | if (!return_desc) { |
| 172 | return_ACPI_STATUS(AE_NO_MEMORY); | 172 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 173 | } | 173 | } |
| @@ -177,7 +177,6 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
| 177 | 177 | ||
| 178 | /* Save the Result */ | 178 | /* Save the Result */ |
| 179 | 179 | ||
| 180 | return_desc->integer.value = result; | ||
| 181 | acpi_ex_truncate_for32bit_table(return_desc); | 180 | acpi_ex_truncate_for32bit_table(return_desc); |
| 182 | *result_desc = return_desc; | 181 | *result_desc = return_desc; |
| 183 | return_ACPI_STATUS(AE_OK); | 182 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index 0b33d6c887b9..1588a2d660e7 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c | |||
| @@ -162,13 +162,12 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
| 162 | } else { | 162 | } else { |
| 163 | /* Field will fit within an Integer (normal case) */ | 163 | /* Field will fit within an Integer (normal case) */ |
| 164 | 164 | ||
| 165 | buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 165 | buffer_desc = acpi_ut_create_integer_object((u64) 0); |
| 166 | if (!buffer_desc) { | 166 | if (!buffer_desc) { |
| 167 | return_ACPI_STATUS(AE_NO_MEMORY); | 167 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | length = acpi_gbl_integer_byte_width; | 170 | length = acpi_gbl_integer_byte_width; |
| 171 | buffer_desc->integer.value = 0; | ||
| 172 | buffer = &buffer_desc->integer.value; | 171 | buffer = &buffer_desc->integer.value; |
| 173 | } | 172 | } |
| 174 | 173 | ||
diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c index 9635d21e568d..752fe48b2d20 100644 --- a/drivers/acpi/acpica/exoparg1.c +++ b/drivers/acpi/acpica/exoparg1.c | |||
| @@ -100,12 +100,12 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) | |||
| 100 | 100 | ||
| 101 | /* Create a return object of type Integer */ | 101 | /* Create a return object of type Integer */ |
| 102 | 102 | ||
| 103 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 103 | return_desc = |
| 104 | acpi_ut_create_integer_object(acpi_os_get_timer()); | ||
| 104 | if (!return_desc) { | 105 | if (!return_desc) { |
| 105 | status = AE_NO_MEMORY; | 106 | status = AE_NO_MEMORY; |
| 106 | goto cleanup; | 107 | goto cleanup; |
| 107 | } | 108 | } |
| 108 | return_desc->integer.value = acpi_os_get_timer(); | ||
| 109 | break; | 109 | break; |
| 110 | 110 | ||
| 111 | default: /* Unknown opcode */ | 111 | default: /* Unknown opcode */ |
| @@ -599,7 +599,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
| 599 | switch (walk_state->opcode) { | 599 | switch (walk_state->opcode) { |
| 600 | case AML_LNOT_OP: /* LNot (Operand) */ | 600 | case AML_LNOT_OP: /* LNot (Operand) */ |
| 601 | 601 | ||
| 602 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 602 | return_desc = acpi_ut_create_integer_object((u64) 0); |
| 603 | if (!return_desc) { | 603 | if (!return_desc) { |
| 604 | status = AE_NO_MEMORY; | 604 | status = AE_NO_MEMORY; |
| 605 | goto cleanup; | 605 | goto cleanup; |
| @@ -702,13 +702,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
| 702 | 702 | ||
| 703 | /* Allocate a descriptor to hold the type. */ | 703 | /* Allocate a descriptor to hold the type. */ |
| 704 | 704 | ||
| 705 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 705 | return_desc = acpi_ut_create_integer_object((u64) type); |
| 706 | if (!return_desc) { | 706 | if (!return_desc) { |
| 707 | status = AE_NO_MEMORY; | 707 | status = AE_NO_MEMORY; |
| 708 | goto cleanup; | 708 | goto cleanup; |
| 709 | } | 709 | } |
| 710 | |||
| 711 | return_desc->integer.value = type; | ||
| 712 | break; | 710 | break; |
| 713 | 711 | ||
| 714 | case AML_SIZE_OF_OP: /* size_of (source_object) */ | 712 | case AML_SIZE_OF_OP: /* size_of (source_object) */ |
| @@ -777,13 +775,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
| 777 | * Now that we have the size of the object, create a result | 775 | * Now that we have the size of the object, create a result |
| 778 | * object to hold the value | 776 | * object to hold the value |
| 779 | */ | 777 | */ |
| 780 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 778 | return_desc = acpi_ut_create_integer_object(value); |
| 781 | if (!return_desc) { | 779 | if (!return_desc) { |
| 782 | status = AE_NO_MEMORY; | 780 | status = AE_NO_MEMORY; |
| 783 | goto cleanup; | 781 | goto cleanup; |
| 784 | } | 782 | } |
| 785 | |||
| 786 | return_desc->integer.value = value; | ||
| 787 | break; | 783 | break; |
| 788 | 784 | ||
| 789 | case AML_REF_OF_OP: /* ref_of (source_object) */ | 785 | case AML_REF_OF_OP: /* ref_of (source_object) */ |
| @@ -946,24 +942,24 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
| 946 | * NOTE: index into a buffer is NOT a pointer to a | 942 | * NOTE: index into a buffer is NOT a pointer to a |
| 947 | * sub-buffer of the main buffer, it is only a pointer to a | 943 | * sub-buffer of the main buffer, it is only a pointer to a |
| 948 | * single element (byte) of the buffer! | 944 | * single element (byte) of the buffer! |
| 945 | * | ||
| 946 | * Since we are returning the value of the buffer at the | ||
| 947 | * indexed location, we don't need to add an additional | ||
| 948 | * reference to the buffer itself. | ||
| 949 | */ | 949 | */ |
| 950 | return_desc = | 950 | return_desc = |
| 951 | acpi_ut_create_internal_object | 951 | acpi_ut_create_integer_object((u64) |
| 952 | (ACPI_TYPE_INTEGER); | 952 | temp_desc-> |
| 953 | buffer. | ||
| 954 | pointer | ||
| 955 | [operand | ||
| 956 | [0]-> | ||
| 957 | reference. | ||
| 958 | value]); | ||
| 953 | if (!return_desc) { | 959 | if (!return_desc) { |
| 954 | status = AE_NO_MEMORY; | 960 | status = AE_NO_MEMORY; |
| 955 | goto cleanup; | 961 | goto cleanup; |
| 956 | } | 962 | } |
| 957 | |||
| 958 | /* | ||
| 959 | * Since we are returning the value of the buffer at the | ||
| 960 | * indexed location, we don't need to add an additional | ||
| 961 | * reference to the buffer itself. | ||
| 962 | */ | ||
| 963 | return_desc->integer.value = | ||
| 964 | temp_desc->buffer. | ||
| 965 | pointer[operand[0]->reference. | ||
| 966 | value]; | ||
| 967 | break; | 963 | break; |
| 968 | 964 | ||
| 969 | case ACPI_TYPE_PACKAGE: | 965 | case ACPI_TYPE_PACKAGE: |
diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c index ae43f7670a6c..295542e6bd51 100644 --- a/drivers/acpi/acpica/exoparg6.c +++ b/drivers/acpi/acpica/exoparg6.c | |||
| @@ -253,18 +253,15 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | /* Create an integer for the return value */ | 255 | /* Create an integer for the return value */ |
| 256 | /* Default return value is ACPI_INTEGER_MAX if no match found */ | ||
| 256 | 257 | ||
| 257 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 258 | return_desc = acpi_ut_create_integer_object(ACPI_INTEGER_MAX); |
| 258 | if (!return_desc) { | 259 | if (!return_desc) { |
| 259 | status = AE_NO_MEMORY; | 260 | status = AE_NO_MEMORY; |
| 260 | goto cleanup; | 261 | goto cleanup; |
| 261 | 262 | ||
| 262 | } | 263 | } |
| 263 | 264 | ||
| 264 | /* Default return value if no match found */ | ||
| 265 | |||
| 266 | return_desc->integer.value = ACPI_INTEGER_MAX; | ||
| 267 | |||
| 268 | /* | 265 | /* |
| 269 | * Examine each element until a match is found. Both match conditions | 266 | * Examine each element until a match is found. Both match conditions |
| 270 | * must be satisfied for a match to occur. Within the loop, | 267 | * must be satisfied for a match to occur. Within the loop, |
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c index 70838e9b608c..4df8f139026c 100644 --- a/drivers/acpi/acpica/psparse.c +++ b/drivers/acpi/acpica/psparse.c | |||
| @@ -610,17 +610,13 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
| 610 | implicit_return_obj) { | 610 | implicit_return_obj) { |
| 611 | previous_walk_state-> | 611 | previous_walk_state-> |
| 612 | implicit_return_obj = | 612 | implicit_return_obj = |
| 613 | acpi_ut_create_internal_object | 613 | acpi_ut_create_integer_object |
| 614 | (ACPI_TYPE_INTEGER); | 614 | ((u64) 0); |
| 615 | if (!previous_walk_state-> | 615 | if (!previous_walk_state-> |
| 616 | implicit_return_obj) { | 616 | implicit_return_obj) { |
| 617 | return_ACPI_STATUS | 617 | return_ACPI_STATUS |
| 618 | (AE_NO_MEMORY); | 618 | (AE_NO_MEMORY); |
| 619 | } | 619 | } |
| 620 | |||
| 621 | previous_walk_state-> | ||
| 622 | implicit_return_obj-> | ||
| 623 | integer.value = 0; | ||
| 624 | } | 620 | } |
| 625 | 621 | ||
| 626 | /* Restart the calling control method */ | 622 | /* Restart the calling control method */ |
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c index dd9731c29a79..12934ad6da8e 100644 --- a/drivers/acpi/acpica/psxface.c +++ b/drivers/acpi/acpica/psxface.c | |||
| @@ -306,14 +306,12 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) | |||
| 306 | */ | 306 | */ |
| 307 | if (acpi_gbl_enable_interpreter_slack) { | 307 | if (acpi_gbl_enable_interpreter_slack) { |
| 308 | walk_state->implicit_return_obj = | 308 | walk_state->implicit_return_obj = |
| 309 | acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 309 | acpi_ut_create_integer_object((u64) 0); |
| 310 | if (!walk_state->implicit_return_obj) { | 310 | if (!walk_state->implicit_return_obj) { |
| 311 | status = AE_NO_MEMORY; | 311 | status = AE_NO_MEMORY; |
| 312 | acpi_ds_delete_walk_state(walk_state); | 312 | acpi_ds_delete_walk_state(walk_state); |
| 313 | goto cleanup; | 313 | goto cleanup; |
| 314 | } | 314 | } |
| 315 | |||
| 316 | walk_state->implicit_return_obj->integer.value = 0; | ||
| 317 | } | 315 | } |
| 318 | 316 | ||
| 319 | /* Parse the AML */ | 317 | /* Parse the AML */ |
