aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2006-10-02 00:00:00 -0400
committerLen Brown <len.brown@intel.com>2006-03-31 02:19:03 -0500
commit52fc0b026e99b5d5d585095148d997d5634bbc25 (patch)
tree7bf93132cfd3e6957308a84198ee159f7d43cf6f /drivers
parent46358614ed5b031797522f1020e989c959a8d8a6 (diff)
[ACPI] ACPICA 20060210
Removed a couple of extraneous ACPI_ERROR messages that appeared during normal execution. These became apparent after the conversion from ACPI_DEBUG_PRINT. Fixed a problem where the CreateField operator could hang if the BitIndex or NumBits parameter referred to a named object. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5359 Fixed a problem where a DeRefOf operation on a buffer object incorrectly failed with an exception. This also fixes a couple of related RefOf and DeRefOf issues. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5360 http://bugzilla.kernel.org/show_bug.cgi?id=5387 http://bugzilla.kernel.org/show_bug.cgi?id=5392 Fixed a problem where the AE_BUFFER_LIMIT exception was returned instead of AE_STRING_LIMIT on an out-of-bounds Index() operation. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5480 Implemented a memory cleanup at the end of the execution of each iteration of an AML While() loop, preventing the accumulation of outstanding objects. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5427 Eliminated a chunk of duplicate code in the object resolution code. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5336 Fixed several warnings during the 64-bit code generation. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/dispatcher/dsfield.c1
-rw-r--r--drivers/acpi/dispatcher/dsmethod.c5
-rw-r--r--drivers/acpi/dispatcher/dsmthdat.c1
-rw-r--r--drivers/acpi/dispatcher/dsobject.c6
-rw-r--r--drivers/acpi/dispatcher/dsopcode.c4
-rw-r--r--drivers/acpi/dispatcher/dsutils.c7
-rw-r--r--drivers/acpi/dispatcher/dswexec.c3
-rw-r--r--drivers/acpi/dispatcher/dswload.c9
-rw-r--r--drivers/acpi/dispatcher/dswscope.c2
-rw-r--r--drivers/acpi/dispatcher/dswstate.c5
-rw-r--r--drivers/acpi/events/evevent.c2
-rw-r--r--drivers/acpi/events/evgpe.c5
-rw-r--r--drivers/acpi/events/evgpeblk.c13
-rw-r--r--drivers/acpi/events/evmisc.c6
-rw-r--r--drivers/acpi/events/evregion.c10
-rw-r--r--drivers/acpi/events/evrgnini.c6
-rw-r--r--drivers/acpi/events/evxface.c3
-rw-r--r--drivers/acpi/events/evxfevnt.c1
-rw-r--r--drivers/acpi/events/evxfregn.c2
-rw-r--r--drivers/acpi/executer/exconfig.c5
-rw-r--r--drivers/acpi/executer/exconvrt.c2
-rw-r--r--drivers/acpi/executer/exdump.c2
-rw-r--r--drivers/acpi/executer/exfield.c2
-rw-r--r--drivers/acpi/executer/exfldio.c5
-rw-r--r--drivers/acpi/executer/exmisc.c1
-rw-r--r--drivers/acpi/executer/exmutex.c3
-rw-r--r--drivers/acpi/executer/exnames.c6
-rw-r--r--drivers/acpi/executer/exoparg1.c44
-rw-r--r--drivers/acpi/executer/exoparg2.c77
-rw-r--r--drivers/acpi/executer/exoparg3.c2
-rw-r--r--drivers/acpi/executer/exoparg6.c1
-rw-r--r--drivers/acpi/executer/exregion.c1
-rw-r--r--drivers/acpi/executer/exresnte.c5
-rw-r--r--drivers/acpi/executer/exresolv.c43
-rw-r--r--drivers/acpi/executer/exresop.c4
-rw-r--r--drivers/acpi/executer/exstore.c2
-rw-r--r--drivers/acpi/executer/exstoren.c3
-rw-r--r--drivers/acpi/executer/exstorob.c3
-rw-r--r--drivers/acpi/executer/exsystem.c2
-rw-r--r--drivers/acpi/executer/exutils.c3
-rw-r--r--drivers/acpi/hardware/hwgpe.c2
-rw-r--r--drivers/acpi/hardware/hwregs.c1
-rw-r--r--drivers/acpi/hardware/hwsleep.c1
-rw-r--r--drivers/acpi/hardware/hwtimer.c1
-rw-r--r--drivers/acpi/namespace/nsaccess.c7
-rw-r--r--drivers/acpi/namespace/nsalloc.c8
-rw-r--r--drivers/acpi/namespace/nsdump.c4
-rw-r--r--drivers/acpi/namespace/nseval.c1
-rw-r--r--drivers/acpi/namespace/nsinit.c5
-rw-r--r--drivers/acpi/namespace/nsload.c3
-rw-r--r--drivers/acpi/namespace/nsobject.c3
-rw-r--r--drivers/acpi/namespace/nssearch.c3
-rw-r--r--drivers/acpi/namespace/nsutils.c6
-rw-r--r--drivers/acpi/namespace/nswalk.c4
-rw-r--r--drivers/acpi/namespace/nsxfeval.c46
-rw-r--r--drivers/acpi/namespace/nsxfname.c1
-rw-r--r--drivers/acpi/namespace/nsxfobj.c1
-rw-r--r--drivers/acpi/parser/psargs.c7
-rw-r--r--drivers/acpi/parser/psloop.c6
-rw-r--r--drivers/acpi/parser/psopcode.c2
-rw-r--r--drivers/acpi/parser/psparse.c8
-rw-r--r--drivers/acpi/parser/psscope.c1
-rw-r--r--drivers/acpi/parser/pstree.c7
-rw-r--r--drivers/acpi/parser/psutils.c1
-rw-r--r--drivers/acpi/parser/pswalk.c3
-rw-r--r--drivers/acpi/parser/psxface.c2
-rw-r--r--drivers/acpi/resources/rscalc.c16
-rw-r--r--drivers/acpi/resources/rslist.c3
-rw-r--r--drivers/acpi/resources/rsmisc.c6
-rw-r--r--drivers/acpi/resources/rsutils.c46
-rw-r--r--drivers/acpi/resources/rsxface.c2
-rw-r--r--drivers/acpi/tables/tbconvrt.c3
-rw-r--r--drivers/acpi/tables/tbget.c9
-rw-r--r--drivers/acpi/tables/tbgetall.c1
-rw-r--r--drivers/acpi/tables/tbinstal.c1
-rw-r--r--drivers/acpi/tables/tbrsdt.c1
-rw-r--r--drivers/acpi/tables/tbutils.c2
-rw-r--r--drivers/acpi/tables/tbxface.c3
-rw-r--r--drivers/acpi/tables/tbxfroot.c11
-rw-r--r--drivers/acpi/utilities/utalloc.c5
-rw-r--r--drivers/acpi/utilities/utcache.c2
-rw-r--r--drivers/acpi/utilities/utcopy.c1
-rw-r--r--drivers/acpi/utilities/utdebug.c4
-rw-r--r--drivers/acpi/utilities/utdelete.c3
-rw-r--r--drivers/acpi/utilities/uteval.c4
-rw-r--r--drivers/acpi/utilities/utglobal.c2
-rw-r--r--drivers/acpi/utilities/utmisc.c31
-rw-r--r--drivers/acpi/utilities/utobject.c2
-rw-r--r--drivers/acpi/utilities/utresrc.c4
-rw-r--r--drivers/acpi/utilities/utstate.c2
90 files changed, 464 insertions, 141 deletions
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c
index 76bc0463f6de..3d33bcc98678 100644
--- a/drivers/acpi/dispatcher/dsfield.c
+++ b/drivers/acpi/dispatcher/dsfield.c
@@ -425,6 +425,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
425 * Walk the list of entries in the field_list 425 * Walk the list of entries in the field_list
426 */ 426 */
427 while (arg) { 427 while (arg) {
428
428 /* Ignore OFFSET and ACCESSAS terms here */ 429 /* Ignore OFFSET and ACCESSAS terms here */
429 430
430 if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { 431 if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
index c475546535b6..238916ce5412 100644
--- a/drivers/acpi/dispatcher/dsmethod.c
+++ b/drivers/acpi/dispatcher/dsmethod.c
@@ -81,6 +81,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
81 /* Invoke the global exception handler */ 81 /* Invoke the global exception handler */
82 82
83 if (acpi_gbl_exception_handler) { 83 if (acpi_gbl_exception_handler) {
84
84 /* Exit the interpreter, allow handler to execute methods */ 85 /* Exit the interpreter, allow handler to execute methods */
85 86
86 acpi_ex_exit_interpreter(); 87 acpi_ex_exit_interpreter();
@@ -100,6 +101,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
100 } 101 }
101#ifdef ACPI_DISASSEMBLER 102#ifdef ACPI_DISASSEMBLER
102 if (ACPI_FAILURE(status)) { 103 if (ACPI_FAILURE(status)) {
104
103 /* Display method locals/args if disassembler is present */ 105 /* Display method locals/args if disassembler is present */
104 106
105 acpi_dm_dump_method_info(status, walk_state, walk_state->op); 107 acpi_dm_dump_method_info(status, walk_state, walk_state->op);
@@ -249,6 +251,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
249 } 251 }
250 252
251 if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { 253 if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
254
252 /* 1) Parse: Create a new walk state for the preempting walk */ 255 /* 1) Parse: Create a new walk state for the preempting walk */
253 256
254 next_walk_state = 257 next_walk_state =
@@ -378,9 +381,11 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
378 /* Did the called method return a value? */ 381 /* Did the called method return a value? */
379 382
380 if (return_desc) { 383 if (return_desc) {
384
381 /* Are we actually going to use the return value? */ 385 /* Are we actually going to use the return value? */
382 386
383 if (walk_state->return_used) { 387 if (walk_state->return_used) {
388
384 /* Save the return value from the previous method */ 389 /* Save the return value from the previous method */
385 390
386 status = acpi_ds_result_push(return_desc, walk_state); 391 status = acpi_ds_result_push(return_desc, walk_state);
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c
index c025674f938b..f7cb5170aa11 100644
--- a/drivers/acpi/dispatcher/dsmthdat.c
+++ b/drivers/acpi/dispatcher/dsmthdat.c
@@ -701,6 +701,7 @@ acpi_ds_method_data_get_type(u16 opcode,
701 701
702 object = acpi_ns_get_attached_object(node); 702 object = acpi_ns_get_attached_object(node);
703 if (!object) { 703 if (!object) {
704
704 /* Uninitialized local/arg, return TYPE_ANY */ 705 /* Uninitialized local/arg, return TYPE_ANY */
705 706
706 return_VALUE(ACPI_TYPE_ANY); 707 return_VALUE(ACPI_TYPE_ANY);
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c
index 8b21f0f9e517..1f2d0c6ef36c 100644
--- a/drivers/acpi/dispatcher/dsobject.c
+++ b/drivers/acpi/dispatcher/dsobject.c
@@ -103,6 +103,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
103 common. 103 common.
104 node))); 104 node)));
105 if (ACPI_FAILURE(status)) { 105 if (ACPI_FAILURE(status)) {
106
106 /* Check if we are resolving a named reference within a package */ 107 /* Check if we are resolving a named reference within a package */
107 108
108 if ((status == AE_NOT_FOUND) 109 if ((status == AE_NOT_FOUND)
@@ -195,6 +196,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
195 */ 196 */
196 obj_desc = *obj_desc_ptr; 197 obj_desc = *obj_desc_ptr;
197 if (!obj_desc) { 198 if (!obj_desc) {
199
198 /* Create a new buffer object */ 200 /* Create a new buffer object */
199 201
200 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); 202 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
@@ -355,6 +357,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
355 arg = arg->common.next; 357 arg = arg->common.next;
356 for (i = 0; arg; i++) { 358 for (i = 0; arg; i++) {
357 if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { 359 if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
360
358 /* Object (package or buffer) is already built */ 361 /* Object (package or buffer) is already built */
359 362
360 obj_desc->package.elements[i] = 363 obj_desc->package.elements[i] =
@@ -408,6 +411,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state,
408 } 411 }
409 412
410 if (!op->common.value.arg) { 413 if (!op->common.value.arg) {
414
411 /* No arguments, there is nothing to do */ 415 /* No arguments, there is nothing to do */
412 416
413 return_ACPI_STATUS(AE_OK); 417 return_ACPI_STATUS(AE_OK);
@@ -469,6 +473,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
469 obj_desc = *ret_obj_desc; 473 obj_desc = *ret_obj_desc;
470 op_info = acpi_ps_get_opcode_info(opcode); 474 op_info = acpi_ps_get_opcode_info(opcode);
471 if (op_info->class == AML_CLASS_UNKNOWN) { 475 if (op_info->class == AML_CLASS_UNKNOWN) {
476
472 /* Unknown opcode */ 477 /* Unknown opcode */
473 478
474 return_ACPI_STATUS(AE_TYPE); 479 return_ACPI_STATUS(AE_TYPE);
@@ -626,6 +631,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
626 default: /* Other literals, etc.. */ 631 default: /* Other literals, etc.. */
627 632
628 if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { 633 if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
634
629 /* Node was saved in Op */ 635 /* Node was saved in Op */
630 636
631 obj_desc->reference.node = op->common.node; 637 obj_desc->reference.node = op->common.node;
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c
index 6229c10674e1..8a690a9963f2 100644
--- a/drivers/acpi/dispatcher/dsopcode.c
+++ b/drivers/acpi/dispatcher/dsopcode.c
@@ -640,6 +640,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
640 /* Initialize the Buffer Field */ 640 /* Initialize the Buffer Field */
641 641
642 if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { 642 if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
643
643 /* NOTE: Slightly different operands for this opcode */ 644 /* NOTE: Slightly different operands for this opcode */
644 645
645 status = 646 status =
@@ -984,6 +985,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
984 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); 985 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op));
985 986
986 if (walk_state->control_state->common.value) { 987 if (walk_state->control_state->common.value) {
988
987 /* Predicate was true, go back and evaluate it again! */ 989 /* Predicate was true, go back and evaluate it again! */
988 990
989 status = AE_CTRL_PENDING; 991 status = AE_CTRL_PENDING;
@@ -1014,6 +1016,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
1014 * has been bubbled up the tree 1016 * has been bubbled up the tree
1015 */ 1017 */
1016 if (op->common.value.arg) { 1018 if (op->common.value.arg) {
1019
1017 /* Since we have a real Return(), delete any implicit return */ 1020 /* Since we have a real Return(), delete any implicit return */
1018 1021
1019 acpi_ds_clear_implicit_return(walk_state); 1022 acpi_ds_clear_implicit_return(walk_state);
@@ -1047,6 +1050,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
1047 walk_state->return_desc = walk_state->operands[0]; 1050 walk_state->return_desc = walk_state->operands[0];
1048 } else if ((walk_state->results) && 1051 } else if ((walk_state->results) &&
1049 (walk_state->results->results.num_results > 0)) { 1052 (walk_state->results->results.num_results > 0)) {
1053
1050 /* Since we have a real Return(), delete any implicit return */ 1054 /* Since we have a real Return(), delete any implicit return */
1051 1055
1052 acpi_ds_clear_implicit_return(walk_state); 1056 acpi_ds_clear_implicit_return(walk_state);
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c
index 53356a591ac1..3fbe17ebef5a 100644
--- a/drivers/acpi/dispatcher/dsutils.c
+++ b/drivers/acpi/dispatcher/dsutils.c
@@ -202,6 +202,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
202 */ 202 */
203 if ((!op->common.parent) || 203 if ((!op->common.parent) ||
204 (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { 204 (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
205
205 /* No parent, the return value cannot possibly be used */ 206 /* No parent, the return value cannot possibly be used */
206 207
207 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 208 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
@@ -352,6 +353,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
352 } 353 }
353 354
354 if (!acpi_ds_is_result_used(op, walk_state)) { 355 if (!acpi_ds_is_result_used(op, walk_state)) {
356
355 /* Must pop the result stack (obj_desc should be equal to result_obj) */ 357 /* Must pop the result stack (obj_desc should be equal to result_obj) */
356 358
357 status = acpi_ds_result_pop(&obj_desc, walk_state); 359 status = acpi_ds_result_pop(&obj_desc, walk_state);
@@ -498,7 +500,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
498 */ 500 */
499 if ((walk_state->deferred_node) && 501 if ((walk_state->deferred_node) &&
500 (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) 502 (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD)
501 && (arg_index != 0)) { 503 && (arg_index ==
504 (u32) ((walk_state->opcode ==
505 AML_CREATE_FIELD_OP) ? 3 : 2))) {
502 obj_desc = 506 obj_desc =
503 ACPI_CAST_PTR(union acpi_operand_object, 507 ACPI_CAST_PTR(union acpi_operand_object,
504 walk_state->deferred_node); 508 walk_state->deferred_node);
@@ -521,6 +525,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
521 && (parent_op->common.aml_opcode != AML_REGION_OP) 525 && (parent_op->common.aml_opcode != AML_REGION_OP)
522 && (parent_op->common.aml_opcode != 526 && (parent_op->common.aml_opcode !=
523 AML_INT_NAMEPATH_OP)) { 527 AML_INT_NAMEPATH_OP)) {
528
524 /* Enter name into namespace if not found */ 529 /* Enter name into namespace if not found */
525 530
526 interpreter_mode = ACPI_IMODE_LOAD_PASS2; 531 interpreter_mode = ACPI_IMODE_LOAD_PASS2;
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c
index f1af655ff113..198949f41048 100644
--- a/drivers/acpi/dispatcher/dswexec.c
+++ b/drivers/acpi/dispatcher/dswexec.c
@@ -409,6 +409,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
409 * being the object_type and size_of operators. 409 * being the object_type and size_of operators.
410 */ 410 */
411 if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { 411 if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) {
412
412 /* Resolve all operands */ 413 /* Resolve all operands */
413 414
414 status = acpi_ex_resolve_operands(walk_state->opcode, 415 status = acpi_ex_resolve_operands(walk_state->opcode,
@@ -548,6 +549,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
548 */ 549 */
549 status = acpi_ds_resolve_operands(walk_state); 550 status = acpi_ds_resolve_operands(walk_state);
550 if (ACPI_FAILURE(status)) { 551 if (ACPI_FAILURE(status)) {
552
551 /* On error, clear all resolved operands */ 553 /* On error, clear all resolved operands */
552 554
553 acpi_ds_clear_operands(walk_state); 555 acpi_ds_clear_operands(walk_state);
@@ -722,6 +724,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
722 cleanup: 724 cleanup:
723 725
724 if (walk_state->result_obj) { 726 if (walk_state->result_obj) {
727
725 /* Break to debugger to display result */ 728 /* Break to debugger to display result */
726 729
727 ACPI_DEBUGGER_EXEC(acpi_db_display_result_object 730 ACPI_DEBUGGER_EXEC(acpi_db_display_result_object
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c
index d3d24da31c81..02b03126e14e 100644
--- a/drivers/acpi/dispatcher/dswload.c
+++ b/drivers/acpi/dispatcher/dswload.c
@@ -261,6 +261,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
261 */ 261 */
262 262
263 if (walk_state->deferred_node) { 263 if (walk_state->deferred_node) {
264
264 /* This name is already in the namespace, get the node */ 265 /* This name is already in the namespace, get the node */
265 266
266 node = walk_state->deferred_node; 267 node = walk_state->deferred_node;
@@ -311,6 +312,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
311 /* Common exit */ 312 /* Common exit */
312 313
313 if (!op) { 314 if (!op) {
315
314 /* Create a new op */ 316 /* Create a new op */
315 317
316 op = acpi_ps_alloc_op(walk_state->opcode); 318 op = acpi_ps_alloc_op(walk_state->opcode);
@@ -413,6 +415,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state)
413#endif 415#endif
414 416
415 if (op->common.aml_opcode == AML_NAME_OP) { 417 if (op->common.aml_opcode == AML_NAME_OP) {
418
416 /* For Name opcode, get the object type from the argument */ 419 /* For Name opcode, get the object type from the argument */
417 420
418 if (op->common.value.arg) { 421 if (op->common.value.arg) {
@@ -521,6 +524,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
521 if ((walk_state->control_state) && 524 if ((walk_state->control_state) &&
522 (walk_state->control_state->common.state == 525 (walk_state->control_state->common.state ==
523 ACPI_CONTROL_CONDITIONAL_EXECUTING)) { 526 ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
527
524 /* We are executing a while loop outside of a method */ 528 /* We are executing a while loop outside of a method */
525 529
526 status = acpi_ds_exec_begin_op(walk_state, out_op); 530 status = acpi_ds_exec_begin_op(walk_state, out_op);
@@ -554,10 +558,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
554 /* Get the name we are going to enter or lookup in the namespace */ 558 /* Get the name we are going to enter or lookup in the namespace */
555 559
556 if (walk_state->opcode == AML_INT_NAMEPATH_OP) { 560 if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
561
557 /* For Namepath op, get the path string */ 562 /* For Namepath op, get the path string */
558 563
559 buffer_ptr = op->common.value.string; 564 buffer_ptr = op->common.value.string;
560 if (!buffer_ptr) { 565 if (!buffer_ptr) {
566
561 /* No name, just exit */ 567 /* No name, just exit */
562 568
563 return_ACPI_STATUS(AE_OK); 569 return_ACPI_STATUS(AE_OK);
@@ -680,6 +686,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
680 /* All other opcodes */ 686 /* All other opcodes */
681 687
682 if (op && op->common.node) { 688 if (op && op->common.node) {
689
683 /* This op/node was previously entered into the namespace */ 690 /* This op/node was previously entered into the namespace */
684 691
685 node = op->common.node; 692 node = op->common.node;
@@ -705,6 +712,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
705 * Note: Name may already exist if we are executing a deferred opcode. 712 * Note: Name may already exist if we are executing a deferred opcode.
706 */ 713 */
707 if (walk_state->deferred_node) { 714 if (walk_state->deferred_node) {
715
708 /* This name is already in the namespace, get the node */ 716 /* This name is already in the namespace, get the node */
709 717
710 node = walk_state->deferred_node; 718 node = walk_state->deferred_node;
@@ -727,6 +735,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
727 } 735 }
728 736
729 if (!op) { 737 if (!op) {
738
730 /* Create a new op */ 739 /* Create a new op */
731 740
732 op = acpi_ps_alloc_op(walk_state->opcode); 741 op = acpi_ps_alloc_op(walk_state->opcode);
diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c
index ada21ef4a174..e2954fff8c5e 100644
--- a/drivers/acpi/dispatcher/dswscope.c
+++ b/drivers/acpi/dispatcher/dswscope.c
@@ -66,6 +66,7 @@ void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state)
66 ACPI_FUNCTION_NAME("ds_scope_stack_clear"); 66 ACPI_FUNCTION_NAME("ds_scope_stack_clear");
67 67
68 while (walk_state->scope_info) { 68 while (walk_state->scope_info) {
69
69 /* Pop a scope off the stack */ 70 /* Pop a scope off the stack */
70 71
71 scope_info = walk_state->scope_info; 72 scope_info = walk_state->scope_info;
@@ -105,6 +106,7 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
105 ACPI_FUNCTION_TRACE("ds_scope_stack_push"); 106 ACPI_FUNCTION_TRACE("ds_scope_stack_push");
106 107
107 if (!node) { 108 if (!node) {
109
108 /* Invalid scope */ 110 /* Invalid scope */
109 111
110 ACPI_ERROR((AE_INFO, "Null scope parameter")); 112 ACPI_ERROR((AE_INFO, "Null scope parameter"));
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c
index fa78cb74ee36..5bc340b1b286 100644
--- a/drivers/acpi/dispatcher/dswstate.c
+++ b/drivers/acpi/dispatcher/dswstate.c
@@ -170,6 +170,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object,
170 state->results.num_results--; 170 state->results.num_results--;
171 171
172 for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { 172 for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) {
173
173 /* Check for a valid result object */ 174 /* Check for a valid result object */
174 175
175 if (state->results.obj_desc[index - 1]) { 176 if (state->results.obj_desc[index - 1]) {
@@ -448,6 +449,7 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state)
448 ACPI_FUNCTION_NAME("ds_obj_stack_pop"); 449 ACPI_FUNCTION_NAME("ds_obj_stack_pop");
449 450
450 for (i = 0; i < pop_count; i++) { 451 for (i = 0; i < pop_count; i++) {
452
451 /* Check for stack underflow */ 453 /* Check for stack underflow */
452 454
453 if (walk_state->num_operands == 0) { 455 if (walk_state->num_operands == 0) {
@@ -494,6 +496,7 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
494 ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete"); 496 ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete");
495 497
496 for (i = 0; i < pop_count; i++) { 498 for (i = 0; i < pop_count; i++) {
499
497 /* Check for stack underflow */ 500 /* Check for stack underflow */
498 501
499 if (walk_state->num_operands == 0) { 502 if (walk_state->num_operands == 0) {
@@ -598,6 +601,7 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread)
598 walk_state = thread->walk_state_list; 601 walk_state = thread->walk_state_list;
599 602
600 if (walk_state) { 603 if (walk_state) {
604
601 /* Next walk state becomes the current walk state */ 605 /* Next walk state becomes the current walk state */
602 606
603 thread->walk_state_list = walk_state->next; 607 thread->walk_state_list = walk_state->next;
@@ -778,6 +782,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
778 } 782 }
779 783
780 if (parser_state->start_node) { 784 if (parser_state->start_node) {
785
781 /* Push start scope on scope stack and make it current */ 786 /* Push start scope on scope stack and make it current */
782 787
783 status = 788 status =
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c
index c9ac05c4685f..c8d9752e3128 100644
--- a/drivers/acpi/events/evevent.c
+++ b/drivers/acpi/events/evevent.c
@@ -260,12 +260,14 @@ u32 acpi_ev_fixed_event_detect(void)
260 * Check for all possible Fixed Events and dispatch those that are active 260 * Check for all possible Fixed Events and dispatch those that are active
261 */ 261 */
262 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { 262 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
263
263 /* Both the status and enable bits must be on for this event */ 264 /* Both the status and enable bits must be on for this event */
264 265
265 if ((fixed_status & acpi_gbl_fixed_event_info[i]. 266 if ((fixed_status & acpi_gbl_fixed_event_info[i].
266 status_bit_mask) 267 status_bit_mask)
267 && (fixed_enable & acpi_gbl_fixed_event_info[i]. 268 && (fixed_enable & acpi_gbl_fixed_event_info[i].
268 enable_bit_mask)) { 269 enable_bit_mask)) {
270
269 /* Found an active (signalled) event */ 271 /* Found an active (signalled) event */
270 272
271 int_status |= acpi_ev_fixed_event_dispatch((u32) i); 273 int_status |= acpi_ev_fixed_event_dispatch((u32) i);
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c
index f64f977dd3d5..7d7b81af972e 100644
--- a/drivers/acpi/events/evgpe.c
+++ b/drivers/acpi/events/evgpe.c
@@ -207,6 +207,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
207 ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); 207 ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
208 208
209 if (write_to_hardware) { 209 if (write_to_hardware) {
210
210 /* Clear the GPE (of stale events), then enable it */ 211 /* Clear the GPE (of stale events), then enable it */
211 212
212 status = acpi_hw_clear_gpe(gpe_event_info); 213 status = acpi_hw_clear_gpe(gpe_event_info);
@@ -313,6 +314,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
313 /* A NULL gpe_block means use the FADT-defined GPE block(s) */ 314 /* A NULL gpe_block means use the FADT-defined GPE block(s) */
314 315
315 if (!gpe_device) { 316 if (!gpe_device) {
317
316 /* Examine GPE Block 0 and 1 (These blocks are permanent) */ 318 /* Examine GPE Block 0 and 1 (These blocks are permanent) */
317 319
318 for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { 320 for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) {
@@ -402,6 +404,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
402 * Find all currently active GP events. 404 * Find all currently active GP events.
403 */ 405 */
404 for (i = 0; i < gpe_block->register_count; i++) { 406 for (i = 0; i < gpe_block->register_count; i++) {
407
405 /* Get the next status/enable pair */ 408 /* Get the next status/enable pair */
406 409
407 gpe_register_info = &gpe_block->register_info[i]; 410 gpe_register_info = &gpe_block->register_info[i];
@@ -437,6 +440,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
437 440
438 enabled_status_byte = (u8) (status_reg & enable_reg); 441 enabled_status_byte = (u8) (status_reg & enable_reg);
439 if (!enabled_status_byte) { 442 if (!enabled_status_byte) {
443
440 /* No active GPEs in this register, move on */ 444 /* No active GPEs in this register, move on */
441 445
442 continue; 446 continue;
@@ -445,6 +449,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
445 /* Now look at the individual GPEs in this byte register */ 449 /* Now look at the individual GPEs in this byte register */
446 450
447 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { 451 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
452
448 /* Examine one GPE bit */ 453 /* Examine one GPE bit */
449 454
450 if (enabled_status_byte & 455 if (enabled_status_byte &
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c
index 0fd00b5ad650..87e77a138fff 100644
--- a/drivers/acpi/events/evgpeblk.c
+++ b/drivers/acpi/events/evgpeblk.c
@@ -146,10 +146,12 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback)
146 146
147 gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; 147 gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
148 while (gpe_xrupt_info) { 148 while (gpe_xrupt_info) {
149
149 /* Walk all Gpe Blocks attached to this interrupt level */ 150 /* Walk all Gpe Blocks attached to this interrupt level */
150 151
151 gpe_block = gpe_xrupt_info->gpe_block_list_head; 152 gpe_block = gpe_xrupt_info->gpe_block_list_head;
152 while (gpe_block) { 153 while (gpe_block) {
154
153 /* One callback per GPE block */ 155 /* One callback per GPE block */
154 156
155 status = gpe_walk_callback(gpe_xrupt_info, gpe_block); 157 status = gpe_walk_callback(gpe_xrupt_info, gpe_block);
@@ -195,6 +197,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
195 /* Examine each GPE Register within the block */ 197 /* Examine each GPE Register within the block */
196 198
197 for (i = 0; i < gpe_block->register_count; i++) { 199 for (i = 0; i < gpe_block->register_count; i++) {
200
198 /* Now look at the individual GPEs in this byte register */ 201 /* Now look at the individual GPEs in this byte register */
199 202
200 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { 203 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
@@ -289,6 +292,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
289 292
290 gpe_number = ACPI_STRTOUL(&name[2], NULL, 16); 293 gpe_number = ACPI_STRTOUL(&name[2], NULL, 16);
291 if (gpe_number == ACPI_UINT32_MAX) { 294 if (gpe_number == ACPI_UINT32_MAX) {
295
292 /* Conversion failed; invalid method, just ignore it */ 296 /* Conversion failed; invalid method, just ignore it */
293 297
294 ACPI_ERROR((AE_INFO, 298 ACPI_ERROR((AE_INFO,
@@ -371,6 +375,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
371 status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW, 375 status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW,
372 ACPI_BTYPE_PACKAGE, &pkg_desc); 376 ACPI_BTYPE_PACKAGE, &pkg_desc);
373 if (ACPI_FAILURE(status)) { 377 if (ACPI_FAILURE(status)) {
378
374 /* Ignore all errors from _PRW, we don't want to abort the subsystem */ 379 /* Ignore all errors from _PRW, we don't want to abort the subsystem */
375 380
376 return_ACPI_STATUS(AE_OK); 381 return_ACPI_STATUS(AE_OK);
@@ -394,6 +399,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
394 obj_desc = pkg_desc->package.elements[0]; 399 obj_desc = pkg_desc->package.elements[0];
395 400
396 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 401 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
402
397 /* Use FADT-defined GPE device (from definition of _PRW) */ 403 /* Use FADT-defined GPE device (from definition of _PRW) */
398 404
399 target_gpe_device = acpi_gbl_fadt_gpe_device; 405 target_gpe_device = acpi_gbl_fadt_gpe_device;
@@ -402,6 +408,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
402 408
403 gpe_number = (u32) obj_desc->integer.value; 409 gpe_number = (u32) obj_desc->integer.value;
404 } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { 410 } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
411
405 /* Package contains a GPE reference and GPE number within a GPE block */ 412 /* Package contains a GPE reference and GPE number within a GPE block */
406 413
407 if ((obj_desc->package.count < 2) || 414 if ((obj_desc->package.count < 2) ||
@@ -679,6 +686,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
679 status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); 686 status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block);
680 687
681 if (!gpe_block->previous && !gpe_block->next) { 688 if (!gpe_block->previous && !gpe_block->next) {
689
682 /* This is the last gpe_block on this interrupt */ 690 /* This is the last gpe_block on this interrupt */
683 691
684 status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block); 692 status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block);
@@ -780,6 +788,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
780 this_event = gpe_event_info; 788 this_event = gpe_event_info;
781 789
782 for (i = 0; i < gpe_block->register_count; i++) { 790 for (i = 0; i < gpe_block->register_count; i++) {
791
783 /* Init the register_info for this GPE register (8 GPEs) */ 792 /* Init the register_info for this GPE register (8 GPEs) */
784 793
785 this_register->base_gpe_number = 794 this_register->base_gpe_number =
@@ -1013,6 +1022,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
1013 1022
1014 for (i = 0; i < gpe_block->register_count; i++) { 1023 for (i = 0; i < gpe_block->register_count; i++) {
1015 for (j = 0; j < 8; j++) { 1024 for (j = 0; j < 8; j++) {
1025
1016 /* Get the info block for this particular GPE */ 1026 /* Get the info block for this particular GPE */
1017 1027
1018 gpe_event_info = 1028 gpe_event_info =
@@ -1099,6 +1109,7 @@ acpi_status acpi_ev_gpe_initialize(void)
1099 * particular block is not supported. 1109 * particular block is not supported.
1100 */ 1110 */
1101 if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) { 1111 if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) {
1112
1102 /* GPE block 0 exists (has both length and address > 0) */ 1113 /* GPE block 0 exists (has both length and address > 0) */
1103 1114
1104 register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); 1115 register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2);
@@ -1121,6 +1132,7 @@ acpi_status acpi_ev_gpe_initialize(void)
1121 } 1132 }
1122 1133
1123 if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) { 1134 if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) {
1135
1124 /* GPE block 1 exists (has both length and address > 0) */ 1136 /* GPE block 1 exists (has both length and address > 0) */
1125 1137
1126 register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); 1138 register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2);
@@ -1168,6 +1180,7 @@ acpi_status acpi_ev_gpe_initialize(void)
1168 /* Exit if there are no GPE registers */ 1180 /* Exit if there are no GPE registers */
1169 1181
1170 if ((register_count0 + register_count1) == 0) { 1182 if ((register_count0 + register_count1) == 0) {
1183
1171 /* GPEs are not required by ACPI, this is OK */ 1184 /* GPEs are not required by ACPI, this is OK */
1172 1185
1173 ACPI_DEBUG_PRINT((ACPI_DB_INIT, 1186 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c
index 0909ba69577e..334407239f2f 100644
--- a/drivers/acpi/events/evmisc.c
+++ b/drivers/acpi/events/evmisc.c
@@ -150,6 +150,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
150 150
151 obj_desc = acpi_ns_get_attached_object(node); 151 obj_desc = acpi_ns_get_attached_object(node);
152 if (obj_desc) { 152 if (obj_desc) {
153
153 /* We have the notify object, Get the right handler */ 154 /* We have the notify object, Get the right handler */
154 155
155 switch (node->type) { 156 switch (node->type) {
@@ -240,6 +241,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
240 * to the device. 241 * to the device.
241 */ 242 */
242 if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { 243 if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) {
244
243 /* Global system notification handler */ 245 /* Global system notification handler */
244 246
245 if (acpi_gbl_system_notify.handler) { 247 if (acpi_gbl_system_notify.handler) {
@@ -297,6 +299,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context)
297 /* Signal threads that are waiting for the lock */ 299 /* Signal threads that are waiting for the lock */
298 300
299 if (acpi_gbl_global_lock_thread_count) { 301 if (acpi_gbl_global_lock_thread_count) {
302
300 /* Send sufficient units to the semaphore */ 303 /* Send sufficient units to the semaphore */
301 304
302 status = 305 status =
@@ -335,6 +338,7 @@ static u32 acpi_ev_global_lock_handler(void *context)
335 */ 338 */
336 ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); 339 ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
337 if (acquired) { 340 if (acquired) {
341
338 /* Got the lock, now wake all threads waiting for it */ 342 /* Got the lock, now wake all threads waiting for it */
339 343
340 acpi_gbl_global_lock_acquired = TRUE; 344 acpi_gbl_global_lock_acquired = TRUE;
@@ -439,6 +443,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
439 443
440 ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); 444 ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
441 if (acquired) { 445 if (acquired) {
446
442 /* We got the lock */ 447 /* We got the lock */
443 448
444 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 449 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -492,6 +497,7 @@ acpi_status acpi_ev_release_global_lock(void)
492 497
493 acpi_gbl_global_lock_thread_count--; 498 acpi_gbl_global_lock_thread_count--;
494 if (acpi_gbl_global_lock_thread_count) { 499 if (acpi_gbl_global_lock_thread_count) {
500
495 /* There are still some threads holding the lock, cannot release */ 501 /* There are still some threads holding the lock, cannot release */
496 502
497 return_ACPI_STATUS(AE_OK); 503 return_ACPI_STATUS(AE_OK);
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c
index 6da58e776413..b831ec4bcae7 100644
--- a/drivers/acpi/events/evregion.c
+++ b/drivers/acpi/events/evregion.c
@@ -164,6 +164,7 @@ acpi_status acpi_ev_initialize_op_regions(void)
164 * Run the _REG methods for op_regions in each default address space 164 * Run the _REG methods for op_regions in each default address space
165 */ 165 */
166 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { 166 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
167
167 /* TBD: Make sure handler is the DEFAULT handler, otherwise 168 /* TBD: Make sure handler is the DEFAULT handler, otherwise
168 * _REG will have already been run. 169 * _REG will have already been run.
169 */ 170 */
@@ -315,6 +316,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
315 */ 316 */
316 region_setup = handler_desc->address_space.setup; 317 region_setup = handler_desc->address_space.setup;
317 if (!region_setup) { 318 if (!region_setup) {
319
318 /* No initialization routine, exit with error */ 320 /* No initialization routine, exit with error */
319 321
320 ACPI_ERROR((AE_INFO, 322 ACPI_ERROR((AE_INFO,
@@ -361,6 +363,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
361 region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; 363 region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE;
362 364
363 if (region_obj2->extra.region_context) { 365 if (region_obj2->extra.region_context) {
366
364 /* The handler for this region was already installed */ 367 /* The handler for this region was already installed */
365 368
366 ACPI_MEM_FREE(region_context); 369 ACPI_MEM_FREE(region_context);
@@ -463,6 +466,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
463 466
464 handler_obj = region_obj->region.handler; 467 handler_obj = region_obj->region.handler;
465 if (!handler_obj) { 468 if (!handler_obj) {
469
466 /* This region has no handler, all done */ 470 /* This region has no handler, all done */
467 471
468 return_VOID; 472 return_VOID;
@@ -474,6 +478,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
474 last_obj_ptr = &handler_obj->address_space.region_list; 478 last_obj_ptr = &handler_obj->address_space.region_list;
475 479
476 while (obj_desc) { 480 while (obj_desc) {
481
477 /* Is this the correct Region? */ 482 /* Is this the correct Region? */
478 483
479 if (obj_desc == region_obj) { 484 if (obj_desc == region_obj) {
@@ -666,6 +671,7 @@ acpi_ev_install_handler(acpi_handle obj_handle,
666 671
667 obj_desc = acpi_ns_get_attached_object(node); 672 obj_desc = acpi_ns_get_attached_object(node);
668 if (!obj_desc) { 673 if (!obj_desc) {
674
669 /* No object, just exit */ 675 /* No object, just exit */
670 676
671 return (AE_OK); 677 return (AE_OK);
@@ -674,10 +680,12 @@ acpi_ev_install_handler(acpi_handle obj_handle,
674 /* Devices are handled different than regions */ 680 /* Devices are handled different than regions */
675 681
676 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) { 682 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) {
683
677 /* Check if this Device already has a handler for this address space */ 684 /* Check if this Device already has a handler for this address space */
678 685
679 next_handler_obj = obj_desc->device.handler; 686 next_handler_obj = obj_desc->device.handler;
680 while (next_handler_obj) { 687 while (next_handler_obj) {
688
681 /* Found a handler, is it for the same address space? */ 689 /* Found a handler, is it for the same address space? */
682 690
683 if (next_handler_obj->address_space.space_id == 691 if (next_handler_obj->address_space.space_id ==
@@ -839,6 +847,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
839 /* Walk the handler list for this device */ 847 /* Walk the handler list for this device */
840 848
841 while (handler_obj) { 849 while (handler_obj) {
850
842 /* Same space_id indicates a handler already installed */ 851 /* Same space_id indicates a handler already installed */
843 852
844 if (handler_obj->address_space.space_id == space_id) { 853 if (handler_obj->address_space.space_id == space_id) {
@@ -1035,6 +1044,7 @@ acpi_ev_reg_run(acpi_handle obj_handle,
1035 1044
1036 obj_desc = acpi_ns_get_attached_object(node); 1045 obj_desc = acpi_ns_get_attached_object(node);
1037 if (!obj_desc) { 1046 if (!obj_desc) {
1047
1038 /* No object, just exit */ 1048 /* No object, just exit */
1039 1049
1040 return (AE_OK); 1050 return (AE_OK);
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c
index baed8c1a1b9f..a0bffc2a0787 100644
--- a/drivers/acpi/events/evrgnini.c
+++ b/drivers/acpi/events/evrgnini.c
@@ -199,6 +199,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
199 * handlers with that device. 199 * handlers with that device.
200 */ 200 */
201 if (handler_obj->address_space.node == acpi_gbl_root_node) { 201 if (handler_obj->address_space.node == acpi_gbl_root_node) {
202
202 /* Start search from the parent object */ 203 /* Start search from the parent object */
203 204
204 pci_root_node = parent_node; 205 pci_root_node = parent_node;
@@ -220,6 +221,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
220 PCI_EXPRESS_ROOT_HID_STRING, 221 PCI_EXPRESS_ROOT_HID_STRING,
221 sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) 222 sizeof(PCI_EXPRESS_ROOT_HID_STRING)))))
222 { 223 {
224
223 /* Install a handler for this PCI root bridge */ 225 /* Install a handler for this PCI root bridge */
224 226
225 status = 227 status =
@@ -478,11 +480,13 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
478 * ie: acpi_gbl_root_node->parent_entry being set to NULL 480 * ie: acpi_gbl_root_node->parent_entry being set to NULL
479 */ 481 */
480 while (node) { 482 while (node) {
483
481 /* Check to see if a handler exists */ 484 /* Check to see if a handler exists */
482 485
483 handler_obj = NULL; 486 handler_obj = NULL;
484 obj_desc = acpi_ns_get_attached_object(node); 487 obj_desc = acpi_ns_get_attached_object(node);
485 if (obj_desc) { 488 if (obj_desc) {
489
486 /* Can only be a handler if the object exists */ 490 /* Can only be a handler if the object exists */
487 491
488 switch (node->type) { 492 switch (node->type) {
@@ -507,10 +511,12 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
507 } 511 }
508 512
509 while (handler_obj) { 513 while (handler_obj) {
514
510 /* Is this handler of the correct type? */ 515 /* Is this handler of the correct type? */
511 516
512 if (handler_obj->address_space.space_id == 517 if (handler_obj->address_space.space_id ==
513 space_id) { 518 space_id) {
519
514 /* Found correct handler */ 520 /* Found correct handler */
515 521
516 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, 522 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
index b38b39dde543..ba16fda3a158 100644
--- a/drivers/acpi/events/evxface.c
+++ b/drivers/acpi/events/evxface.c
@@ -275,6 +275,7 @@ acpi_install_notify_handler(acpi_handle device,
275 * only one <external> global handler can be regsitered (per notify type). 275 * only one <external> global handler can be regsitered (per notify type).
276 */ 276 */
277 if (device == ACPI_ROOT_OBJECT) { 277 if (device == ACPI_ROOT_OBJECT) {
278
278 /* Make sure the handler is not already installed */ 279 /* Make sure the handler is not already installed */
279 280
280 if (((handler_type & ACPI_SYSTEM_NOTIFY) && 281 if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
@@ -317,6 +318,7 @@ acpi_install_notify_handler(acpi_handle device,
317 318
318 obj_desc = acpi_ns_get_attached_object(node); 319 obj_desc = acpi_ns_get_attached_object(node);
319 if (obj_desc) { 320 if (obj_desc) {
321
320 /* Object exists - make sure there's no handler */ 322 /* Object exists - make sure there's no handler */
321 323
322 if (((handler_type & ACPI_SYSTEM_NOTIFY) && 324 if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
@@ -370,6 +372,7 @@ acpi_install_notify_handler(acpi_handle device,
370 } 372 }
371 373
372 if (handler_type == ACPI_ALL_NOTIFY) { 374 if (handler_type == ACPI_ALL_NOTIFY) {
375
373 /* Extra ref if installed in both */ 376 /* Extra ref if installed in both */
374 377
375 acpi_ut_add_reference(notify_obj); 378 acpi_ut_add_reference(notify_obj);
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c
index ec9ce8429f15..babebb501405 100644
--- a/drivers/acpi/events/evxfevnt.c
+++ b/drivers/acpi/events/evxfevnt.c
@@ -636,6 +636,7 @@ acpi_install_gpe_block(acpi_handle gpe_device,
636 636
637 obj_desc = acpi_ns_get_attached_object(node); 637 obj_desc = acpi_ns_get_attached_object(node);
638 if (!obj_desc) { 638 if (!obj_desc) {
639
639 /* No object, create a new one */ 640 /* No object, create a new one */
640 641
641 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE); 642 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE);
diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c
index abf5caca9ae5..368c8aa0094b 100644
--- a/drivers/acpi/events/evxfregn.c
+++ b/drivers/acpi/events/evxfregn.c
@@ -176,9 +176,11 @@ acpi_remove_address_space_handler(acpi_handle device,
176 handler_obj = obj_desc->device.handler; 176 handler_obj = obj_desc->device.handler;
177 last_obj_ptr = &obj_desc->device.handler; 177 last_obj_ptr = &obj_desc->device.handler;
178 while (handler_obj) { 178 while (handler_obj) {
179
179 /* We have a handler, see if user requested this one */ 180 /* We have a handler, see if user requested this one */
180 181
181 if (handler_obj->address_space.space_id == space_id) { 182 if (handler_obj->address_space.space_id == space_id) {
183
182 /* Matched space_id, first dereference this in the Regions */ 184 /* Matched space_id, first dereference this in the Regions */
183 185
184 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, 186 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c
index a29782fe3ecf..864530f754c3 100644
--- a/drivers/acpi/executer/exconfig.c
+++ b/drivers/acpi/executer/exconfig.c
@@ -110,6 +110,7 @@ acpi_ex_add_table(struct acpi_table_header *table,
110 110
111 if (ACPI_FAILURE(status)) { 111 if (ACPI_FAILURE(status)) {
112 if (status == AE_ALREADY_EXISTS) { 112 if (status == AE_ALREADY_EXISTS) {
113
113 /* Table already exists, just return the handle */ 114 /* Table already exists, just return the handle */
114 115
115 return_ACPI_STATUS(AE_OK); 116 return_ACPI_STATUS(AE_OK);
@@ -121,6 +122,7 @@ acpi_ex_add_table(struct acpi_table_header *table,
121 122
122 status = acpi_ns_load_table(table_info.installed_desc, parent_node); 123 status = acpi_ns_load_table(table_info.installed_desc, parent_node);
123 if (ACPI_FAILURE(status)) { 124 if (ACPI_FAILURE(status)) {
125
124 /* Uninstall table on error */ 126 /* Uninstall table on error */
125 127
126 (void)acpi_tb_uninstall_table(table_info.installed_desc); 128 (void)acpi_tb_uninstall_table(table_info.installed_desc);
@@ -169,6 +171,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
169 */ 171 */
170 status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); 172 status = acpi_tb_match_signature(operand[0]->string.pointer, NULL);
171 if (status == AE_OK) { 173 if (status == AE_OK) {
174
172 /* Signature matched -- don't allow override */ 175 /* Signature matched -- don't allow override */
173 176
174 return_ACPI_STATUS(AE_ALREADY_EXISTS); 177 return_ACPI_STATUS(AE_ALREADY_EXISTS);
@@ -252,6 +255,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
252 /* Parameter Data (optional) */ 255 /* Parameter Data (optional) */
253 256
254 if (parameter_node) { 257 if (parameter_node) {
258
255 /* Store the parameter data into the optional parameter object */ 259 /* Store the parameter data into the optional parameter object */
256 260
257 status = acpi_ex_store(operand[5], 261 status = acpi_ex_store(operand[5],
@@ -424,6 +428,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
424 428
425 status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); 429 status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle);
426 if (ACPI_FAILURE(status)) { 430 if (ACPI_FAILURE(status)) {
431
427 /* On error, table_ptr was deallocated above */ 432 /* On error, table_ptr was deallocated above */
428 433
429 return_ACPI_STATUS(status); 434 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c
index e6d52e12d77a..a2c93c9ba07c 100644
--- a/drivers/acpi/executer/exconvrt.c
+++ b/drivers/acpi/executer/exconvrt.c
@@ -319,6 +319,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer,
319 remainder = 0; 319 remainder = 0;
320 320
321 for (i = decimal_length; i > 0; i--) { 321 for (i = decimal_length; i > 0; i--) {
322
322 /* Divide by nth factor of 10 */ 323 /* Divide by nth factor of 10 */
323 324
324 digit = integer; 325 digit = integer;
@@ -346,6 +347,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer,
346 347
347 hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); 348 hex_length = (acpi_native_uint) ACPI_MUL_2(data_width);
348 for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { 349 for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) {
350
349 /* Get one hex digit, most significant digits first */ 351 /* Get one hex digit, most significant digits first */
350 352
351 string[k] = 353 string[k] =
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c
index a7cca8d4f855..0a53d31e09de 100644
--- a/drivers/acpi/executer/exdump.c
+++ b/drivers/acpi/executer/exdump.c
@@ -463,6 +463,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
463 } 463 }
464 464
465 if (!obj_desc) { 465 if (!obj_desc) {
466
466 /* This could be a null element of a package */ 467 /* This could be a null element of a package */
467 468
468 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n")); 469 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n"));
@@ -532,6 +533,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
532 obj_desc->reference.offset); 533 obj_desc->reference.offset);
533 534
534 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 535 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
536
535 /* Value is an Integer */ 537 /* Value is an Integer */
536 538
537 acpi_os_printf(" value is [%8.8X%8.8x]", 539 acpi_os_printf(" value is [%8.8X%8.8x]",
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c
index e259201ce9a0..215783a33c2c 100644
--- a/drivers/acpi/executer/exfield.c
+++ b/drivers/acpi/executer/exfield.c
@@ -142,6 +142,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
142 length = 142 length =
143 (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); 143 (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length);
144 if (length > acpi_gbl_integer_byte_width) { 144 if (length > acpi_gbl_integer_byte_width) {
145
145 /* Field is too large for an Integer, create a Buffer instead */ 146 /* Field is too large for an Integer, create a Buffer instead */
146 147
147 buffer_desc = acpi_ut_create_buffer_object(length); 148 buffer_desc = acpi_ut_create_buffer_object(length);
@@ -329,6 +330,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
329 ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); 330 ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length);
330 331
331 if (length < required_length) { 332 if (length < required_length) {
333
332 /* We need to create a new buffer */ 334 /* We need to create a new buffer */
333 335
334 new_buffer = ACPI_MEM_CALLOCATE(required_length); 336 new_buffer = ACPI_MEM_CALLOCATE(required_length);
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c
index bd1af35f7fcf..d5a4b2627c19 100644
--- a/drivers/acpi/executer/exfldio.c
+++ b/drivers/acpi/executer/exfldio.c
@@ -113,6 +113,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
113 } 113 }
114 114
115 if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { 115 if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) {
116
116 /* SMBus has a non-linear address space */ 117 /* SMBus has a non-linear address space */
117 118
118 return_ACPI_STATUS(AE_OK); 119 return_ACPI_STATUS(AE_OK);
@@ -491,6 +492,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
491 value)); 492 value));
492 493
493 if (read_write == ACPI_READ) { 494 if (read_write == ACPI_READ) {
495
494 /* Read the datum from the data_register */ 496 /* Read the datum from the data_register */
495 497
496 status = 498 status =
@@ -568,6 +570,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
568 /* If the mask is all ones, we don't need to worry about the update rule */ 570 /* If the mask is all ones, we don't need to worry about the update rule */
569 571
570 if (mask != ACPI_INTEGER_MAX) { 572 if (mask != ACPI_INTEGER_MAX) {
573
571 /* Decode the update rule */ 574 /* Decode the update rule */
572 575
573 switch (obj_desc->common_field. 576 switch (obj_desc->common_field.
@@ -704,6 +707,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
704 /* Read the rest of the field */ 707 /* Read the rest of the field */
705 708
706 for (i = 1; i < field_datum_count; i++) { 709 for (i = 1; i < field_datum_count; i++) {
710
707 /* Get next input datum from the field */ 711 /* Get next input datum from the field */
708 712
709 field_offset += obj_desc->common_field.access_byte_width; 713 field_offset += obj_desc->common_field.access_byte_width;
@@ -817,6 +821,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
817 /* Write the entire field */ 821 /* Write the entire field */
818 822
819 for (i = 1; i < field_datum_count; i++) { 823 for (i = 1; i < field_datum_count; i++) {
824
820 /* Write merged datum to the target field */ 825 /* Write merged datum to the target field */
821 826
822 merged_datum &= mask; 827 merged_datum &= mask;
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c
index 48c18d29222a..74f2c1a9bdaf 100644
--- a/drivers/acpi/executer/exmisc.c
+++ b/drivers/acpi/executer/exmisc.c
@@ -649,6 +649,7 @@ acpi_ex_do_logical_op(u16 opcode,
649 /* Length and all bytes must be equal */ 649 /* Length and all bytes must be equal */
650 650
651 if ((length0 == length1) && (compare == 0)) { 651 if ((length0 == length1) && (compare == 0)) {
652
652 /* Length and all bytes match ==> TRUE */ 653 /* Length and all bytes match ==> TRUE */
653 654
654 local_result = TRUE; 655 local_result = TRUE;
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c
index f843b22e20b9..eaee1de5e90d 100644
--- a/drivers/acpi/executer/exmutex.c
+++ b/drivers/acpi/executer/exmutex.c
@@ -173,6 +173,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
173 /* Support for multiple acquires by the owning thread */ 173 /* Support for multiple acquires by the owning thread */
174 174
175 if (obj_desc->mutex.owner_thread) { 175 if (obj_desc->mutex.owner_thread) {
176
176 /* Special case for Global Lock, allow all threads */ 177 /* Special case for Global Lock, allow all threads */
177 178
178 if ((obj_desc->mutex.owner_thread->thread_id == 179 if ((obj_desc->mutex.owner_thread->thread_id ==
@@ -192,6 +193,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
192 193
193 status = acpi_ex_system_acquire_mutex(time_desc, obj_desc); 194 status = acpi_ex_system_acquire_mutex(time_desc, obj_desc);
194 if (ACPI_FAILURE(status)) { 195 if (ACPI_FAILURE(status)) {
196
195 /* Includes failure from a timeout on time_desc */ 197 /* Includes failure from a timeout on time_desc */
196 198
197 return_ACPI_STATUS(status); 199 return_ACPI_STATUS(status);
@@ -286,6 +288,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
286 288
287 obj_desc->mutex.acquisition_depth--; 289 obj_desc->mutex.acquisition_depth--;
288 if (obj_desc->mutex.acquisition_depth != 0) { 290 if (obj_desc->mutex.acquisition_depth != 0) {
291
289 /* Just decrement the depth and return */ 292 /* Just decrement the depth and return */
290 293
291 return_ACPI_STATUS(AE_OK); 294 return_ACPI_STATUS(AE_OK);
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c
index 054fe5e1a314..f9bc81c1b78d 100644
--- a/drivers/acpi/executer/exnames.c
+++ b/drivers/acpi/executer/exnames.c
@@ -85,6 +85,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
85 * This may actually be somewhat longer than needed. 85 * This may actually be somewhat longer than needed.
86 */ 86 */
87 if (prefix_count == ACPI_UINT32_MAX) { 87 if (prefix_count == ACPI_UINT32_MAX) {
88
88 /* Special case for root */ 89 /* Special case for root */
89 90
90 size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; 91 size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
@@ -119,11 +120,13 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
119 /* Set up Dual or Multi prefixes if needed */ 120 /* Set up Dual or Multi prefixes if needed */
120 121
121 if (num_name_segs > 2) { 122 if (num_name_segs > 2) {
123
122 /* Set up multi prefixes */ 124 /* Set up multi prefixes */
123 125
124 *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; 126 *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP;
125 *temp_ptr++ = (char)num_name_segs; 127 *temp_ptr++ = (char)num_name_segs;
126 } else if (2 == num_name_segs) { 128 } else if (2 == num_name_segs) {
129
127 /* Set up dual prefixes */ 130 /* Set up dual prefixes */
128 131
129 *temp_ptr++ = AML_DUAL_NAME_PREFIX; 132 *temp_ptr++ = AML_DUAL_NAME_PREFIX;
@@ -184,6 +187,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
184 /* Valid name segment */ 187 /* Valid name segment */
185 188
186 if (index == 4) { 189 if (index == 4) {
190
187 /* Found 4 valid characters */ 191 /* Found 4 valid characters */
188 192
189 char_buf[4] = '\0'; 193 char_buf[4] = '\0';
@@ -254,6 +258,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
254 if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || 258 if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type ||
255 ACPI_TYPE_LOCAL_BANK_FIELD == data_type || 259 ACPI_TYPE_LOCAL_BANK_FIELD == data_type ||
256 ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { 260 ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) {
261
257 /* Disallow prefixes for types associated with field_unit names */ 262 /* Disallow prefixes for types associated with field_unit names */
258 263
259 name_string = acpi_ex_allocate_name_string(0, 1); 264 name_string = acpi_ex_allocate_name_string(0, 1);
@@ -410,6 +415,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
410 } 415 }
411 416
412 if (AE_CTRL_PENDING == status && has_prefix) { 417 if (AE_CTRL_PENDING == status && has_prefix) {
418
413 /* Ran out of segments after processing a prefix */ 419 /* Ran out of segments after processing a prefix */
414 420
415 ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); 421 ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string));
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c
index 23d0823bcd5e..4f3627ee2b2b 100644
--- a/drivers/acpi/executer/exoparg1.c
+++ b/drivers/acpi/executer/exoparg1.c
@@ -342,6 +342,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
342 for (i = 0; 342 for (i = 0;
343 (i < acpi_gbl_integer_nybble_width) && (digit > 0); 343 (i < acpi_gbl_integer_nybble_width) && (digit > 0);
344 i++) { 344 i++) {
345
345 /* Get the least significant 4-bit BCD digit */ 346 /* Get the least significant 4-bit BCD digit */
346 347
347 temp32 = ((u32) digit) & 0xF; 348 temp32 = ((u32) digit) & 0xF;
@@ -487,6 +488,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
487 status = acpi_ex_convert_to_string(operand[0], &return_desc, 488 status = acpi_ex_convert_to_string(operand[0], &return_desc,
488 ACPI_EXPLICIT_CONVERT_DECIMAL); 489 ACPI_EXPLICIT_CONVERT_DECIMAL);
489 if (return_desc == operand[0]) { 490 if (return_desc == operand[0]) {
491
490 /* No conversion performed, add ref to handle return value */ 492 /* No conversion performed, add ref to handle return value */
491 acpi_ut_add_reference(return_desc); 493 acpi_ut_add_reference(return_desc);
492 } 494 }
@@ -497,6 +499,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
497 status = acpi_ex_convert_to_string(operand[0], &return_desc, 499 status = acpi_ex_convert_to_string(operand[0], &return_desc,
498 ACPI_EXPLICIT_CONVERT_HEX); 500 ACPI_EXPLICIT_CONVERT_HEX);
499 if (return_desc == operand[0]) { 501 if (return_desc == operand[0]) {
502
500 /* No conversion performed, add ref to handle return value */ 503 /* No conversion performed, add ref to handle return value */
501 acpi_ut_add_reference(return_desc); 504 acpi_ut_add_reference(return_desc);
502 } 505 }
@@ -506,6 +509,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
506 509
507 status = acpi_ex_convert_to_buffer(operand[0], &return_desc); 510 status = acpi_ex_convert_to_buffer(operand[0], &return_desc);
508 if (return_desc == operand[0]) { 511 if (return_desc == operand[0]) {
512
509 /* No conversion performed, add ref to handle return value */ 513 /* No conversion performed, add ref to handle return value */
510 acpi_ut_add_reference(return_desc); 514 acpi_ut_add_reference(return_desc);
511 } 515 }
@@ -516,6 +520,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
516 status = acpi_ex_convert_to_integer(operand[0], &return_desc, 520 status = acpi_ex_convert_to_integer(operand[0], &return_desc,
517 ACPI_ANY_BASE); 521 ACPI_ANY_BASE);
518 if (return_desc == operand[0]) { 522 if (return_desc == operand[0]) {
523
519 /* No conversion performed, add ref to handle return value */ 524 /* No conversion performed, add ref to handle return value */
520 acpi_ut_add_reference(return_desc); 525 acpi_ut_add_reference(return_desc);
521 } 526 }
@@ -541,6 +546,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
541 } 546 }
542 547
543 if (ACPI_SUCCESS(status)) { 548 if (ACPI_SUCCESS(status)) {
549
544 /* Store the return value computed above into the target object */ 550 /* Store the return value computed above into the target object */
545 551
546 status = acpi_ex_store(return_desc, operand[1], walk_state); 552 status = acpi_ex_store(return_desc, operand[1], walk_state);
@@ -625,6 +631,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
625 temp_desc = operand[0]; 631 temp_desc = operand[0];
626 if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == 632 if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) ==
627 ACPI_DESC_TYPE_OPERAND) { 633 ACPI_DESC_TYPE_OPERAND) {
634
628 /* Internal reference object - prevent deletion */ 635 /* Internal reference object - prevent deletion */
629 636
630 acpi_ut_add_reference(temp_desc); 637 acpi_ut_add_reference(temp_desc);
@@ -777,8 +784,25 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
777 784
778 /* Check for a method local or argument, or standalone String */ 785 /* Check for a method local or argument, or standalone String */
779 786
780 if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != 787 if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) ==
781 ACPI_DESC_TYPE_NAMED) { 788 ACPI_DESC_TYPE_NAMED) {
789 temp_desc =
790 acpi_ns_get_attached_object((struct
791 acpi_namespace_node *)
792 operand[0]);
793 if (temp_desc
794 &&
795 ((ACPI_GET_OBJECT_TYPE(temp_desc) ==
796 ACPI_TYPE_STRING)
797 || (ACPI_GET_OBJECT_TYPE(temp_desc) ==
798 ACPI_TYPE_LOCAL_REFERENCE))) {
799 operand[0] = temp_desc;
800 acpi_ut_add_reference(temp_desc);
801 } else {
802 status = AE_AML_OPERAND_TYPE;
803 goto cleanup;
804 }
805 } else {
782 switch (ACPI_GET_OBJECT_TYPE(operand[0])) { 806 switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
783 case ACPI_TYPE_LOCAL_REFERENCE: 807 case ACPI_TYPE_LOCAL_REFERENCE:
784 /* 808 /*
@@ -827,13 +851,24 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
827 break; 851 break;
828 852
829 case ACPI_TYPE_STRING: 853 case ACPI_TYPE_STRING:
854 break;
830 855
856 default:
857 status = AE_AML_OPERAND_TYPE;
858 goto cleanup;
859 }
860 }
861
862 if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) !=
863 ACPI_DESC_TYPE_NAMED) {
864 if (ACPI_GET_OBJECT_TYPE(operand[0]) ==
865 ACPI_TYPE_STRING) {
831 /* 866 /*
832 * This is a deref_of (String). The string is a reference 867 * This is a deref_of (String). The string is a reference
833 * to a named ACPI object. 868 * to a named ACPI object.
834 * 869 *
835 * 1) Find the owning Node 870 * 1) Find the owning Node
836 * 2) Dereference the node to an actual object. Could be a 871 * 2) Dereference the node to an actual object. Could be a
837 * Field, so we need to resolve the node to a value. 872 * Field, so we need to resolve the node to a value.
838 */ 873 */
839 status = 874 status =
@@ -857,11 +892,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
857 (struct acpi_namespace_node, &return_desc), 892 (struct acpi_namespace_node, &return_desc),
858 walk_state); 893 walk_state);
859 goto cleanup; 894 goto cleanup;
860
861 default:
862
863 status = AE_AML_OPERAND_TYPE;
864 goto cleanup;
865 } 895 }
866 } 896 }
867 897
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c
index e263a5ddd405..5e1abb12c748 100644
--- a/drivers/acpi/executer/exoparg2.c
+++ b/drivers/acpi/executer/exoparg2.c
@@ -138,6 +138,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
138 acpi_ev_check_for_wake_only_gpe(walk_state-> 138 acpi_ev_check_for_wake_only_gpe(walk_state->
139 gpe_event_info); 139 gpe_event_info);
140 if (ACPI_FAILURE(status)) { 140 if (ACPI_FAILURE(status)) {
141
141 /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ 142 /* AE_WAKE_ONLY_GPE only error, means ignore this notify */
142 143
143 return_ACPI_STATUS(AE_OK) 144 return_ACPI_STATUS(AE_OK)
@@ -252,6 +253,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state)
252 acpi_ut_remove_reference(return_desc2); 253 acpi_ut_remove_reference(return_desc2);
253 254
254 if (ACPI_FAILURE(status)) { 255 if (ACPI_FAILURE(status)) {
256
255 /* Delete the return object */ 257 /* Delete the return object */
256 258
257 acpi_ut_remove_reference(return_desc1); 259 acpi_ut_remove_reference(return_desc1);
@@ -287,6 +289,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
287 /* Execute the opcode */ 289 /* Execute the opcode */
288 290
289 if (walk_state->op_info->flags & AML_MATH) { 291 if (walk_state->op_info->flags & AML_MATH) {
292
290 /* All simple math opcodes (add, etc.) */ 293 /* All simple math opcodes (add, etc.) */
291 294
292 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 295 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
@@ -383,54 +386,70 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
383 goto cleanup; 386 goto cleanup;
384 } 387 }
385 388
389 /* Initialize the Index reference object */
390
386 index = operand[1]->integer.value; 391 index = operand[1]->integer.value;
392 return_desc->reference.offset = (u32) index;
393 return_desc->reference.opcode = AML_INDEX_OP;
394 return_desc->reference.object = operand[0];
387 395
388 /* At this point, the Source operand is a Package, Buffer, or String */ 396 /*
397 * At this point, the Source operand is a String, Buffer, or Package.
398 * Verify that the index is within range.
399 */
400 switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
401 case ACPI_TYPE_STRING:
389 402
390 if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) { 403 if (index >= operand[0]->string.length) {
391 /* Object to be indexed is a Package */ 404 status = AE_AML_STRING_LIMIT;
405 }
406
407 return_desc->reference.target_type =
408 ACPI_TYPE_BUFFER_FIELD;
409 break;
410
411 case ACPI_TYPE_BUFFER:
412
413 if (index >= operand[0]->buffer.length) {
414 status = AE_AML_BUFFER_LIMIT;
415 }
416
417 return_desc->reference.target_type =
418 ACPI_TYPE_BUFFER_FIELD;
419 break;
420
421 case ACPI_TYPE_PACKAGE:
392 422
393 if (index >= operand[0]->package.count) { 423 if (index >= operand[0]->package.count) {
394 ACPI_ERROR((AE_INFO,
395 "Index value (%X%8.8X) beyond package end (%X)",
396 ACPI_FORMAT_UINT64(index),
397 operand[0]->package.count));
398 status = AE_AML_PACKAGE_LIMIT; 424 status = AE_AML_PACKAGE_LIMIT;
399 goto cleanup;
400 } 425 }
401 426
402 return_desc->reference.target_type = ACPI_TYPE_PACKAGE; 427 return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
403 return_desc->reference.object = operand[0];
404 return_desc->reference.where = 428 return_desc->reference.where =
405 &operand[0]->package.elements[index]; 429 &operand[0]->package.elements[index];
406 } else { 430 break;
407 /* Object to be indexed is a Buffer/String */
408 431
409 if (index >= operand[0]->buffer.length) { 432 default:
410 ACPI_ERROR((AE_INFO,
411 "Index value (%X%8.8X) beyond end of buffer (%X)",
412 ACPI_FORMAT_UINT64(index),
413 operand[0]->buffer.length));
414 status = AE_AML_BUFFER_LIMIT;
415 goto cleanup;
416 }
417 433
418 return_desc->reference.target_type = 434 status = AE_AML_INTERNAL;
419 ACPI_TYPE_BUFFER_FIELD; 435 goto cleanup;
420 return_desc->reference.object = operand[0]; 436 }
437
438 /* Failure means that the Index was beyond the end of the object */
439
440 if (ACPI_FAILURE(status)) {
441 ACPI_EXCEPTION((AE_INFO, status,
442 "Index (%X%8.8X) is beyond end of object",
443 ACPI_FORMAT_UINT64(index)));
444 goto cleanup;
421 } 445 }
422 446
423 /* 447 /*
424 * Add a reference to the target package/buffer/string for the life 448 * Add a reference to the target package/buffer/string for the life
425 * of the index. 449 * of the index
426 */ 450 */
427 acpi_ut_add_reference(operand[0]); 451 acpi_ut_add_reference(operand[0]);
428 452
429 /* Complete the Index reference object */
430
431 return_desc->reference.opcode = AML_INDEX_OP;
432 return_desc->reference.offset = (u32) index;
433
434 /* Store the reference to the Target */ 453 /* Store the reference to the Target */
435 454
436 status = acpi_ex_store(return_desc, operand[2], walk_state); 455 status = acpi_ex_store(return_desc, operand[2], walk_state);
@@ -509,6 +528,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
509 /* Execute the Opcode */ 528 /* Execute the Opcode */
510 529
511 if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { 530 if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
531
512 /* logical_op (Operand0, Operand1) */ 532 /* logical_op (Operand0, Operand1) */
513 533
514 status = acpi_ex_do_logical_numeric_op(walk_state->opcode, 534 status = acpi_ex_do_logical_numeric_op(walk_state->opcode,
@@ -518,6 +538,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
518 value, &logical_result); 538 value, &logical_result);
519 goto store_logical_result; 539 goto store_logical_result;
520 } else if (walk_state->op_info->flags & AML_LOGICAL) { 540 } else if (walk_state->op_info->flags & AML_LOGICAL) {
541
521 /* logical_op (Operand0, Operand1) */ 542 /* logical_op (Operand0, Operand1) */
522 543
523 status = acpi_ex_do_logical_op(walk_state->opcode, operand[0], 544 status = acpi_ex_do_logical_op(walk_state->opcode, operand[0],
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c
index 6a3a883cb8a3..8da794ec35b0 100644
--- a/drivers/acpi/executer/exoparg3.c
+++ b/drivers/acpi/executer/exoparg3.c
@@ -208,6 +208,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
208 /* If the requested length is zero, don't allocate a buffer */ 208 /* If the requested length is zero, don't allocate a buffer */
209 209
210 if (length > 0) { 210 if (length > 0) {
211
211 /* Allocate a new buffer for the Buffer */ 212 /* Allocate a new buffer for the Buffer */
212 213
213 buffer = ACPI_MEM_CALLOCATE(length); 214 buffer = ACPI_MEM_CALLOCATE(length);
@@ -225,6 +226,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
225 } 226 }
226 227
227 if (buffer) { 228 if (buffer) {
229
228 /* We have a buffer, copy the portion requested */ 230 /* We have a buffer, copy the portion requested */
229 231
230 ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, 232 ACPI_MEMCPY(buffer, operand[0]->string.pointer + index,
diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c
index e043d924444f..33e4fb1addce 100644
--- a/drivers/acpi/executer/exoparg6.c
+++ b/drivers/acpi/executer/exoparg6.c
@@ -276,6 +276,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
276 * match was found. 276 * match was found.
277 */ 277 */
278 for (; index < operand[0]->package.count; index++) { 278 for (; index < operand[0]->package.count; index++) {
279
279 /* Get the current package element */ 280 /* Get the current package element */
280 281
281 this_element = operand[0]->package.elements[index]; 282 this_element = operand[0]->package.elements[index];
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c
index 6a4cfdff606d..9db68d19253e 100644
--- a/drivers/acpi/executer/exregion.c
+++ b/drivers/acpi/executer/exregion.c
@@ -135,6 +135,7 @@ acpi_ex_system_memory_space_handler(u32 function,
135 * Delete the existing mapping and create a new one. 135 * Delete the existing mapping and create a new one.
136 */ 136 */
137 if (mem_info->mapped_length) { 137 if (mem_info->mapped_length) {
138
138 /* Valid mapping, delete it */ 139 /* Valid mapping, delete it */
139 140
140 acpi_os_unmap_memory(mem_info->mapped_logical_address, 141 acpi_os_unmap_memory(mem_info->mapped_logical_address,
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c
index 01b26c80d22b..417d914d9e19 100644
--- a/drivers/acpi/executer/exresnte.c
+++ b/drivers/acpi/executer/exresnte.c
@@ -103,6 +103,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
103 103
104 if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || 104 if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) ||
105 (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { 105 (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
106
106 /* There is always exactly one level of indirection */ 107 /* There is always exactly one level of indirection */
107 108
108 node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object); 109 node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object);
@@ -141,6 +142,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
141 142
142 status = acpi_ds_get_package_arguments(source_desc); 143 status = acpi_ds_get_package_arguments(source_desc);
143 if (ACPI_SUCCESS(status)) { 144 if (ACPI_SUCCESS(status)) {
145
144 /* Return an additional reference to the object */ 146 /* Return an additional reference to the object */
145 147
146 obj_desc = source_desc; 148 obj_desc = source_desc;
@@ -158,6 +160,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
158 160
159 status = acpi_ds_get_buffer_arguments(source_desc); 161 status = acpi_ds_get_buffer_arguments(source_desc);
160 if (ACPI_SUCCESS(status)) { 162 if (ACPI_SUCCESS(status)) {
163
161 /* Return an additional reference to the object */ 164 /* Return an additional reference to the object */
162 165
163 obj_desc = source_desc; 166 obj_desc = source_desc;
@@ -240,6 +243,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
240 /* This is a ddb_handle */ 243 /* This is a ddb_handle */
241 /* Return an additional reference to the object */ 244 /* Return an additional reference to the object */
242 245
246 case AML_REF_OF_OP:
247
243 obj_desc = source_desc; 248 obj_desc = source_desc;
244 acpi_ut_add_reference(obj_desc); 249 acpi_ut_add_reference(obj_desc);
245 break; 250 break;
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c
index 1deed492fe88..22dabdd10604 100644
--- a/drivers/acpi/executer/exresolv.c
+++ b/drivers/acpi/executer/exresolv.c
@@ -382,10 +382,16 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
382 while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { 382 while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
383 switch (obj_desc->reference.opcode) { 383 switch (obj_desc->reference.opcode) {
384 case AML_REF_OF_OP: 384 case AML_REF_OF_OP:
385 case AML_INT_NAMEPATH_OP:
385 386
386 /* Dereference the reference pointer */ 387 /* Dereference the reference pointer */
387 388
388 node = obj_desc->reference.object; 389 if (obj_desc->reference.opcode == AML_REF_OF_OP) {
390 node = obj_desc->reference.object;
391 } else { /* AML_INT_NAMEPATH_OP */
392
393 node = obj_desc->reference.node;
394 }
389 395
390 /* All "References" point to a NS node */ 396 /* All "References" point to a NS node */
391 397
@@ -401,6 +407,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
401 407
402 obj_desc = acpi_ns_get_attached_object(node); 408 obj_desc = acpi_ns_get_attached_object(node);
403 if (!obj_desc) { 409 if (!obj_desc) {
410
404 /* No object, use the NS node type */ 411 /* No object, use the NS node type */
405 412
406 type = acpi_ns_get_type(node); 413 type = acpi_ns_get_type(node);
@@ -432,6 +439,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
432 */ 439 */
433 obj_desc = *(obj_desc->reference.where); 440 obj_desc = *(obj_desc->reference.where);
434 if (!obj_desc) { 441 if (!obj_desc) {
442
435 /* NULL package elements are allowed */ 443 /* NULL package elements are allowed */
436 444
437 type = 0; /* Uninitialized */ 445 type = 0; /* Uninitialized */
@@ -439,39 +447,6 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
439 } 447 }
440 break; 448 break;
441 449
442 case AML_INT_NAMEPATH_OP:
443
444 /* Dereference the reference pointer */
445
446 node = obj_desc->reference.node;
447
448 /* All "References" point to a NS node */
449
450 if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
451 ACPI_DESC_TYPE_NAMED) {
452 ACPI_ERROR((AE_INFO, "Not a NS node %p [%s]",
453 node,
454 acpi_ut_get_descriptor_name(node)));
455 return_ACPI_STATUS(AE_AML_INTERNAL);
456 }
457
458 /* Get the attached object */
459
460 obj_desc = acpi_ns_get_attached_object(node);
461 if (!obj_desc) {
462 /* No object, use the NS node type */
463
464 type = acpi_ns_get_type(node);
465 goto exit;
466 }
467
468 /* Check for circular references */
469
470 if (obj_desc == operand) {
471 return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE);
472 }
473 break;
474
475 case AML_LOCAL_OP: 450 case AML_LOCAL_OP:
476 case AML_ARG_OP: 451 case AML_ARG_OP:
477 452
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c
index a1c000f5a415..42b9089dccc0 100644
--- a/drivers/acpi/executer/exresop.c
+++ b/drivers/acpi/executer/exresop.c
@@ -77,6 +77,7 @@ acpi_ex_check_object_type(acpi_object_type type_needed,
77 ACPI_FUNCTION_ENTRY(); 77 ACPI_FUNCTION_ENTRY();
78 78
79 if (type_needed == ACPI_TYPE_ANY) { 79 if (type_needed == ACPI_TYPE_ANY) {
80
80 /* All types OK, so we don't perform any typechecks */ 81 /* All types OK, so we don't perform any typechecks */
81 82
82 return (AE_OK); 83 return (AE_OK);
@@ -224,6 +225,7 @@ acpi_ex_resolve_operands(u16 opcode,
224 } 225 }
225 226
226 if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { 227 if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
228
227 /* Decode the Reference */ 229 /* Decode the Reference */
228 230
229 op_info = acpi_ps_get_opcode_info(opcode); 231 op_info = acpi_ps_get_opcode_info(opcode);
@@ -332,6 +334,7 @@ acpi_ex_resolve_operands(u16 opcode,
332 } 334 }
333 335
334 if (obj_desc->reference.opcode == AML_NAME_OP) { 336 if (obj_desc->reference.opcode == AML_NAME_OP) {
337
335 /* Convert a named reference to the actual named object */ 338 /* Convert a named reference to the actual named object */
336 339
337 temp_node = obj_desc->reference.object; 340 temp_node = obj_desc->reference.object;
@@ -662,6 +665,7 @@ acpi_ex_resolve_operands(u16 opcode,
662 } 665 }
663 666
664 if (target_op == AML_DEBUG_OP) { 667 if (target_op == AML_DEBUG_OP) {
668
665 /* Allow store of any object to the Debug object */ 669 /* Allow store of any object to the Debug object */
666 670
667 break; 671 break;
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c
index 3f020c0e2b95..287476f319f4 100644
--- a/drivers/acpi/executer/exstore.c
+++ b/drivers/acpi/executer/exstore.c
@@ -423,6 +423,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
423 } 423 }
424 424
425 if (obj_desc) { 425 if (obj_desc) {
426
426 /* Decrement reference count by the ref count of the parent package */ 427 /* Decrement reference count by the ref count of the parent package */
427 428
428 for (i = 0; i < ((union acpi_operand_object *) 429 for (i = 0; i < ((union acpi_operand_object *)
@@ -572,6 +573,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
572 /* If no implicit conversion, drop into the default case below */ 573 /* If no implicit conversion, drop into the default case below */
573 574
574 if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { 575 if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) {
576
575 /* Force execution of default (no implicit conversion) */ 577 /* Force execution of default (no implicit conversion) */
576 578
577 target_type = ACPI_TYPE_ANY; 579 target_type = ACPI_TYPE_ANY;
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c
index 42967baf760d..969f9cbbbeeb 100644
--- a/drivers/acpi/executer/exstoren.c
+++ b/drivers/acpi/executer/exstoren.c
@@ -97,6 +97,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
97 */ 97 */
98 if (ACPI_GET_OBJECT_TYPE(source_desc) == 98 if (ACPI_GET_OBJECT_TYPE(source_desc) ==
99 ACPI_TYPE_LOCAL_REFERENCE) { 99 ACPI_TYPE_LOCAL_REFERENCE) {
100
100 /* Resolve a reference object first */ 101 /* Resolve a reference object first */
101 102
102 status = 103 status =
@@ -121,6 +122,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
121 !((ACPI_GET_OBJECT_TYPE(source_desc) == 122 !((ACPI_GET_OBJECT_TYPE(source_desc) ==
122 ACPI_TYPE_LOCAL_REFERENCE) 123 ACPI_TYPE_LOCAL_REFERENCE)
123 && (source_desc->reference.opcode == AML_LOAD_OP))) { 124 && (source_desc->reference.opcode == AML_LOAD_OP))) {
125
124 /* Conversion successful but still not a valid type */ 126 /* Conversion successful but still not a valid type */
125 127
126 ACPI_ERROR((AE_INFO, 128 ACPI_ERROR((AE_INFO,
@@ -289,6 +291,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
289 } 291 }
290 292
291 if (actual_src_desc != source_desc) { 293 if (actual_src_desc != source_desc) {
294
292 /* Delete the intermediate (temporary) source object */ 295 /* Delete the intermediate (temporary) source object */
293 296
294 acpi_ut_remove_reference(actual_src_desc); 297 acpi_ut_remove_reference(actual_src_desc);
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c
index 6ab707087750..41732d382bce 100644
--- a/drivers/acpi/executer/exstorob.c
+++ b/drivers/acpi/executer/exstorob.c
@@ -91,6 +91,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
91 /* Copy source buffer to target buffer */ 91 /* Copy source buffer to target buffer */
92 92
93 if (length <= target_desc->buffer.length) { 93 if (length <= target_desc->buffer.length) {
94
94 /* Clear existing buffer and copy in the new one */ 95 /* Clear existing buffer and copy in the new one */
95 96
96 ACPI_MEMSET(target_desc->buffer.pointer, 0, 97 ACPI_MEMSET(target_desc->buffer.pointer, 0,
@@ -113,6 +114,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
113 * copy must not truncate the original buffer. 114 * copy must not truncate the original buffer.
114 */ 115 */
115 if (original_src_type == ACPI_TYPE_STRING) { 116 if (original_src_type == ACPI_TYPE_STRING) {
117
116 /* Set the new length of the target */ 118 /* Set the new length of the target */
117 119
118 target_desc->buffer.length = length; 120 target_desc->buffer.length = length;
@@ -183,6 +185,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
183 */ 185 */
184 if (target_desc->string.pointer && 186 if (target_desc->string.pointer &&
185 (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { 187 (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
188
186 /* Only free if not a pointer into the DSDT */ 189 /* Only free if not a pointer into the DSDT */
187 190
188 ACPI_MEM_FREE(target_desc->string.pointer); 191 ACPI_MEM_FREE(target_desc->string.pointer);
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c
index ea9144f42e1f..6a2e47a0e112 100644
--- a/drivers/acpi/executer/exsystem.c
+++ b/drivers/acpi/executer/exsystem.c
@@ -76,6 +76,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout)
76 } 76 }
77 77
78 if (status == AE_TIME) { 78 if (status == AE_TIME) {
79
79 /* We must wait, so unlock the interpreter */ 80 /* We must wait, so unlock the interpreter */
80 81
81 acpi_ex_exit_interpreter(); 82 acpi_ex_exit_interpreter();
@@ -90,6 +91,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout)
90 91
91 status2 = acpi_ex_enter_interpreter(); 92 status2 = acpi_ex_enter_interpreter();
92 if (ACPI_FAILURE(status2)) { 93 if (ACPI_FAILURE(status2)) {
94
93 /* Report fatal error, could not acquire interpreter */ 95 /* Report fatal error, could not acquire interpreter */
94 96
95 return_ACPI_STATUS(status2); 97 return_ACPI_STATUS(status2);
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c
index f73a61aeb7ec..8543d1a0ed31 100644
--- a/drivers/acpi/executer/exutils.c
+++ b/drivers/acpi/executer/exutils.c
@@ -194,6 +194,7 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags)
194 /* Only attempt lock if the always_lock bit is set */ 194 /* Only attempt lock if the always_lock bit is set */
195 195
196 if (field_flags & AML_FIELD_LOCK_RULE_MASK) { 196 if (field_flags & AML_FIELD_LOCK_RULE_MASK) {
197
197 /* We should attempt to get the lock, wait forever */ 198 /* We should attempt to get the lock, wait forever */
198 199
199 status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); 200 status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER);
@@ -230,10 +231,12 @@ void acpi_ex_release_global_lock(u8 locked_by_me)
230 /* Only attempt unlock if the caller locked it */ 231 /* Only attempt unlock if the caller locked it */
231 232
232 if (locked_by_me) { 233 if (locked_by_me) {
234
233 /* OK, now release the lock */ 235 /* OK, now release the lock */
234 236
235 status = acpi_ev_release_global_lock(); 237 status = acpi_ev_release_global_lock();
236 if (ACPI_FAILURE(status)) { 238 if (ACPI_FAILURE(status)) {
239
237 /* Report the error, but there isn't much else we can do */ 240 /* Report the error, but there isn't much else we can do */
238 241
239 ACPI_EXCEPTION((AE_INFO, status, 242 ACPI_EXCEPTION((AE_INFO, status,
diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c
index d84942d22dd5..729b68eb3e35 100644
--- a/drivers/acpi/hardware/hwgpe.c
+++ b/drivers/acpi/hardware/hwgpe.c
@@ -214,6 +214,7 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
214 /* Examine each GPE Register within the block */ 214 /* Examine each GPE Register within the block */
215 215
216 for (i = 0; i < gpe_block->register_count; i++) { 216 for (i = 0; i < gpe_block->register_count; i++) {
217
217 /* Disable all GPEs in this register */ 218 /* Disable all GPEs in this register */
218 219
219 status = acpi_hw_low_level_write(8, 0x00, 220 status = acpi_hw_low_level_write(8, 0x00,
@@ -250,6 +251,7 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
250 /* Examine each GPE Register within the block */ 251 /* Examine each GPE Register within the block */
251 252
252 for (i = 0; i < gpe_block->register_count; i++) { 253 for (i = 0; i < gpe_block->register_count; i++) {
254
253 /* Clear status on all GPEs in this register */ 255 /* Clear status on all GPEs in this register */
254 256
255 status = acpi_hw_low_level_write(8, 0xFF, 257 status = acpi_hw_low_level_write(8, 0xFF,
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c
index e1fe75498415..95c4ccb3a378 100644
--- a/drivers/acpi/hardware/hwregs.c
+++ b/drivers/acpi/hardware/hwregs.c
@@ -295,6 +295,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags)
295 } 295 }
296 296
297 if (ACPI_SUCCESS(status)) { 297 if (ACPI_SUCCESS(status)) {
298
298 /* Normalize the value that was read */ 299 /* Normalize the value that was read */
299 300
300 register_value = 301 register_value =
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index 89269272fd62..284a59ebcc2c 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -490,6 +490,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
490 ACPI_REGISTER_PM1_CONTROL, 490 ACPI_REGISTER_PM1_CONTROL,
491 &PM1Acontrol); 491 &PM1Acontrol);
492 if (ACPI_SUCCESS(status)) { 492 if (ACPI_SUCCESS(status)) {
493
493 /* Clear SLP_EN and SLP_TYP fields */ 494 /* Clear SLP_EN and SLP_TYP fields */
494 495
495 PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | 496 PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c
index fc10b7cb456f..ef7c98e293a9 100644
--- a/drivers/acpi/hardware/hwtimer.c
+++ b/drivers/acpi/hardware/hwtimer.c
@@ -155,6 +155,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
155 delta_ticks = end_ticks - start_ticks; 155 delta_ticks = end_ticks - start_ticks;
156 } else if (start_ticks > end_ticks) { 156 } else if (start_ticks > end_ticks) {
157 if (0 == acpi_gbl_FADT->tmr_val_ext) { 157 if (0 == acpi_gbl_FADT->tmr_val_ext) {
158
158 /* 24-bit Timer */ 159 /* 24-bit Timer */
159 160
160 delta_ticks = 161 delta_ticks =
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c
index 1149bc18fb35..6bdad8bfcf0b 100644
--- a/drivers/acpi/namespace/nsaccess.c
+++ b/drivers/acpi/namespace/nsaccess.c
@@ -98,6 +98,7 @@ acpi_status acpi_ns_root_initialize(void)
98 "Entering predefined entries into namespace\n")); 98 "Entering predefined entries into namespace\n"));
99 99
100 for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { 100 for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
101
101 /* _OSI is optional for now, will be permanent later */ 102 /* _OSI is optional for now, will be permanent later */
102 103
103 if (!ACPI_STRCMP(init_val->name, "_OSI") 104 if (!ACPI_STRCMP(init_val->name, "_OSI")
@@ -365,6 +366,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
365 * Begin examination of the actual pathname 366 * Begin examination of the actual pathname
366 */ 367 */
367 if (!pathname) { 368 if (!pathname) {
369
368 /* A Null name_path is allowed and refers to the root */ 370 /* A Null name_path is allowed and refers to the root */
369 371
370 num_segments = 0; 372 num_segments = 0;
@@ -389,6 +391,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
389 * to the current scope). 391 * to the current scope).
390 */ 392 */
391 if (*path == (u8) AML_ROOT_PREFIX) { 393 if (*path == (u8) AML_ROOT_PREFIX) {
394
392 /* Pathname is fully qualified, start from the root */ 395 /* Pathname is fully qualified, start from the root */
393 396
394 this_node = acpi_gbl_root_node; 397 this_node = acpi_gbl_root_node;
@@ -416,6 +419,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
416 this_node = prefix_node; 419 this_node = prefix_node;
417 num_carats = 0; 420 num_carats = 0;
418 while (*path == (u8) AML_PARENT_PREFIX) { 421 while (*path == (u8) AML_PARENT_PREFIX) {
422
419 /* Name is fully qualified, no search rules apply */ 423 /* Name is fully qualified, no search rules apply */
420 424
421 search_parent_flag = ACPI_NS_NO_UPSEARCH; 425 search_parent_flag = ACPI_NS_NO_UPSEARCH;
@@ -430,6 +434,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
430 num_carats++; 434 num_carats++;
431 this_node = acpi_ns_get_parent_node(this_node); 435 this_node = acpi_ns_get_parent_node(this_node);
432 if (!this_node) { 436 if (!this_node) {
437
433 /* Current scope has no parent scope */ 438 /* Current scope has no parent scope */
434 439
435 ACPI_ERROR((AE_INFO, 440 ACPI_ERROR((AE_INFO,
@@ -569,6 +574,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
569 &this_node); 574 &this_node);
570 if (ACPI_FAILURE(status)) { 575 if (ACPI_FAILURE(status)) {
571 if (status == AE_NOT_FOUND) { 576 if (status == AE_NOT_FOUND) {
577
572 /* Name not found in ACPI namespace */ 578 /* Name not found in ACPI namespace */
573 579
574 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 580 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
@@ -602,6 +608,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
602 (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && 608 (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) &&
603 (this_node->type != ACPI_TYPE_ANY) && 609 (this_node->type != ACPI_TYPE_ANY) &&
604 (this_node->type != type_to_check_for)) { 610 (this_node->type != type_to_check_for)) {
611
605 /* Complain about a type mismatch */ 612 /* Complain about a type mismatch */
606 613
607 ACPI_WARNING((AE_INFO, 614 ACPI_WARNING((AE_INFO,
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c
index 9b871f38b61b..cd26cb971a1c 100644
--- a/drivers/acpi/namespace/nsalloc.c
+++ b/drivers/acpi/namespace/nsalloc.c
@@ -115,6 +115,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
115 } 115 }
116 116
117 if (prev_node) { 117 if (prev_node) {
118
118 /* Node is not first child, unlink it */ 119 /* Node is not first child, unlink it */
119 120
120 prev_node->peer = next_node->peer; 121 prev_node->peer = next_node->peer;
@@ -125,6 +126,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
125 /* Node is first child (has no previous peer) */ 126 /* Node is first child (has no previous peer) */
126 127
127 if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { 128 if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
129
128 /* No peers at all */ 130 /* No peers at all */
129 131
130 parent_node->child = NULL; 132 parent_node->child = NULL;
@@ -264,6 +266,7 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
264 * Deallocate all children at this level 266 * Deallocate all children at this level
265 */ 267 */
266 do { 268 do {
269
267 /* Get the things we need */ 270 /* Get the things we need */
268 271
269 next_node = child_node->peer; 272 next_node = child_node->peer;
@@ -352,11 +355,13 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
352 * to where we started. 355 * to where we started.
353 */ 356 */
354 while (level > 0) { 357 while (level > 0) {
358
355 /* Get the next node in this scope (NULL if none) */ 359 /* Get the next node in this scope (NULL if none) */
356 360
357 child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, 361 child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
358 child_node); 362 child_node);
359 if (child_node) { 363 if (child_node) {
364
360 /* Found a child node - detach any attached object */ 365 /* Found a child node - detach any attached object */
361 366
362 acpi_ns_detach_object(child_node); 367 acpi_ns_detach_object(child_node);
@@ -427,6 +432,7 @@ static void acpi_ns_remove_reference(struct acpi_namespace_node *node)
427 */ 432 */
428 this_node = node; 433 this_node = node;
429 while (this_node) { 434 while (this_node) {
435
430 /* Prepare to move up to parent */ 436 /* Prepare to move up to parent */
431 437
432 parent_node = acpi_ns_get_parent_node(this_node); 438 parent_node = acpi_ns_get_parent_node(this_node);
@@ -438,6 +444,7 @@ static void acpi_ns_remove_reference(struct acpi_namespace_node *node)
438 /* Delete the node if no more references */ 444 /* Delete the node if no more references */
439 445
440 if (!this_node->reference_count) { 446 if (!this_node->reference_count) {
447
441 /* Delete all children and delete the node */ 448 /* Delete all children and delete the node */
442 449
443 acpi_ns_delete_children(this_node); 450 acpi_ns_delete_children(this_node);
@@ -500,6 +507,7 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
500 507
501 if (child_node) { 508 if (child_node) {
502 if (child_node->owner_id == owner_id) { 509 if (child_node->owner_id == owner_id) {
510
503 /* Found a matching child node - detach any attached object */ 511 /* Found a matching child node - detach any attached object */
504 512
505 acpi_ns_detach_object(child_node); 513 acpi_ns_detach_object(child_node);
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c
index a2807317a84b..e275373b1705 100644
--- a/drivers/acpi/namespace/nsdump.c
+++ b/drivers/acpi/namespace/nsdump.c
@@ -191,6 +191,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
191 } 191 }
192 192
193 if (!(info->display_type & ACPI_DISPLAY_SHORT)) { 193 if (!(info->display_type & ACPI_DISPLAY_SHORT)) {
194
194 /* Indent the object according to the level */ 195 /* Indent the object according to the level */
195 196
196 acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); 197 acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " ");
@@ -226,6 +227,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
226 case ACPI_DISPLAY_SUMMARY: 227 case ACPI_DISPLAY_SUMMARY:
227 228
228 if (!obj_desc) { 229 if (!obj_desc) {
230
229 /* No attached object, we are done */ 231 /* No attached object, we are done */
230 232
231 acpi_os_printf("\n"); 233 acpi_os_printf("\n");
@@ -419,6 +421,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
419 421
420 acpi_os_printf("O:%p", obj_desc); 422 acpi_os_printf("O:%p", obj_desc);
421 if (!obj_desc) { 423 if (!obj_desc) {
424
422 /* No attached object, we are done */ 425 /* No attached object, we are done */
423 426
424 acpi_os_printf("\n"); 427 acpi_os_printf("\n");
@@ -682,6 +685,7 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth)
682 } 685 }
683 686
684 if (ACPI_NS_ALL == search_base) { 687 if (ACPI_NS_ALL == search_base) {
688
685 /* Entire namespace */ 689 /* Entire namespace */
686 690
687 search_handle = acpi_gbl_root_node; 691 search_handle = acpi_gbl_root_node;
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c
index 19d7b94d40c3..80ef95545636 100644
--- a/drivers/acpi/namespace/nseval.c
+++ b/drivers/acpi/namespace/nseval.c
@@ -326,6 +326,7 @@ acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info)
326 * Check if there is a return value on the stack that must be dealt with 326 * Check if there is a return value on the stack that must be dealt with
327 */ 327 */
328 if (status == AE_CTRL_RETURN_VALUE) { 328 if (status == AE_CTRL_RETURN_VALUE) {
329
329 /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ 330 /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
330 331
331 status = AE_OK; 332 status = AE_OK;
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c
index 9f929e479fd8..9aa337c33887 100644
--- a/drivers/acpi/namespace/nsinit.c
+++ b/drivers/acpi/namespace/nsinit.c
@@ -366,6 +366,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
366 status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI), 366 status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI),
367 device_node, ACPI_TYPE_METHOD, &ini_node); 367 device_node, ACPI_TYPE_METHOD, &ini_node);
368 if (ACPI_FAILURE(status)) { 368 if (ACPI_FAILURE(status)) {
369
369 /* No _INI method found - move on to next device */ 370 /* No _INI method found - move on to next device */
370 371
371 return_ACPI_STATUS(AE_OK); 372 return_ACPI_STATUS(AE_OK);
@@ -386,6 +387,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
386 387
387 status = acpi_ut_execute_STA(pinfo.node, &flags); 388 status = acpi_ut_execute_STA(pinfo.node, &flags);
388 if (ACPI_FAILURE(status)) { 389 if (ACPI_FAILURE(status)) {
390
389 /* Ignore error and move on to next device */ 391 /* Ignore error and move on to next device */
390 392
391 return_ACPI_STATUS(AE_OK); 393 return_ACPI_STATUS(AE_OK);
@@ -396,6 +398,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
396 } 398 }
397 399
398 if (!(flags & ACPI_STA_DEVICE_PRESENT)) { 400 if (!(flags & ACPI_STA_DEVICE_PRESENT)) {
401
399 /* Don't look at children of a not present device */ 402 /* Don't look at children of a not present device */
400 403
401 return_ACPI_STATUS(AE_CTRL_DEPTH); 404 return_ACPI_STATUS(AE_CTRL_DEPTH);
@@ -412,6 +415,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
412 pinfo.node = ini_node; 415 pinfo.node = ini_node;
413 status = acpi_ns_evaluate_by_handle(&pinfo); 416 status = acpi_ns_evaluate_by_handle(&pinfo);
414 if (ACPI_FAILURE(status)) { 417 if (ACPI_FAILURE(status)) {
418
415 /* Ignore error and move on to next device */ 419 /* Ignore error and move on to next device */
416 420
417#ifdef ACPI_DEBUG_OUTPUT 421#ifdef ACPI_DEBUG_OUTPUT
@@ -435,6 +439,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
435 } 439 }
436 440
437 if (acpi_gbl_init_handler) { 441 if (acpi_gbl_init_handler) {
442
438 /* External initialization handler is present, call it */ 443 /* External initialization handler is present, call it */
439 444
440 status = 445 status =
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c
index 4e0b0524c188..80acfd35f3ec 100644
--- a/drivers/acpi/namespace/nsload.c
+++ b/drivers/acpi/namespace/nsload.c
@@ -84,6 +84,7 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc,
84 if (! 84 if (!
85 (acpi_gbl_table_data[table_desc->type]. 85 (acpi_gbl_table_data[table_desc->type].
86 flags & ACPI_TABLE_EXECUTABLE)) { 86 flags & ACPI_TABLE_EXECUTABLE)) {
87
87 /* Just ignore this table */ 88 /* Just ignore this table */
88 89
89 return_ACPI_STATUS(AE_OK); 90 return_ACPI_STATUS(AE_OK);
@@ -325,6 +326,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
325 * to where we started. 326 * to where we started.
326 */ 327 */
327 while (level > 0) { 328 while (level > 0) {
329
328 /* Attempt to get the next object in this scope */ 330 /* Attempt to get the next object in this scope */
329 331
330 status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, 332 status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle,
@@ -335,6 +337,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
335 /* Did we get a new object? */ 337 /* Did we get a new object? */
336 338
337 if (ACPI_SUCCESS(status)) { 339 if (ACPI_SUCCESS(status)) {
340
338 /* Check if this object has any children */ 341 /* Check if this object has any children */
339 342
340 if (ACPI_SUCCESS 343 if (ACPI_SUCCESS
diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c
index 10ae6292bca4..39dc87b228fc 100644
--- a/drivers/acpi/namespace/nsobject.c
+++ b/drivers/acpi/namespace/nsobject.c
@@ -82,6 +82,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node,
82 * Parameter validation 82 * Parameter validation
83 */ 83 */
84 if (!node) { 84 if (!node) {
85
85 /* Invalid handle */ 86 /* Invalid handle */
86 87
87 ACPI_ERROR((AE_INFO, "Null named_obj handle")); 88 ACPI_ERROR((AE_INFO, "Null named_obj handle"));
@@ -89,6 +90,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node,
89 } 90 }
90 91
91 if (!object && (ACPI_TYPE_ANY != type)) { 92 if (!object && (ACPI_TYPE_ANY != type)) {
93
92 /* Null object */ 94 /* Null object */
93 95
94 ACPI_ERROR((AE_INFO, 96 ACPI_ERROR((AE_INFO,
@@ -97,6 +99,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node,
97 } 99 }
98 100
99 if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { 101 if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
102
100 /* Not a name handle */ 103 /* Not a name handle */
101 104
102 ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]", 105 ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]",
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c
index d64b78952f24..f73a3d566168 100644
--- a/drivers/acpi/namespace/nssearch.c
+++ b/drivers/acpi/namespace/nssearch.c
@@ -114,9 +114,11 @@ acpi_ns_search_node(u32 target_name,
114 */ 114 */
115 next_node = node->child; 115 next_node = node->child;
116 while (next_node) { 116 while (next_node) {
117
117 /* Check for match against the name */ 118 /* Check for match against the name */
118 119
119 if (next_node->name.integer == target_name) { 120 if (next_node->name.integer == target_name) {
121
120 /* Resolve a control method alias if any */ 122 /* Resolve a control method alias if any */
121 123
122 if (acpi_ns_get_type(next_node) == 124 if (acpi_ns_get_type(next_node) ==
@@ -146,6 +148,7 @@ acpi_ns_search_node(u32 target_name,
146 * so a flag is used to indicate the end-of-list 148 * so a flag is used to indicate the end-of-list
147 */ 149 */
148 if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { 150 if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
151
149 /* Searched entire list, we are done */ 152 /* Searched entire list, we are done */
150 153
151 break; 154 break;
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c
index 3e7cad549a38..e8c779114bec 100644
--- a/drivers/acpi/namespace/nsutils.c
+++ b/drivers/acpi/namespace/nsutils.c
@@ -83,6 +83,7 @@ acpi_ns_report_error(char *module_name,
83 acpi_ut_report_error(module_name, line_number); 83 acpi_ut_report_error(module_name, line_number);
84 84
85 if (lookup_status == AE_BAD_CHARACTER) { 85 if (lookup_status == AE_BAD_CHARACTER) {
86
86 /* There is a non-ascii character in the name */ 87 /* There is a non-ascii character in the name */
87 88
88 acpi_os_printf("[0x%4.4X] (NON-ASCII)", 89 acpi_os_printf("[0x%4.4X] (NON-ASCII)",
@@ -267,6 +268,7 @@ u32 acpi_ns_local(acpi_object_type type)
267 ACPI_FUNCTION_TRACE("ns_local"); 268 ACPI_FUNCTION_TRACE("ns_local");
268 269
269 if (!acpi_ut_valid_object_type(type)) { 270 if (!acpi_ut_valid_object_type(type)) {
271
270 /* Type code out of range */ 272 /* Type code out of range */
271 273
272 ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); 274 ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type));
@@ -411,6 +413,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
411 for (i = 0; i < ACPI_NAME_SIZE; i++) { 413 for (i = 0; i < ACPI_NAME_SIZE; i++) {
412 if (acpi_ns_valid_path_separator(*external_name) || 414 if (acpi_ns_valid_path_separator(*external_name) ||
413 (*external_name == 0)) { 415 (*external_name == 0)) {
416
414 /* Pad the segment with underscore(s) if segment is short */ 417 /* Pad the segment with underscore(s) if segment is short */
415 418
416 result[i] = '_'; 419 result[i] = '_';
@@ -795,6 +798,7 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
795 ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type)); 798 ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type));
796 799
797 if (!acpi_ut_valid_object_type(type)) { 800 if (!acpi_ut_valid_object_type(type)) {
801
798 /* type code out of range */ 802 /* type code out of range */
799 803
800 ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); 804 ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type));
@@ -838,6 +842,7 @@ acpi_ns_get_node_by_path(char *pathname,
838 ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname); 842 ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname);
839 843
840 if (pathname) { 844 if (pathname) {
845
841 /* Convert path to internal representation */ 846 /* Convert path to internal representation */
842 847
843 status = acpi_ns_internalize_name(pathname, &internal_path); 848 status = acpi_ns_internalize_name(pathname, &internal_path);
@@ -963,6 +968,7 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node)
963 ACPI_FUNCTION_TRACE("ns_find_parent_name"); 968 ACPI_FUNCTION_TRACE("ns_find_parent_name");
964 969
965 if (child_node) { 970 if (child_node) {
971
966 /* Valid entry. Get the parent Node */ 972 /* Valid entry. Get the parent Node */
967 973
968 parent_node = acpi_ns_get_parent_node(child_node); 974 parent_node = acpi_ns_get_parent_node(child_node);
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c
index fcab1e784b81..6bbc734bfee2 100644
--- a/drivers/acpi/namespace/nswalk.c
+++ b/drivers/acpi/namespace/nswalk.c
@@ -76,6 +76,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
76 ACPI_FUNCTION_ENTRY(); 76 ACPI_FUNCTION_ENTRY();
77 77
78 if (!child_node) { 78 if (!child_node) {
79
79 /* It's really the parent's _scope_ that we want */ 80 /* It's really the parent's _scope_ that we want */
80 81
81 if (parent_node->child) { 82 if (parent_node->child) {
@@ -92,6 +93,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
92 /* If any type is OK, we are done */ 93 /* If any type is OK, we are done */
93 94
94 if (type == ACPI_TYPE_ANY) { 95 if (type == ACPI_TYPE_ANY) {
96
95 /* next_node is NULL if we are at the end-of-list */ 97 /* next_node is NULL if we are at the end-of-list */
96 98
97 return (next_node); 99 return (next_node);
@@ -100,6 +102,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
100 /* Must search for the node -- but within this scope only */ 102 /* Must search for the node -- but within this scope only */
101 103
102 while (next_node) { 104 while (next_node) {
105
103 /* If type matches, we are done */ 106 /* If type matches, we are done */
104 107
105 if (next_node->type == type) { 108 if (next_node->type == type) {
@@ -182,6 +185,7 @@ acpi_ns_walk_namespace(acpi_object_type type,
182 * bubbled up to (and passed) the original parent handle (start_entry) 185 * bubbled up to (and passed) the original parent handle (start_entry)
183 */ 186 */
184 while (level > 0) { 187 while (level > 0) {
188
185 /* Get the next node in this scope. Null if not found */ 189 /* Get the next node in this scope. Null if not found */
186 190
187 status = AE_OK; 191 status = AE_OK;
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c
index a95f636dc35d..71e7769d7daf 100644
--- a/drivers/acpi/namespace/nsxfeval.c
+++ b/drivers/acpi/namespace/nsxfeval.c
@@ -110,6 +110,7 @@ acpi_evaluate_object_typed(acpi_handle handle,
110 } 110 }
111 111
112 if (return_buffer->length == 0) { 112 if (return_buffer->length == 0) {
113
113 /* Error because caller specifically asked for a return value */ 114 /* Error because caller specifically asked for a return value */
114 115
115 ACPI_ERROR((AE_INFO, "No return value")); 116 ACPI_ERROR((AE_INFO, "No return value"));
@@ -131,6 +132,7 @@ acpi_evaluate_object_typed(acpi_handle handle,
131 acpi_ut_get_type_name(return_type))); 132 acpi_ut_get_type_name(return_type)));
132 133
133 if (must_free) { 134 if (must_free) {
135
134 /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ 136 /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
135 137
136 acpi_os_free(return_buffer->pointer); 138 acpi_os_free(return_buffer->pointer);
@@ -224,9 +226,9 @@ acpi_evaluate_object(acpi_handle handle,
224 * 3) Valid handle 226 * 3) Valid handle
225 */ 227 */
226 if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { 228 if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) {
227 /* 229
228 * The path is fully qualified, just evaluate by name 230 /* The path is fully qualified, just evaluate by name */
229 */ 231
230 status = acpi_ns_evaluate_by_name(pathname, &info); 232 status = acpi_ns_evaluate_by_name(pathname, &info);
231 } else if (!handle) { 233 } else if (!handle) {
232 /* 234 /*
@@ -235,11 +237,12 @@ acpi_evaluate_object(acpi_handle handle,
235 * qualified names above, this is an error 237 * qualified names above, this is an error
236 */ 238 */
237 if (!pathname) { 239 if (!pathname) {
238 ACPI_ERROR((AE_INFO, 240 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
239 "Both Handle and Pathname are NULL")); 241 "Both Handle and Pathname are NULL"));
240 } else { 242 } else {
241 ACPI_ERROR((AE_INFO, 243 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
242 "Handle is NULL and Pathname is relative")); 244 "Null Handle with relative pathname [%s]",
245 pathname));
243 } 246 }
244 247
245 status = AE_BAD_PARAMETER; 248 status = AE_BAD_PARAMETER;
@@ -256,9 +259,8 @@ acpi_evaluate_object(acpi_handle handle,
256 */ 259 */
257 status = acpi_ns_evaluate_by_handle(&info); 260 status = acpi_ns_evaluate_by_handle(&info);
258 } else { 261 } else {
259 /* 262 /* Both a Handle and a relative Pathname */
260 * Both a Handle and a relative Pathname 263
261 */
262 status = acpi_ns_evaluate_relative(pathname, &info); 264 status = acpi_ns_evaluate_relative(pathname, &info);
263 } 265 }
264 } 266 }
@@ -295,6 +297,7 @@ acpi_evaluate_object(acpi_handle handle,
295 acpi_ut_get_object_size(info.return_object, 297 acpi_ut_get_object_size(info.return_object,
296 &buffer_space_needed); 298 &buffer_space_needed);
297 if (ACPI_SUCCESS(status)) { 299 if (ACPI_SUCCESS(status)) {
300
298 /* Validate/Allocate/Clear caller buffer */ 301 /* Validate/Allocate/Clear caller buffer */
299 302
300 status = 303 status =
@@ -303,7 +306,8 @@ acpi_evaluate_object(acpi_handle handle,
303 buffer_space_needed); 306 buffer_space_needed);
304 if (ACPI_FAILURE(status)) { 307 if (ACPI_FAILURE(status)) {
305 /* 308 /*
306 * Caller's buffer is too small or a new one can't be allocated 309 * Caller's buffer is too small or a new one can't
310 * be allocated
307 */ 311 */
308 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 312 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
309 "Needed buffer size %X, %s\n", 313 "Needed buffer size %X, %s\n",
@@ -312,9 +316,8 @@ acpi_evaluate_object(acpi_handle handle,
312 acpi_format_exception 316 acpi_format_exception
313 (status))); 317 (status)));
314 } else { 318 } else {
315 /* 319 /* We have enough space for the object, build it */
316 * We have enough space for the object, build it 320
317 */
318 status = 321 status =
319 acpi_ut_copy_iobject_to_eobject 322 acpi_ut_copy_iobject_to_eobject
320 (info.return_object, 323 (info.return_object,
@@ -341,10 +344,10 @@ acpi_evaluate_object(acpi_handle handle,
341 } 344 }
342 } 345 }
343 346
344 /* 347 /* Free the input parameter list (if we created one) */
345 * Free the input parameter list (if we created one), 348
346 */
347 if (info.parameters) { 349 if (info.parameters) {
350
348 /* Free the allocated parameter block */ 351 /* Free the allocated parameter block */
349 352
350 acpi_ut_delete_internal_object_list(info.parameters); 353 acpi_ut_delete_internal_object_list(info.parameters);
@@ -473,6 +476,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
473 } 476 }
474 477
475 if (!(flags & ACPI_STA_DEVICE_PRESENT)) { 478 if (!(flags & ACPI_STA_DEVICE_PRESENT)) {
479
476 /* Don't examine children of the device if not present */ 480 /* Don't examine children of the device if not present */
477 481
478 return (AE_CTRL_DEPTH); 482 return (AE_CTRL_DEPTH);
@@ -489,6 +493,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
489 } 493 }
490 494
491 if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { 495 if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) {
496
492 /* Get the list of Compatible IDs */ 497 /* Get the list of Compatible IDs */
493 498
494 status = acpi_ut_execute_CID(node, &cid); 499 status = acpi_ut_execute_CID(node, &cid);
@@ -563,9 +568,9 @@ acpi_get_devices(char *HID,
563 * We're going to call their callback from OUR callback, so we need 568 * We're going to call their callback from OUR callback, so we need
564 * to know what it is, and their context parameter. 569 * to know what it is, and their context parameter.
565 */ 570 */
571 info.hid = HID;
566 info.context = context; 572 info.context = context;
567 info.user_function = user_function; 573 info.user_function = user_function;
568 info.hid = HID;
569 574
570 /* 575 /*
571 * Lock the namespace around the walk. 576 * Lock the namespace around the walk.
@@ -578,9 +583,8 @@ acpi_get_devices(char *HID,
578 return_ACPI_STATUS(status); 583 return_ACPI_STATUS(status);
579 } 584 }
580 585
581 status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, 586 status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
582 ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, 587 ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
583 ACPI_NS_WALK_UNLOCK,
584 acpi_ns_get_device_callback, &info, 588 acpi_ns_get_device_callback, &info,
585 return_value); 589 return_value);
586 590
diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c
index 8cd8675a47c0..55d26624ab9f 100644
--- a/drivers/acpi/namespace/nsxfname.c
+++ b/drivers/acpi/namespace/nsxfname.c
@@ -162,6 +162,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
162 } 162 }
163 163
164 if (name_type == ACPI_FULL_PATHNAME) { 164 if (name_type == ACPI_FULL_PATHNAME) {
165
165 /* Get the full pathname (From the namespace root) */ 166 /* Get the full pathname (From the namespace root) */
166 167
167 status = acpi_ns_handle_to_pathname(handle, buffer); 168 status = acpi_ns_handle_to_pathname(handle, buffer);
diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c
index a0332595677a..9c5f3302799c 100644
--- a/drivers/acpi/namespace/nsxfobj.c
+++ b/drivers/acpi/namespace/nsxfobj.c
@@ -206,6 +206,7 @@ acpi_get_next_object(acpi_object_type type,
206 /* If null handle, use the parent */ 206 /* If null handle, use the parent */
207 207
208 if (!child) { 208 if (!child) {
209
209 /* Start search at the beginning of the specified scope */ 210 /* Start search at the beginning of the specified scope */
210 211
211 parent_node = acpi_ns_map_handle_to_node(parent); 212 parent_node = acpi_ns_map_handle_to_node(parent);
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c
index de573be52718..1c5934fe1853 100644
--- a/drivers/acpi/parser/psargs.c
+++ b/drivers/acpi/parser/psargs.c
@@ -275,6 +275,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
275 */ 275 */
276 if (ACPI_SUCCESS(status) && 276 if (ACPI_SUCCESS(status) &&
277 possible_method_call && (node->type == ACPI_TYPE_METHOD)) { 277 possible_method_call && (node->type == ACPI_TYPE_METHOD)) {
278
278 /* This name is actually a control method invocation */ 279 /* This name is actually a control method invocation */
279 280
280 method_desc = acpi_ns_get_attached_object(node); 281 method_desc = acpi_ns_get_attached_object(node);
@@ -319,6 +320,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
319 * some not_found cases are allowed 320 * some not_found cases are allowed
320 */ 321 */
321 if (status == AE_NOT_FOUND) { 322 if (status == AE_NOT_FOUND) {
323
322 /* 1) not_found is ok during load pass 1/2 (allow forward references) */ 324 /* 1) not_found is ok during load pass 1/2 (allow forward references) */
323 325
324 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != 326 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) !=
@@ -354,6 +356,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
354 356
355 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == 357 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
356 ACPI_PARSE_EXECUTE) { 358 ACPI_PARSE_EXECUTE) {
359
357 /* Report a control method execution error */ 360 /* Report a control method execution error */
358 361
359 status = acpi_ds_method_error(status, walk_state); 362 status = acpi_ds_method_error(status, walk_state);
@@ -620,6 +623,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
620 case ARGP_FIELDLIST: 623 case ARGP_FIELDLIST:
621 624
622 if (parser_state->aml < parser_state->pkg_end) { 625 if (parser_state->aml < parser_state->pkg_end) {
626
623 /* Non-empty list */ 627 /* Non-empty list */
624 628
625 while (parser_state->aml < parser_state->pkg_end) { 629 while (parser_state->aml < parser_state->pkg_end) {
@@ -645,6 +649,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
645 case ARGP_BYTELIST: 649 case ARGP_BYTELIST:
646 650
647 if (parser_state->aml < parser_state->pkg_end) { 651 if (parser_state->aml < parser_state->pkg_end) {
652
648 /* Non-empty list */ 653 /* Non-empty list */
649 654
650 arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP); 655 arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
@@ -673,6 +678,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
673 if (subop == 0 || 678 if (subop == 0 ||
674 acpi_ps_is_leading_char(subop) || 679 acpi_ps_is_leading_char(subop) ||
675 acpi_ps_is_prefix_char(subop)) { 680 acpi_ps_is_prefix_char(subop)) {
681
676 /* null_name or name_string */ 682 /* null_name or name_string */
677 683
678 arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); 684 arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
@@ -703,6 +709,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
703 case ARGP_OBJLIST: 709 case ARGP_OBJLIST:
704 710
705 if (parser_state->aml < parser_state->pkg_end) { 711 if (parser_state->aml < parser_state->pkg_end) {
712
706 /* Non-empty list of variable arguments, nothing returned */ 713 /* Non-empty list of variable arguments, nothing returned */
707 714
708 walk_state->arg_count = ACPI_VAR_ARGS; 715 walk_state->arg_count = ACPI_VAR_ARGS;
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c
index 00b072e15d19..42062d5abc9e 100644
--- a/drivers/acpi/parser/psloop.c
+++ b/drivers/acpi/parser/psloop.c
@@ -95,6 +95,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
95#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) 95#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
96 96
97 if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { 97 if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
98
98 /* We are restarting a preempted control method */ 99 /* We are restarting a preempted control method */
99 100
100 if (acpi_ps_has_completed_scope(parser_state)) { 101 if (acpi_ps_has_completed_scope(parser_state)) {
@@ -143,6 +144,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
143 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, 144 ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
144 "Popped scope, Op=%p\n", op)); 145 "Popped scope, Op=%p\n", op));
145 } else if (walk_state->prev_op) { 146 } else if (walk_state->prev_op) {
147
146 /* We were in the middle of an op */ 148 /* We were in the middle of an op */
147 149
148 op = walk_state->prev_op; 150 op = walk_state->prev_op;
@@ -156,6 +158,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
156 while ((parser_state->aml < parser_state->aml_end) || (op)) { 158 while ((parser_state->aml < parser_state->aml_end) || (op)) {
157 aml_op_start = parser_state->aml; 159 aml_op_start = parser_state->aml;
158 if (!op) { 160 if (!op) {
161
159 /* Get the next opcode from the AML stream */ 162 /* Get the next opcode from the AML stream */
160 163
161 walk_state->aml_offset = 164 walk_state->aml_offset =
@@ -213,6 +216,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
213 /* Create Op structure and append to parent's argument list */ 216 /* Create Op structure and append to parent's argument list */
214 217
215 if (walk_state->op_info->flags & AML_NAMED) { 218 if (walk_state->op_info->flags & AML_NAMED) {
219
216 /* Allocate a new pre_op if necessary */ 220 /* Allocate a new pre_op if necessary */
217 221
218 if (!pre_op) { 222 if (!pre_op) {
@@ -388,6 +392,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
388 /* Are there any arguments that must be processed? */ 392 /* Are there any arguments that must be processed? */
389 393
390 if (walk_state->arg_types) { 394 if (walk_state->arg_types) {
395
391 /* Get arguments */ 396 /* Get arguments */
392 397
393 switch (op->common.aml_opcode) { 398 switch (op->common.aml_opcode) {
@@ -853,6 +858,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
853 } 858 }
854 859
855 else if (ACPI_FAILURE(status)) { 860 else if (ACPI_FAILURE(status)) {
861
856 /* First error is most important */ 862 /* First error is most important */
857 863
858 (void) 864 (void)
diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c
index 11d6351ab8b2..9eb8d0663886 100644
--- a/drivers/acpi/parser/psopcode.c
+++ b/drivers/acpi/parser/psopcode.c
@@ -731,6 +731,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
731 * Detect normal 8-bit opcode or extended 16-bit opcode 731 * Detect normal 8-bit opcode or extended 16-bit opcode
732 */ 732 */
733 if (!(opcode & 0xFF00)) { 733 if (!(opcode & 0xFF00)) {
734
734 /* Simple (8-bit) opcode: 0-255, can't index beyond table */ 735 /* Simple (8-bit) opcode: 0-255, can't index beyond table */
735 736
736 return (&acpi_gbl_aml_op_info 737 return (&acpi_gbl_aml_op_info
@@ -739,6 +740,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
739 740
740 if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && 741 if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
741 (((u8) opcode) <= MAX_EXTENDED_OPCODE)) { 742 (((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
743
742 /* Valid extended (16-bit) opcode */ 744 /* Valid extended (16-bit) opcode */
743 745
744 return (&acpi_gbl_aml_op_info 746 return (&acpi_gbl_aml_op_info
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c
index a9f3229f4106..83d8916bc1af 100644
--- a/drivers/acpi/parser/psparse.c
+++ b/drivers/acpi/parser/psparse.c
@@ -106,6 +106,7 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)
106 opcode = (u16) ACPI_GET8(aml); 106 opcode = (u16) ACPI_GET8(aml);
107 107
108 if (opcode == AML_EXTENDED_OP_PREFIX) { 108 if (opcode == AML_EXTENDED_OP_PREFIX) {
109
109 /* Extended opcode, get the second opcode byte */ 110 /* Extended opcode, get the second opcode byte */
110 111
111 aml++; 112 aml++;
@@ -158,6 +159,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
158 if (op->common.parent) { 159 if (op->common.parent) {
159 prev = op->common.parent->common.value.arg; 160 prev = op->common.parent->common.value.arg;
160 if (!prev) { 161 if (!prev) {
162
161 /* Nothing more to do */ 163 /* Nothing more to do */
162 164
163 goto cleanup; 165 goto cleanup;
@@ -245,6 +247,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
245 /* We must unlink this op from the parent tree */ 247 /* We must unlink this op from the parent tree */
246 248
247 if (prev == op) { 249 if (prev == op) {
250
248 /* This op is the first in the list */ 251 /* This op is the first in the list */
249 252
250 if (replacement_op) { 253 if (replacement_op) {
@@ -265,6 +268,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
265 268
266 else 269 else
267 while (prev) { 270 while (prev) {
271
268 /* Traverse all siblings in the parent's argument list */ 272 /* Traverse all siblings in the parent's argument list */
269 273
270 next = prev->common.next; 274 next = prev->common.next;
@@ -510,6 +514,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
510 } else if (status == AE_CTRL_TERMINATE) { 514 } else if (status == AE_CTRL_TERMINATE) {
511 status = AE_OK; 515 status = AE_OK;
512 } else if ((status != AE_OK) && (walk_state->method_desc)) { 516 } else if ((status != AE_OK) && (walk_state->method_desc)) {
517
513 /* Either the method parse or actual execution failed */ 518 /* Either the method parse or actual execution failed */
514 519
515 ACPI_ERROR_METHOD("Method parse/execution failed", 520 ACPI_ERROR_METHOD("Method parse/execution failed",
@@ -551,6 +556,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
551 if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == 556 if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
552 ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) { 557 ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) {
553 if (walk_state->method_desc) { 558 if (walk_state->method_desc) {
559
554 /* Decrement the thread count on the method parse tree */ 560 /* Decrement the thread count on the method parse tree */
555 561
556 if (walk_state->method_desc->method. 562 if (walk_state->method_desc->method.
@@ -633,12 +639,14 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
633 } 639 }
634 } else { 640 } else {
635 if (previous_walk_state->return_desc) { 641 if (previous_walk_state->return_desc) {
642
636 /* Caller doesn't want it, must delete it */ 643 /* Caller doesn't want it, must delete it */
637 644
638 acpi_ut_remove_reference(previous_walk_state-> 645 acpi_ut_remove_reference(previous_walk_state->
639 return_desc); 646 return_desc);
640 } 647 }
641 if (previous_walk_state->implicit_return_obj) { 648 if (previous_walk_state->implicit_return_obj) {
649
642 /* Caller doesn't want it, must delete it */ 650 /* Caller doesn't want it, must delete it */
643 651
644 acpi_ut_remove_reference(previous_walk_state-> 652 acpi_ut_remove_reference(previous_walk_state->
diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c
index bc6047caccd9..edb7c9ba6ec2 100644
--- a/drivers/acpi/parser/psscope.c
+++ b/drivers/acpi/parser/psscope.c
@@ -165,6 +165,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state,
165 acpi_ut_push_generic_state(&parser_state->scope, scope); 165 acpi_ut_push_generic_state(&parser_state->scope, scope);
166 166
167 if (arg_count == ACPI_VAR_ARGS) { 167 if (arg_count == ACPI_VAR_ARGS) {
168
168 /* Multiple arguments */ 169 /* Multiple arguments */
169 170
170 scope->parse_scope.arg_end = parser_state->pkg_end; 171 scope->parse_scope.arg_end = parser_state->pkg_end;
diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c
index dd6f16726fc4..6aa0012643ce 100644
--- a/drivers/acpi/parser/pstree.c
+++ b/drivers/acpi/parser/pstree.c
@@ -77,6 +77,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
77 77
78 op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); 78 op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
79 if (op_info->class == AML_CLASS_UNKNOWN) { 79 if (op_info->class == AML_CLASS_UNKNOWN) {
80
80 /* Invalid opcode or ASCII character */ 81 /* Invalid opcode or ASCII character */
81 82
82 return (NULL); 83 return (NULL);
@@ -85,6 +86,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
85 /* Check if this opcode requires argument sub-objects */ 86 /* Check if this opcode requires argument sub-objects */
86 87
87 if (!(op_info->flags & AML_HAS_ARGS)) { 88 if (!(op_info->flags & AML_HAS_ARGS)) {
89
88 /* Has no linked argument objects */ 90 /* Has no linked argument objects */
89 91
90 return (NULL); 92 return (NULL);
@@ -130,6 +132,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
130 132
131 op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); 133 op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
132 if (op_info->class == AML_CLASS_UNKNOWN) { 134 if (op_info->class == AML_CLASS_UNKNOWN) {
135
133 /* Invalid opcode */ 136 /* Invalid opcode */
134 137
135 ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X", 138 ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X",
@@ -140,6 +143,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
140 /* Check if this opcode requires argument sub-objects */ 143 /* Check if this opcode requires argument sub-objects */
141 144
142 if (!(op_info->flags & AML_HAS_ARGS)) { 145 if (!(op_info->flags & AML_HAS_ARGS)) {
146
143 /* Has no linked argument objects */ 147 /* Has no linked argument objects */
144 148
145 return; 149 return;
@@ -148,6 +152,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
148 /* Append the argument to the linked argument list */ 152 /* Append the argument to the linked argument list */
149 153
150 if (op->common.value.arg) { 154 if (op->common.value.arg) {
155
151 /* Append to existing argument list */ 156 /* Append to existing argument list */
152 157
153 prev_arg = op->common.value.arg; 158 prev_arg = op->common.value.arg;
@@ -222,12 +227,14 @@ union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
222 } 227 }
223 228
224 if (arg == origin) { 229 if (arg == origin) {
230
225 /* Reached parent of origin, end search */ 231 /* Reached parent of origin, end search */
226 232
227 return (NULL); 233 return (NULL);
228 } 234 }
229 235
230 if (parent->common.next) { 236 if (parent->common.next) {
237
231 /* Found sibling of parent */ 238 /* Found sibling of parent */
232 239
233 return (parent->common.next); 240 return (parent->common.next);
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c
index 3e07cb9cb748..a4c33a4bfe35 100644
--- a/drivers/acpi/parser/psutils.c
+++ b/drivers/acpi/parser/psutils.c
@@ -135,6 +135,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)
135 /* Allocate the minimum required size object */ 135 /* Allocate the minimum required size object */
136 136
137 if (flags == ACPI_PARSEOP_GENERIC) { 137 if (flags == ACPI_PARSEOP_GENERIC) {
138
138 /* The generic op (default) is by far the most common (16 to 1) */ 139 /* The generic op (default) is by far the most common (16 to 1) */
139 140
140 op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); 141 op = acpi_os_acquire_object(acpi_gbl_ps_node_cache);
diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c
index 06f05bfd7612..3d08b8c6db41 100644
--- a/drivers/acpi/parser/pswalk.c
+++ b/drivers/acpi/parser/pswalk.c
@@ -69,13 +69,16 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)
69 /* Visit all nodes in the subtree */ 69 /* Visit all nodes in the subtree */
70 70
71 while (op) { 71 while (op) {
72
72 /* Check if we are not ascending */ 73 /* Check if we are not ascending */
73 74
74 if (op != parent) { 75 if (op != parent) {
76
75 /* Look for an argument or child of the current op */ 77 /* Look for an argument or child of the current op */
76 78
77 next = acpi_ps_get_arg(op, 0); 79 next = acpi_ps_get_arg(op, 0);
78 if (next) { 80 if (next) {
81
79 /* Still going downward in tree (Op is not completed yet) */ 82 /* Still going downward in tree (Op is not completed yet) */
80 83
81 op = next; 84 op = next;
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c
index 2dd48cbb7c02..e09a820ee294 100644
--- a/drivers/acpi/parser/psxface.c
+++ b/drivers/acpi/parser/psxface.c
@@ -317,9 +317,11 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action)
317 acpi_native_uint i; 317 acpi_native_uint i;
318 318
319 if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) { 319 if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) {
320
320 /* Update reference count for each parameter */ 321 /* Update reference count for each parameter */
321 322
322 for (i = 0; info->parameters[i]; i++) { 323 for (i = 0; info->parameters[i]; i++) {
324
323 /* Ignore errors, just do them all */ 325 /* Ignore errors, just do them all */
324 326
325 (void)acpi_ut_update_object_reference(info-> 327 (void)acpi_ut_update_object_reference(info->
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c
index 7d6481d9fbec..223bdc493269 100644
--- a/drivers/acpi/resources/rscalc.c
+++ b/drivers/acpi/resources/rscalc.c
@@ -78,6 +78,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field)
78 ACPI_FUNCTION_ENTRY(); 78 ACPI_FUNCTION_ENTRY();
79 79
80 for (bits_set = 0; bit_field; bits_set++) { 80 for (bits_set = 0; bit_field; bits_set++) {
81
81 /* Zero the least significant bit that is set */ 82 /* Zero the least significant bit that is set */
82 83
83 bit_field &= (bit_field - 1); 84 bit_field &= (bit_field - 1);
@@ -154,6 +155,7 @@ acpi_rs_stream_option_length(u32 resource_length,
154 * length, minus one byte for the resource_source_index itself. 155 * length, minus one byte for the resource_source_index itself.
155 */ 156 */
156 if (resource_length > minimum_aml_resource_length) { 157 if (resource_length > minimum_aml_resource_length) {
158
157 /* Compute the length of the optional string */ 159 /* Compute the length of the optional string */
158 160
159 string_length = 161 string_length =
@@ -162,7 +164,7 @@ acpi_rs_stream_option_length(u32 resource_length,
162 164
163 /* Round up length to 32 bits for internal structure alignment */ 165 /* Round up length to 32 bits for internal structure alignment */
164 166
165 return (ACPI_ROUND_UP_to_32_bITS(string_length)); 167 return ((u32) ACPI_ROUND_UP_to_32_bITS(string_length));
166} 168}
167 169
168/******************************************************************************* 170/*******************************************************************************
@@ -191,6 +193,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
191 /* Traverse entire list of internal resource descriptors */ 193 /* Traverse entire list of internal resource descriptors */
192 194
193 while (resource) { 195 while (resource) {
196
194 /* Validate the descriptor type */ 197 /* Validate the descriptor type */
195 198
196 if (resource->type > ACPI_RESOURCE_TYPE_MAX) { 199 if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
@@ -214,6 +217,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
214 * is a Large Resource data type. 217 * is a Large Resource data type.
215 */ 218 */
216 if (resource->data.vendor.byte_length > 7) { 219 if (resource->data.vendor.byte_length > 7) {
220
217 /* Base size of a Large resource descriptor */ 221 /* Base size of a Large resource descriptor */
218 222
219 total_size = 223 total_size =
@@ -346,6 +350,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
346 /* Walk the list of AML resource descriptors */ 350 /* Walk the list of AML resource descriptors */
347 351
348 while (aml_buffer < end_aml) { 352 while (aml_buffer < end_aml) {
353
349 /* Validate the Resource Type and Resource Length */ 354 /* Validate the Resource Type and Resource Length */
350 355
351 status = acpi_ut_validate_resource(aml_buffer, &resource_index); 356 status = acpi_ut_validate_resource(aml_buffer, &resource_index);
@@ -390,7 +395,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
390 * Vendor Resource: 395 * Vendor Resource:
391 * Ensure a 32-bit boundary for the structure 396 * Ensure a 32-bit boundary for the structure
392 */ 397 */
393 extra_struct_bytes = 398 extra_struct_bytes = (u32)
394 ACPI_ROUND_UP_to_32_bITS(resource_length) - 399 ACPI_ROUND_UP_to_32_bITS(resource_length) -
395 resource_length; 400 resource_length;
396 break; 401 break;
@@ -407,7 +412,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
407 * Vendor Resource: 412 * Vendor Resource:
408 * Add vendor data and ensure a 32-bit boundary for the structure 413 * Add vendor data and ensure a 32-bit boundary for the structure
409 */ 414 */
410 extra_struct_bytes = 415 extra_struct_bytes = (u32)
411 ACPI_ROUND_UP_to_32_bITS(resource_length) - 416 ACPI_ROUND_UP_to_32_bITS(resource_length) -
412 resource_length; 417 resource_length;
413 break; 418 break;
@@ -431,7 +436,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
431 */ 436 */
432 buffer++; 437 buffer++;
433 438
434 extra_struct_bytes = 439 extra_struct_bytes = (u32)
435 /* 440 /*
436 * Add 4 bytes for each additional interrupt. Note: at 441 * Add 4 bytes for each additional interrupt. Note: at
437 * least one interrupt is required and is included in 442 * least one interrupt is required and is included in
@@ -450,7 +455,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
450 * Add the size of any optional data (resource_source) 455 * Add the size of any optional data (resource_source)
451 * Ensure a 64-bit boundary for the structure 456 * Ensure a 64-bit boundary for the structure
452 */ 457 */
453 extra_struct_bytes = 458 extra_struct_bytes = (u32)
454 ACPI_ROUND_UP_to_64_bITS 459 ACPI_ROUND_UP_to_64_bITS
455 (acpi_rs_stream_option_length 460 (acpi_rs_stream_option_length
456 (resource_length, minimum_aml_resource_length)); 461 (resource_length, minimum_aml_resource_length));
@@ -525,6 +530,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
525 top_object_list = package_object->package.elements; 530 top_object_list = package_object->package.elements;
526 531
527 for (index = 0; index < number_of_elements; index++) { 532 for (index = 0; index < number_of_elements; index++) {
533
528 /* Dereference the sub-package */ 534 /* Dereference the sub-package */
529 535
530 package_element = *top_object_list; 536 package_element = *top_object_list;
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c
index 1434e786477e..c27dca64d5d0 100644
--- a/drivers/acpi/resources/rslist.c
+++ b/drivers/acpi/resources/rslist.c
@@ -77,6 +77,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer)
77 /* Loop until end-of-buffer or an end_tag is found */ 77 /* Loop until end-of-buffer or an end_tag is found */
78 78
79 while (aml < end_aml) { 79 while (aml < end_aml) {
80
80 /* Validate the Resource Type and Resource Length */ 81 /* Validate the Resource Type and Resource Length */
81 82
82 status = acpi_ut_validate_resource(aml, &resource_index); 83 status = acpi_ut_validate_resource(aml, &resource_index);
@@ -155,6 +156,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
155 /* Walk the resource descriptor list, convert each descriptor */ 156 /* Walk the resource descriptor list, convert each descriptor */
156 157
157 while (aml < end_aml) { 158 while (aml < end_aml) {
159
158 /* Validate the (internal) Resource Type */ 160 /* Validate the (internal) Resource Type */
159 161
160 if (resource->type > ACPI_RESOURCE_TYPE_MAX) { 162 if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
@@ -191,6 +193,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
191 /* Check for end-of-list, normal exit */ 193 /* Check for end-of-list, normal exit */
192 194
193 if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { 195 if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) {
196
194 /* An End Tag indicates the end of the input Resource Template */ 197 /* An End Tag indicates the end of the input Resource Template */
195 198
196 return_ACPI_STATUS(AE_OK); 199 return_ACPI_STATUS(AE_OK);
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c
index ed866cf1c6d2..095730196a8a 100644
--- a/drivers/acpi/resources/rsmisc.c
+++ b/drivers/acpi/resources/rsmisc.c
@@ -84,6 +84,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
84 ACPI_FUNCTION_TRACE("rs_get_resource"); 84 ACPI_FUNCTION_TRACE("rs_get_resource");
85 85
86 if (((acpi_native_uint) resource) & 0x3) { 86 if (((acpi_native_uint) resource) & 0x3) {
87
87 /* Each internal resource struct is expected to be 32-bit aligned */ 88 /* Each internal resource struct is expected to be 32-bit aligned */
88 89
89 ACPI_WARNING((AE_INFO, 90 ACPI_WARNING((AE_INFO,
@@ -295,9 +296,11 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
295 296
296 exit: 297 exit:
297 if (!flags_mode) { 298 if (!flags_mode) {
299
298 /* Round the resource struct length up to the next 32-bit boundary */ 300 /* Round the resource struct length up to the next 32-bit boundary */
299 301
300 resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length); 302 resource->length =
303 (u32) ACPI_ROUND_UP_to_32_bITS(resource->length);
301 } 304 }
302 return_ACPI_STATUS(AE_OK); 305 return_ACPI_STATUS(AE_OK);
303} 306}
@@ -535,6 +538,7 @@ if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) {
535 538
536resource->data.extended_irq.interrupt_count = temp8; 539resource->data.extended_irq.interrupt_count = temp8;
537if (temp8 < 1) { 540if (temp8 < 1) {
541
538 /* Must have at least one IRQ */ 542 /* Must have at least one IRQ */
539 543
540 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); 544 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c
index 25b5aedd6612..c5f7014929b4 100644
--- a/drivers/acpi/resources/rsutils.c
+++ b/drivers/acpi/resources/rsutils.c
@@ -205,6 +205,7 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
205 /* Length is stored differently for large and small descriptors */ 205 /* Length is stored differently for large and small descriptors */
206 206
207 if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { 207 if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
208
208 /* Large descriptor -- bytes 1-2 contain the 16-bit length */ 209 /* Large descriptor -- bytes 1-2 contain the 16-bit length */
209 210
210 ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, 211 ACPI_MOVE_16_TO_16(&aml->large_header.resource_length,
@@ -328,6 +329,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
328 * we add 1 to the minimum length. 329 * we add 1 to the minimum length.
329 */ 330 */
330 if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { 331 if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) {
332
331 /* Get the resource_source_index */ 333 /* Get the resource_source_index */
332 334
333 resource_source->index = aml_resource_source[0]; 335 resource_source->index = aml_resource_source[0];
@@ -351,16 +353,20 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
351 * Zero the entire area of the buffer. 353 * Zero the entire area of the buffer.
352 */ 354 */
353 total_length = 355 total_length =
356 (u32)
354 ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN 357 ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN
355 ((char *)&aml_resource_source[1]) + 358 (ACPI_CAST_PTR
356 1); 359 (char,
360 &aml_resource_source[1])) + 1);
361
357 ACPI_MEMSET(resource_source->string_ptr, 0, total_length); 362 ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
358 363
359 /* Copy the resource_source string to the destination */ 364 /* Copy the resource_source string to the destination */
360 365
361 resource_source->string_length = 366 resource_source->string_length =
362 acpi_rs_strcpy(resource_source->string_ptr, 367 acpi_rs_strcpy(resource_source->string_ptr,
363 (char *)&aml_resource_source[1]); 368 ACPI_CAST_PTR(char,
369 &aml_resource_source[1]));
364 370
365 return ((acpi_rs_length) total_length); 371 return ((acpi_rs_length) total_length);
366 } 372 }
@@ -405,6 +411,7 @@ acpi_rs_set_resource_source(union aml_resource * aml,
405 /* Non-zero string length indicates presence of a resource_source */ 411 /* Non-zero string length indicates presence of a resource_source */
406 412
407 if (resource_source->string_length) { 413 if (resource_source->string_length) {
414
408 /* Point to the end of the AML descriptor */ 415 /* Point to the end of the AML descriptor */
409 416
410 aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); 417 aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length);
@@ -415,7 +422,7 @@ acpi_rs_set_resource_source(union aml_resource * aml,
415 422
416 /* Copy the resource_source string */ 423 /* Copy the resource_source string */
417 424
418 ACPI_STRCPY((char *)&aml_resource_source[1], 425 ACPI_STRCPY(ACPI_CAST_PTR(char, &aml_resource_source[1]),
419 resource_source->string_ptr); 426 resource_source->string_ptr);
420 427
421 /* 428 /*
@@ -435,9 +442,9 @@ acpi_rs_set_resource_source(union aml_resource * aml,
435 * 442 *
436 * FUNCTION: acpi_rs_get_prt_method_data 443 * FUNCTION: acpi_rs_get_prt_method_data
437 * 444 *
438 * PARAMETERS: Handle - a handle to the containing object 445 * PARAMETERS: Handle - Handle to the containing object
439 * ret_buffer - a pointer to a buffer structure for the 446 * ret_buffer - Pointer to a buffer structure for the
440 * results 447 * results
441 * 448 *
442 * RETURN: Status 449 * RETURN: Status
443 * 450 *
@@ -483,9 +490,9 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer)
483 * 490 *
484 * FUNCTION: acpi_rs_get_crs_method_data 491 * FUNCTION: acpi_rs_get_crs_method_data
485 * 492 *
486 * PARAMETERS: Handle - a handle to the containing object 493 * PARAMETERS: Handle - Handle to the containing object
487 * ret_buffer - a pointer to a buffer structure for the 494 * ret_buffer - Pointer to a buffer structure for the
488 * results 495 * results
489 * 496 *
490 * RETURN: Status 497 * RETURN: Status
491 * 498 *
@@ -532,9 +539,9 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
532 * 539 *
533 * FUNCTION: acpi_rs_get_prs_method_data 540 * FUNCTION: acpi_rs_get_prs_method_data
534 * 541 *
535 * PARAMETERS: Handle - a handle to the containing object 542 * PARAMETERS: Handle - Handle to the containing object
536 * ret_buffer - a pointer to a buffer structure for the 543 * ret_buffer - Pointer to a buffer structure for the
537 * results 544 * results
538 * 545 *
539 * RETURN: Status 546 * RETURN: Status
540 * 547 *
@@ -583,10 +590,10 @@ acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
583 * 590 *
584 * FUNCTION: acpi_rs_get_method_data 591 * FUNCTION: acpi_rs_get_method_data
585 * 592 *
586 * PARAMETERS: Handle - a handle to the containing object 593 * PARAMETERS: Handle - Handle to the containing object
587 * Path - Path to method, relative to Handle 594 * Path - Path to method, relative to Handle
588 * ret_buffer - a pointer to a buffer structure for the 595 * ret_buffer - Pointer to a buffer structure for the
589 * results 596 * results
590 * 597 *
591 * RETURN: Status 598 * RETURN: Status
592 * 599 *
@@ -634,9 +641,9 @@ acpi_rs_get_method_data(acpi_handle handle,
634 * 641 *
635 * FUNCTION: acpi_rs_set_srs_method_data 642 * FUNCTION: acpi_rs_set_srs_method_data
636 * 643 *
637 * PARAMETERS: Handle - a handle to the containing object 644 * PARAMETERS: Handle - Handle to the containing object
638 * in_buffer - a pointer to a buffer structure of the 645 * in_buffer - Pointer to a buffer structure of the
639 * parameter 646 * parameter
640 * 647 *
641 * RETURN: Status 648 * RETURN: Status
642 * 649 *
@@ -696,6 +703,7 @@ acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer)
696 703
697 status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info); 704 status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info);
698 if (ACPI_SUCCESS(status)) { 705 if (ACPI_SUCCESS(status)) {
706
699 /* Delete any return object (especially if implicit_return is enabled) */ 707 /* Delete any return object (especially if implicit_return is enabled) */
700 708
701 if (info.return_object) { 709 if (info.return_object) {
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c
index 88b67077aeeb..2e1bc71acd94 100644
--- a/drivers/acpi/resources/rsxface.c
+++ b/drivers/acpi/resources/rsxface.c
@@ -279,6 +279,7 @@ acpi_walk_resources(acpi_handle device_handle,
279 /* Walk the resource list until the end_tag is found (or buffer end) */ 279 /* Walk the resource list until the end_tag is found (or buffer end) */
280 280
281 while (resource < resource_end) { 281 while (resource < resource_end) {
282
282 /* Sanity check the resource */ 283 /* Sanity check the resource */
283 284
284 if (resource->type > ACPI_RESOURCE_TYPE_MAX) { 285 if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
@@ -291,6 +292,7 @@ acpi_walk_resources(acpi_handle device_handle,
291 status = user_function(resource, context); 292 status = user_function(resource, context);
292 if (ACPI_FAILURE(status)) { 293 if (ACPI_FAILURE(status)) {
293 if (status == AE_CTRL_TERMINATE) { 294 if (status == AE_CTRL_TERMINATE) {
295
294 /* This is an OK termination by the user function */ 296 /* This is an OK termination by the user function */
295 297
296 status = AE_OK; 298 status = AE_OK;
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c
index 03b37d2223bc..254ebdbb7bef 100644
--- a/drivers/acpi/tables/tbconvrt.c
+++ b/drivers/acpi/tables/tbconvrt.c
@@ -147,6 +147,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info)
147 /* Copy the table pointers */ 147 /* Copy the table pointers */
148 148
149 for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { 149 for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
150
150 /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ 151 /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
151 152
152 if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { 153 if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
@@ -515,6 +516,7 @@ acpi_status acpi_tb_convert_table_fadt(void)
515 516
516 if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { 517 if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) {
517 if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) { 518 if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) {
519
518 /* Length is too short to be a V2.0 table */ 520 /* Length is too short to be a V2.0 table */
519 521
520 ACPI_WARNING((AE_INFO, 522 ACPI_WARNING((AE_INFO,
@@ -603,6 +605,7 @@ acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info)
603 if ((acpi_gbl_RSDP->revision < 2) || 605 if ((acpi_gbl_RSDP->revision < 2) ||
604 (acpi_gbl_FACS->length < 32) || 606 (acpi_gbl_FACS->length < 32) ||
605 (!(acpi_gbl_FACS->xfirmware_waking_vector))) { 607 (!(acpi_gbl_FACS->xfirmware_waking_vector))) {
608
606 /* ACPI 1.0 FACS or short table or optional X_ field is zero */ 609 /* ACPI 1.0 FACS or short table or optional X_ field is zero */
607 610
608 acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64, 611 acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64,
diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c
index 09b4ee6dfd60..4615e1afe8de 100644
--- a/drivers/acpi/tables/tbget.c
+++ b/drivers/acpi/tables/tbget.c
@@ -148,6 +148,10 @@ acpi_tb_get_table_header(struct acpi_pointer *address,
148 sizeof(struct acpi_table_header), 148 sizeof(struct acpi_table_header),
149 (void *)&header); 149 (void *)&header);
150 if (ACPI_FAILURE(status)) { 150 if (ACPI_FAILURE(status)) {
151 ACPI_ERROR((AE_INFO,
152 "Could not map memory at %8.8X%8.8X for table header",
153 ACPI_FORMAT_UINT64(address->pointer.
154 physical)));
151 return_ACPI_STATUS(status); 155 return_ACPI_STATUS(status);
152 } 156 }
153 157
@@ -208,6 +212,7 @@ acpi_tb_get_table_body(struct acpi_pointer *address,
208 212
209 status = acpi_tb_table_override(header, table_info); 213 status = acpi_tb_table_override(header, table_info);
210 if (ACPI_SUCCESS(status)) { 214 if (ACPI_SUCCESS(status)) {
215
211 /* Table was overridden by the host OS */ 216 /* Table was overridden by the host OS */
212 217
213 return_ACPI_STATUS(status); 218 return_ACPI_STATUS(status);
@@ -250,6 +255,7 @@ acpi_tb_table_override(struct acpi_table_header *header,
250 */ 255 */
251 status = acpi_os_table_override(header, &new_table); 256 status = acpi_os_table_override(header, &new_table);
252 if (ACPI_FAILURE(status)) { 257 if (ACPI_FAILURE(status)) {
258
253 /* Some severe error from the OSL, but we basically ignore it */ 259 /* Some severe error from the OSL, but we basically ignore it */
254 260
255 ACPI_EXCEPTION((AE_INFO, status, 261 ACPI_EXCEPTION((AE_INFO, status,
@@ -258,6 +264,7 @@ acpi_tb_table_override(struct acpi_table_header *header,
258 } 264 }
259 265
260 if (!new_table) { 266 if (!new_table) {
267
261 /* No table override */ 268 /* No table override */
262 269
263 return_ACPI_STATUS(AE_NO_ACPI_TABLES); 270 return_ACPI_STATUS(AE_NO_ACPI_TABLES);
@@ -381,6 +388,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address,
381 388
382#if (!ACPI_CHECKSUM_ABORT) 389#if (!ACPI_CHECKSUM_ABORT)
383 if (ACPI_FAILURE(status)) { 390 if (ACPI_FAILURE(status)) {
391
384 /* Ignore the error if configuration says so */ 392 /* Ignore the error if configuration says so */
385 393
386 status = AE_OK; 394 status = AE_OK;
@@ -440,6 +448,7 @@ acpi_tb_get_table_ptr(acpi_table_type table_type,
440 * instance is always in the list head. 448 * instance is always in the list head.
441 */ 449 */
442 if (instance == 1) { 450 if (instance == 1) {
451
443 /* Get the first */ 452 /* Get the first */
444 453
445 *table_ptr_loc = NULL; 454 *table_ptr_loc = NULL;
diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c
index 134e5dce0bc1..b4ec61d7cf06 100644
--- a/drivers/acpi/tables/tbgetall.c
+++ b/drivers/acpi/tables/tbgetall.c
@@ -223,6 +223,7 @@ acpi_status acpi_tb_get_required_tables(void)
223 * any SSDTs. 223 * any SSDTs.
224 */ 224 */
225 for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { 225 for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
226
226 /* Get the table address from the common internal XSDT */ 227 /* Get the table address from the common internal XSDT */
227 228
228 address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; 229 address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i];
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
index 7ffd0fddb4e5..ec2cb978b7c4 100644
--- a/drivers/acpi/tables/tbinstal.c
+++ b/drivers/acpi/tables/tbinstal.c
@@ -84,6 +84,7 @@ acpi_tb_match_signature(char *signature,
84 84
85 if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature, 85 if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature,
86 acpi_gbl_table_data[i].sig_length)) { 86 acpi_gbl_table_data[i].sig_length)) {
87
87 /* Found a signature match, return index if requested */ 88 /* Found a signature match, return index if requested */
88 89
89 if (table_info) { 90 if (table_info) {
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c
index 4d308220225d..946d2f2d611d 100644
--- a/drivers/acpi/tables/tbrsdt.c
+++ b/drivers/acpi/tables/tbrsdt.c
@@ -190,6 +190,7 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr)
190 } 190 }
191 191
192 if (no_match) { 192 if (no_match) {
193
193 /* Invalid RSDT or XSDT signature */ 194 /* Invalid RSDT or XSDT signature */
194 195
195 ACPI_ERROR((AE_INFO, 196 ACPI_ERROR((AE_INFO,
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index bc571592f087..b463d4b88823 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -96,6 +96,7 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc)
96 (!ACPI_MEMCMP 96 (!ACPI_MEMCMP
97 (table_desc->pointer, new_table_desc->pointer, 97 (table_desc->pointer, new_table_desc->pointer,
98 new_table_desc->pointer->length))) { 98 new_table_desc->pointer->length))) {
99
99 /* Match: this table is already installed */ 100 /* Match: this table is already installed */
100 101
101 ACPI_DEBUG_PRINT((ACPI_DB_TABLES, 102 ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
@@ -249,6 +250,7 @@ u8 acpi_tb_generate_checksum(void *buffer, u32 length)
249 u8 sum = 0; 250 u8 sum = 0;
250 251
251 if (buffer && length) { 252 if (buffer && length) {
253
252 /* Buffer and Length are valid */ 254 /* Buffer and Length are valid */
253 255
254 end_buffer = ACPI_ADD_PTR(u8, buffer, length); 256 end_buffer = ACPI_ADD_PTR(u8, buffer, length);
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index 9fe53c9d5b9a..3e902cdb83e1 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -174,6 +174,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
174 status = acpi_tb_install_table(&table_info); 174 status = acpi_tb_install_table(&table_info);
175 if (ACPI_FAILURE(status)) { 175 if (ACPI_FAILURE(status)) {
176 if (status == AE_ALREADY_EXISTS) { 176 if (status == AE_ALREADY_EXISTS) {
177
177 /* Table already exists, no error */ 178 /* Table already exists, no error */
178 179
179 status = AE_OK; 180 status = AE_OK;
@@ -208,6 +209,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
208 } 209 }
209 210
210 if (ACPI_FAILURE(status)) { 211 if (ACPI_FAILURE(status)) {
212
211 /* Uninstall table and free the buffer */ 213 /* Uninstall table and free the buffer */
212 214
213 (void)acpi_tb_uninstall_table(table_info.installed_desc); 215 (void)acpi_tb_uninstall_table(table_info.installed_desc);
@@ -397,6 +399,7 @@ acpi_get_table(acpi_table_type table_type,
397 /* Get the table length */ 399 /* Get the table length */
398 400
399 if (table_type == ACPI_TABLE_RSDP) { 401 if (table_type == ACPI_TABLE_RSDP) {
402
400 /* RSD PTR is the only "table" without a header */ 403 /* RSD PTR is the only "table" without a header */
401 404
402 table_length = sizeof(struct rsdp_descriptor); 405 table_length = sizeof(struct rsdp_descriptor);
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
index a62db6af83c9..7f68b759f15a 100644
--- a/drivers/acpi/tables/tbxfroot.c
+++ b/drivers/acpi/tables/tbxfroot.c
@@ -75,6 +75,7 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp)
75 * The signature and checksum must both be correct 75 * The signature and checksum must both be correct
76 */ 76 */
77 if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) { 77 if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) {
78
78 /* Nope, BAD Signature */ 79 /* Nope, BAD Signature */
79 80
80 return (AE_BAD_SIGNATURE); 81 return (AE_BAD_SIGNATURE);
@@ -217,6 +218,7 @@ acpi_get_firmware_table(acpi_string signature,
217 /* Ensure that we have a RSDP */ 218 /* Ensure that we have a RSDP */
218 219
219 if (!acpi_gbl_RSDP) { 220 if (!acpi_gbl_RSDP) {
221
220 /* Get the RSDP */ 222 /* Get the RSDP */
221 223
222 status = acpi_os_get_root_pointer(flags, &address); 224 status = acpi_os_get_root_pointer(flags, &address);
@@ -327,10 +329,12 @@ acpi_get_firmware_table(acpi_string signature,
327 /* Compare table signatures and table instance */ 329 /* Compare table signatures and table instance */
328 330
329 if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) { 331 if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) {
332
330 /* An instance of the table was found */ 333 /* An instance of the table was found */
331 334
332 j++; 335 j++;
333 if (j >= instance) { 336 if (j >= instance) {
337
334 /* Found the correct instance, get the entire table */ 338 /* Found the correct instance, get the entire table */
335 339
336 status = 340 status =
@@ -434,12 +438,14 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length)
434 438
435 for (mem_rover = start_address; mem_rover < end_address; 439 for (mem_rover = start_address; mem_rover < end_address;
436 mem_rover += ACPI_RSDP_SCAN_STEP) { 440 mem_rover += ACPI_RSDP_SCAN_STEP) {
441
437 /* The RSDP signature and checksum must both be correct */ 442 /* The RSDP signature and checksum must both be correct */
438 443
439 status = 444 status =
440 acpi_tb_validate_rsdp(ACPI_CAST_PTR 445 acpi_tb_validate_rsdp(ACPI_CAST_PTR
441 (struct rsdp_descriptor, mem_rover)); 446 (struct rsdp_descriptor, mem_rover));
442 if (ACPI_SUCCESS(status)) { 447 if (ACPI_SUCCESS(status)) {
448
443 /* Sig and checksum valid, we have found a real RSDP */ 449 /* Sig and checksum valid, we have found a real RSDP */
444 450
445 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 451 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -495,6 +501,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
495 * Scan supports either logical addressing or physical addressing 501 * Scan supports either logical addressing or physical addressing
496 */ 502 */
497 if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { 503 if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
504
498 /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ 505 /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */
499 506
500 status = acpi_os_map_memory((acpi_physical_address) 507 status = acpi_os_map_memory((acpi_physical_address)
@@ -542,6 +549,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
542 acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); 549 acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE);
543 550
544 if (mem_rover) { 551 if (mem_rover) {
552
545 /* Return the physical address */ 553 /* Return the physical address */
546 554
547 physical_address += 555 physical_address +=
@@ -576,6 +584,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
576 acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); 584 acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
577 585
578 if (mem_rover) { 586 if (mem_rover) {
587
579 /* Return the physical address */ 588 /* Return the physical address */
580 589
581 physical_address = 590 physical_address =
@@ -609,6 +618,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
609 (physical_address), 618 (physical_address),
610 ACPI_EBDA_WINDOW_SIZE); 619 ACPI_EBDA_WINDOW_SIZE);
611 if (mem_rover) { 620 if (mem_rover) {
621
612 /* Return the physical address */ 622 /* Return the physical address */
613 623
614 table_info->physical_address = 624 table_info->physical_address =
@@ -624,6 +634,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
624 (ACPI_HI_RSDP_WINDOW_BASE), 634 (ACPI_HI_RSDP_WINDOW_BASE),
625 ACPI_HI_RSDP_WINDOW_SIZE); 635 ACPI_HI_RSDP_WINDOW_SIZE);
626 if (mem_rover) { 636 if (mem_rover) {
637
627 /* Found it, return the physical address */ 638 /* Found it, return the physical address */
628 639
629 table_info->physical_address = 640 table_info->physical_address =
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index 03b0044974c2..34de3791d4c2 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -308,6 +308,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
308 308
309 allocation = acpi_os_allocate(size); 309 allocation = acpi_os_allocate(size);
310 if (!allocation) { 310 if (!allocation) {
311
311 /* Report allocation error */ 312 /* Report allocation error */
312 313
313 ACPI_ERROR((module, line, 314 ACPI_ERROR((module, line,
@@ -351,6 +352,7 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
351 352
352 allocation = acpi_os_allocate(size); 353 allocation = acpi_os_allocate(size);
353 if (!allocation) { 354 if (!allocation) {
355
354 /* Report allocation error */ 356 /* Report allocation error */
355 357
356 ACPI_ERROR((module, line, 358 ACPI_ERROR((module, line,
@@ -477,6 +479,7 @@ void *acpi_ut_callocate_and_track(acpi_size size,
477 acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header), 479 acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header),
478 component, module, line); 480 component, module, line);
479 if (!allocation) { 481 if (!allocation) {
482
480 /* Report allocation error */ 483 /* Report allocation error */
481 484
482 ACPI_ERROR((module, line, 485 ACPI_ERROR((module, line,
@@ -681,6 +684,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
681 684
682 mem_list = acpi_gbl_global_list; 685 mem_list = acpi_gbl_global_list;
683 if (NULL == mem_list->list_head) { 686 if (NULL == mem_list->list_head) {
687
684 /* No allocations! */ 688 /* No allocations! */
685 689
686 ACPI_ERROR((module, line, 690 ACPI_ERROR((module, line,
@@ -807,6 +811,7 @@ void acpi_ut_dump_allocations(u32 component, char *module)
807 if ((element->component & component) && 811 if ((element->component & component) &&
808 ((module == NULL) 812 ((module == NULL)
809 || (0 == ACPI_STRCMP(module, element->module)))) { 813 || (0 == ACPI_STRCMP(module, element->module)))) {
814
810 /* Ignore allocated objects that are in a cache */ 815 /* Ignore allocated objects that are in a cache */
811 816
812 descriptor = 817 descriptor =
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c
index 2177cb1ef2c4..044c890e5b3c 100644
--- a/drivers/acpi/utilities/utcache.c
+++ b/drivers/acpi/utilities/utcache.c
@@ -118,6 +118,7 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache)
118 /* Walk the list of objects in this cache */ 118 /* Walk the list of objects in this cache */
119 119
120 while (cache->list_head) { 120 while (cache->list_head) {
121
121 /* Delete and unlink one cached state object */ 122 /* Delete and unlink one cached state object */
122 123
123 next = *(ACPI_CAST_INDIRECT_PTR(char, 124 next = *(ACPI_CAST_INDIRECT_PTR(char,
@@ -259,6 +260,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
259 /* Check the cache first */ 260 /* Check the cache first */
260 261
261 if (cache->list_head) { 262 if (cache->list_head) {
263
262 /* There is an object available, use it */ 264 /* There is an object available, use it */
263 265
264 object = cache->list_head; 266 object = cache->list_head;
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
index df2d32096b72..47875935c3f4 100644
--- a/drivers/acpi/utilities/utcopy.c
+++ b/drivers/acpi/utilities/utcopy.c
@@ -882,6 +882,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
882 acpi_ut_copy_ielement_to_ielement, 882 acpi_ut_copy_ielement_to_ielement,
883 walk_state); 883 walk_state);
884 if (ACPI_FAILURE(status)) { 884 if (ACPI_FAILURE(status)) {
885
885 /* On failure, delete the destination package object */ 886 /* On failure, delete the destination package object */
886 887
887 acpi_ut_remove_reference(dest_obj); 888 acpi_ut_remove_reference(dest_obj);
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
index 35f3d581e034..6e92b2a3c0fd 100644
--- a/drivers/acpi/utilities/utdebug.c
+++ b/drivers/acpi/utilities/utdebug.c
@@ -123,12 +123,14 @@ static const char *acpi_ut_trim_function_name(const char *function_name)
123 /* All Function names are longer than 4 chars, check is safe */ 123 /* All Function names are longer than 4 chars, check is safe */
124 124
125 if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { 125 if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) {
126
126 /* This is the case where the original source has not been modified */ 127 /* This is the case where the original source has not been modified */
127 128
128 return (function_name + 4); 129 return (function_name + 4);
129 } 130 }
130 131
131 if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { 132 if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) {
133
132 /* This is the case where the source has been 'linuxized' */ 134 /* This is the case where the source has been 'linuxized' */
133 135
134 return (function_name + 5); 136 return (function_name + 5);
@@ -545,6 +547,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
545 /* Nasty little dump buffer routine! */ 547 /* Nasty little dump buffer routine! */
546 548
547 while (i < count) { 549 while (i < count) {
550
548 /* Print current offset */ 551 /* Print current offset */
549 552
550 acpi_os_printf("%6.4X: ", (u32) i); 553 acpi_os_printf("%6.4X: ", (u32) i);
@@ -553,6 +556,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
553 556
554 for (j = 0; j < 16;) { 557 for (j = 0; j < 16;) {
555 if (i + j >= count) { 558 if (i + j >= count) {
559
556 /* Dump fill spaces */ 560 /* Dump fill spaces */
557 561
558 acpi_os_printf("%*s", ((display * 2) + 1), " "); 562 acpi_os_printf("%*s", ((display * 2) + 1), " ");
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index 1db9695b0029..dbae72121cea 100644
--- a/drivers/acpi/utilities/utdelete.c
+++ b/drivers/acpi/utilities/utdelete.c
@@ -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;
@@ -415,6 +417,7 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
415 ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); 417 ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object);
416 418
417 while (object) { 419 while (object) {
420
418 /* Make sure that this isn't a namespace handle */ 421 /* Make sure that this isn't a namespace handle */
419 422
420 if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { 423 if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) {
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c
index 106cc97cb4af..952ffdea93aa 100644
--- a/drivers/acpi/utilities/uteval.c
+++ b/drivers/acpi/utilities/uteval.c
@@ -98,6 +98,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
98 ACPI_CAST_PTR(char, 98 ACPI_CAST_PTR(char,
99 acpi_gbl_valid_osi_strings[i]))) 99 acpi_gbl_valid_osi_strings[i])))
100 { 100 {
101
101 /* This string is supported */ 102 /* This string is supported */
102 103
103 return_desc->integer.value = 0xFFFFFFFF; 104 return_desc->integer.value = 0xFFFFFFFF;
@@ -343,6 +344,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
343 } 344 }
344 345
345 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 346 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
347
346 /* Convert the Numeric HID to string */ 348 /* Convert the Numeric HID to string */
347 349
348 acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, 350 acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
@@ -479,6 +481,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
479 /* The _CID object can be either a single CID or a package (list) of CIDs */ 481 /* The _CID object can be either a single CID or a package (list) of CIDs */
480 482
481 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { 483 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
484
482 /* Translate each package element */ 485 /* Translate each package element */
483 486
484 for (i = 0; i < count; i++) { 487 for (i = 0; i < count; i++) {
@@ -543,6 +546,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
543 } 546 }
544 547
545 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 548 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
549
546 /* Convert the Numeric UID to string */ 550 /* Convert the Numeric UID to string */
547 551
548 acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, 552 acpi_ex_unsigned_integer_to_string(obj_desc->integer.value,
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index ffd13383a325..767c5e44a04b 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -119,6 +119,7 @@ const char *acpi_format_exception(acpi_status status)
119 } 119 }
120 120
121 if (!exception) { 121 if (!exception) {
122
122 /* Exception code was not recognized */ 123 /* Exception code was not recognized */
123 124
124 ACPI_ERROR((AE_INFO, 125 ACPI_ERROR((AE_INFO,
@@ -747,6 +748,7 @@ u8 acpi_ut_valid_object_type(acpi_object_type type)
747{ 748{
748 749
749 if (type > ACPI_TYPE_LOCAL_MAX) { 750 if (type > ACPI_TYPE_LOCAL_MAX) {
751
750 /* Note: Assumes all TYPEs are contiguous (external/local) */ 752 /* Note: Assumes all TYPEs are contiguous (external/local) */
751 753
752 return (FALSE); 754 return (FALSE);
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 7364f5f8c9cd..60f36130663c 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -97,6 +97,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
97 97
98 for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { 98 for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) {
99 if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { 99 if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) {
100
100 /* There are no free IDs in this mask */ 101 /* There are no free IDs in this mask */
101 102
102 break; 103 break;
@@ -273,6 +274,7 @@ void acpi_ut_print_string(char *string, u8 max_length)
273 274
274 acpi_os_printf("\""); 275 acpi_os_printf("\"");
275 for (i = 0; string[i] && (i < max_length); i++) { 276 for (i = 0; string[i] && (i < max_length); i++) {
277
276 /* Escape sequences */ 278 /* Escape sequences */
277 279
278 switch (string[i]) { 280 switch (string[i]) {
@@ -601,11 +603,13 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
601 603
602 while (*string) { 604 while (*string) {
603 if (ACPI_IS_DIGIT(*string)) { 605 if (ACPI_IS_DIGIT(*string)) {
606
604 /* Convert ASCII 0-9 to Decimal value */ 607 /* Convert ASCII 0-9 to Decimal value */
605 608
606 this_digit = ((u8) * string) - '0'; 609 this_digit = ((u8) * string) - '0';
607 } else { 610 } else {
608 if (base == 10) { 611 if (base == 10) {
612
609 /* Digit is out of range */ 613 /* Digit is out of range */
610 614
611 goto error_exit; 615 goto error_exit;
@@ -613,6 +617,7 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
613 617
614 this_digit = (u8) ACPI_TOUPPER(*string); 618 this_digit = (u8) ACPI_TOUPPER(*string);
615 if (ACPI_IS_XDIGIT((char)this_digit)) { 619 if (ACPI_IS_XDIGIT((char)this_digit)) {
620
616 /* Convert ASCII Hex char to value */ 621 /* Convert ASCII Hex char to value */
617 622
618 this_digit = this_digit - 'A' + 10; 623 this_digit = this_digit - 'A' + 10;
@@ -727,6 +732,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
727 } 732 }
728 733
729 while (state) { 734 while (state) {
735
730 /* Get one element of the package */ 736 /* Get one element of the package */
731 737
732 this_index = state->pkg.index; 738 this_index = state->pkg.index;
@@ -814,31 +820,6 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
814 820
815/******************************************************************************* 821/*******************************************************************************
816 * 822 *
817 * FUNCTION: acpi_ut_generate_checksum
818 *
819 * PARAMETERS: Buffer - Buffer to be scanned
820 * Length - number of bytes to examine
821 *
822 * RETURN: The generated checksum
823 *
824 * DESCRIPTION: Generate a checksum on a raw buffer
825 *
826 ******************************************************************************/
827
828u8 acpi_ut_generate_checksum(u8 * buffer, u32 length)
829{
830 u32 i;
831 signed char sum = 0;
832
833 for (i = 0; i < length; i++) {
834 sum = (signed char)(sum + buffer[i]);
835 }
836
837 return ((u8) (0 - sum));
838}
839
840/*******************************************************************************
841 *
842 * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info 823 * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info
843 * 824 *
844 * PARAMETERS: module_name - Caller's module name (for error output) 825 * PARAMETERS: module_name - Caller's module name (for error output)
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
index 7ee2d1d98071..b1205a58028c 100644
--- a/drivers/acpi/utilities/utobject.c
+++ b/drivers/acpi/utilities/utobject.c
@@ -173,6 +173,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size)
173 /* Create an actual buffer only if size > 0 */ 173 /* Create an actual buffer only if size > 0 */
174 174
175 if (buffer_size > 0) { 175 if (buffer_size > 0) {
176
176 /* Allocate the actual buffer */ 177 /* Allocate the actual buffer */
177 178
178 buffer = ACPI_MEM_CALLOCATE(buffer_size); 179 buffer = ACPI_MEM_CALLOCATE(buffer_size);
@@ -397,6 +398,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
397 length = sizeof(union acpi_object); 398 length = sizeof(union acpi_object);
398 399
399 if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { 400 if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) {
401
400 /* Object is a named object (reference), just return the length */ 402 /* Object is a named object (reference), just return the length */
401 403
402 *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); 404 *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c
index 16461317113f..27158dd0f877 100644
--- a/drivers/acpi/utilities/utresrc.c
+++ b/drivers/acpi/utilities/utresrc.c
@@ -273,6 +273,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
273 * Examine the large/small bit in the resource header 273 * Examine the large/small bit in the resource header
274 */ 274 */
275 if (resource_type & ACPI_RESOURCE_NAME_LARGE) { 275 if (resource_type & ACPI_RESOURCE_NAME_LARGE) {
276
276 /* Verify the large resource type (name) against the max */ 277 /* Verify the large resource type (name) against the max */
277 278
278 if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { 279 if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) {
@@ -376,6 +377,7 @@ u8 acpi_ut_get_resource_type(void *aml)
376 * Examine the large/small bit in the resource header 377 * Examine the large/small bit in the resource header
377 */ 378 */
378 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { 379 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
380
379 /* Large Resource Type -- bits 6:0 contain the name */ 381 /* Large Resource Type -- bits 6:0 contain the name */
380 382
381 return (ACPI_GET8(aml)); 383 return (ACPI_GET8(aml));
@@ -411,6 +413,7 @@ u16 acpi_ut_get_resource_length(void *aml)
411 * Examine the large/small bit in the resource header 413 * Examine the large/small bit in the resource header
412 */ 414 */
413 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { 415 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
416
414 /* Large Resource type -- bytes 1-2 contain the 16-bit length */ 417 /* Large Resource type -- bytes 1-2 contain the 16-bit length */
415 418
416 ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); 419 ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1));
@@ -515,6 +518,7 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
515 /* Walk the resource template, one descriptor per iteration */ 518 /* Walk the resource template, one descriptor per iteration */
516 519
517 while (aml < end_aml) { 520 while (aml < end_aml) {
521
518 /* Validate the Resource Type and Resource Length */ 522 /* Validate the Resource Type and Resource Length */
519 523
520 status = acpi_ut_validate_resource(aml, NULL); 524 status = acpi_ut_validate_resource(aml, NULL);
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c
index 4b134a722907..69f2bfdc26ab 100644
--- a/drivers/acpi/utilities/utstate.c
+++ b/drivers/acpi/utilities/utstate.c
@@ -129,6 +129,7 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
129 129
130 state = *list_head; 130 state = *list_head;
131 if (state) { 131 if (state) {
132
132 /* Update the list head */ 133 /* Update the list head */
133 134
134 *list_head = state->common.next; 135 *list_head = state->common.next;
@@ -158,6 +159,7 @@ union acpi_generic_state *acpi_ut_create_generic_state(void)
158 159
159 state = acpi_os_acquire_object(acpi_gbl_state_cache); 160 state = acpi_os_acquire_object(acpi_gbl_state_cache);
160 if (state) { 161 if (state) {
162
161 /* Initialize */ 163 /* Initialize */
162 memset(state, 0, sizeof(union acpi_generic_state)); 164 memset(state, 0, sizeof(union acpi_generic_state));
163 state->common.data_type = ACPI_DESC_TYPE_STATE; 165 state->common.data_type = ACPI_DESC_TYPE_STATE;