aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 22:57:06 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 22:57:06 -0500
commit3067e02f8f3ae2f3f02ba76400d03b8bcb4942b0 (patch)
tree761e19d279b27a03714a6673811e76e0b1cf2081 /drivers
parentf71eaf68406cfee91b6a96bcdf7ce33dc78829c5 (diff)
parentb00eb796f1b67c46036b5490e83b31741f1eebaf (diff)
Merge branch 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: ACPICA: Update version to 20091112. ACPICA: Add additional module-level code support ACPICA: Deploy new create integer interface where appropriate ACPICA: New internal utility function to create Integer objects ACPICA: Add repair for predefined methods that must return sorted lists ACPICA: Fix possible fault if return Package objects contain NULL elements ACPICA: Add post-order callback to acpi_walk_namespace ACPICA: Change package length error message to an info message ACPICA: Reduce severity of predefined repair messages, Warning to Info ACPICA: Update version to 20091013 ACPICA: Fix possible memory leak for Scope ASL operator ACPICA: Remove possibility of executing _REG methods twice ACPICA: Add repair for bad _MAT buffers ACPICA: Add repair for bad _BIF/_BIX packages
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpi_memhotplug.c4
-rw-r--r--drivers/acpi/acpica/Makefile2
-rw-r--r--drivers/acpi/acpica/acmacros.h3
-rw-r--r--drivers/acpi/acpica/acnamesp.h16
-rw-r--r--drivers/acpi/acpica/acutils.h7
-rw-r--r--drivers/acpi/acpica/dsinit.c2
-rw-r--r--drivers/acpi/acpica/dsmthdat.c4
-rw-r--r--drivers/acpi/acpica/dsobject.c8
-rw-r--r--drivers/acpi/acpica/dswload.c50
-rw-r--r--drivers/acpi/acpica/evgpeblk.c8
-rw-r--r--drivers/acpi/acpica/evregion.c81
-rw-r--r--drivers/acpi/acpica/exconfig.c4
-rw-r--r--drivers/acpi/acpica/exconvrt.c3
-rw-r--r--drivers/acpi/acpica/exfield.c3
-rw-r--r--drivers/acpi/acpica/exoparg1.c38
-rw-r--r--drivers/acpi/acpica/exoparg6.c7
-rw-r--r--drivers/acpi/acpica/nsdump.c4
-rw-r--r--drivers/acpi/acpica/nsdumpdv.c3
-rw-r--r--drivers/acpi/acpica/nseval.c50
-rw-r--r--drivers/acpi/acpica/nsinit.c8
-rw-r--r--drivers/acpi/acpica/nspredef.c49
-rw-r--r--drivers/acpi/acpica/nsrepair.c114
-rw-r--r--drivers/acpi/acpica/nsrepair2.c540
-rw-r--r--drivers/acpi/acpica/nswalk.c200
-rw-r--r--drivers/acpi/acpica/nsxfeval.c32
-rw-r--r--drivers/acpi/acpica/psloop.c32
-rw-r--r--drivers/acpi/acpica/psparse.c8
-rw-r--r--drivers/acpi/acpica/psxface.c4
-rw-r--r--drivers/acpi/acpica/utmisc.c42
-rw-r--r--drivers/acpi/acpica/utobject.c29
-rw-r--r--drivers/acpi/container.c4
-rw-r--r--drivers/acpi/dock.c8
-rw-r--r--drivers/acpi/ec.c2
-rw-r--r--drivers/acpi/glue.c2
-rw-r--r--drivers/acpi/pci_slot.c8
-rw-r--r--drivers/acpi/processor_core.c4
-rw-r--r--drivers/acpi/scan.c2
-rw-r--r--drivers/acpi/video_detect.c6
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c2
-rw-r--r--drivers/i2c/busses/i2c-scmi.c2
-rw-r--r--drivers/pci/hotplug/acpi_pcihp.c2
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c22
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c2
-rw-r--r--drivers/platform/x86/intel_menlow.c2
-rw-r--r--drivers/platform/x86/sony-laptop.c2
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c2
46 files changed, 1148 insertions, 279 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 28ccdbc05ac8..3597d73f28f6 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -537,7 +537,7 @@ static int __init acpi_memory_device_init(void)
537 537
538 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 538 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
539 ACPI_UINT32_MAX, 539 ACPI_UINT32_MAX,
540 acpi_memory_register_notify_handler, 540 acpi_memory_register_notify_handler, NULL,
541 NULL, NULL); 541 NULL, NULL);
542 542
543 if (ACPI_FAILURE(status)) { 543 if (ACPI_FAILURE(status)) {
@@ -561,7 +561,7 @@ static void __exit acpi_memory_device_exit(void)
561 */ 561 */
562 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 562 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
563 ACPI_UINT32_MAX, 563 ACPI_UINT32_MAX,
564 acpi_memory_deregister_notify_handler, 564 acpi_memory_deregister_notify_handler, NULL,
565 NULL, NULL); 565 NULL, NULL);
566 566
567 if (ACPI_FAILURE(status)) 567 if (ACPI_FAILURE(status))
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index e7973bc16846..7423052ece5a 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -28,7 +28,7 @@ acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o
28acpi-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \ 28acpi-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \
29 nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ 29 nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \
30 nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \ 30 nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \
31 nsparse.o nspredef.o nsrepair.o 31 nsparse.o nspredef.o nsrepair.o nsrepair2.o
32 32
33acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o 33acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o
34 34
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index 3acd9c6760ea..7d9ba6e57554 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -341,6 +341,7 @@
341#define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e); 341#define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e);
342#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e); 342#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e);
343#define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist 343#define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist
344#define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist
344 345
345#else 346#else
346 347
@@ -349,6 +350,8 @@
349#define ACPI_ERROR_NAMESPACE(s, e) 350#define ACPI_ERROR_NAMESPACE(s, e)
350#define ACPI_ERROR_METHOD(s, n, p, e) 351#define ACPI_ERROR_METHOD(s, n, p, e)
351#define ACPI_WARN_PREDEFINED(plist) 352#define ACPI_WARN_PREDEFINED(plist)
353#define ACPI_INFO_PREDEFINED(plist)
354
352#endif /* ACPI_NO_ERROR_MESSAGES */ 355#endif /* ACPI_NO_ERROR_MESSAGES */
353 356
354/* 357/*
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index 09a2764c734b..ab83919dda61 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -104,7 +104,8 @@ acpi_ns_walk_namespace(acpi_object_type type,
104 acpi_handle start_object, 104 acpi_handle start_object,
105 u32 max_depth, 105 u32 max_depth,
106 u32 flags, 106 u32 flags,
107 acpi_walk_callback user_function, 107 acpi_walk_callback pre_order_visit,
108 acpi_walk_callback post_order_visit,
108 void *context, void **return_value); 109 void *context, void **return_value);
109 110
110struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node 111struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node
@@ -272,7 +273,8 @@ acpi_ns_get_attached_data(struct acpi_namespace_node *node,
272 acpi_object_handler handler, void **data); 273 acpi_object_handler handler, void **data);
273 274
274/* 275/*
275 * nsrepair - return object repair for predefined methods/objects 276 * nsrepair - General return object repair for all
277 * predefined methods/objects
276 */ 278 */
277acpi_status 279acpi_status
278acpi_ns_repair_object(struct acpi_predefined_data *data, 280acpi_ns_repair_object(struct acpi_predefined_data *data,
@@ -285,6 +287,16 @@ acpi_ns_repair_package_list(struct acpi_predefined_data *data,
285 union acpi_operand_object **obj_desc_ptr); 287 union acpi_operand_object **obj_desc_ptr);
286 288
287/* 289/*
290 * nsrepair2 - Return object repair for specific
291 * predefined methods/objects
292 */
293acpi_status
294acpi_ns_complex_repairs(struct acpi_predefined_data *data,
295 struct acpi_namespace_node *node,
296 acpi_status validate_status,
297 union acpi_operand_object **return_object_ptr);
298
299/*
288 * nssearch - Namespace searching and entry 300 * nssearch - Namespace searching and entry
289 */ 301 */
290acpi_status 302acpi_status
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index 863a264b829e..3a451a21a3f9 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -386,6 +386,8 @@ u8 acpi_ut_valid_internal_object(void *object);
386 386
387union acpi_operand_object *acpi_ut_create_package_object(u32 count); 387union acpi_operand_object *acpi_ut_create_package_object(u32 count);
388 388
389union acpi_operand_object *acpi_ut_create_integer_object(u64 value);
390
389union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size); 391union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size);
390 392
391union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size); 393union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size);
@@ -481,6 +483,11 @@ acpi_ut_predefined_warning(const char *module_name,
481 char *pathname, 483 char *pathname,
482 u8 node_flags, const char *format, ...); 484 u8 node_flags, const char *format, ...);
483 485
486void ACPI_INTERNAL_VAR_XFACE
487acpi_ut_predefined_info(const char *module_name,
488 u32 line_number,
489 char *pathname, u8 node_flags, const char *format, ...);
490
484/* Values for Base above (16=Hex, 10=Decimal) */ 491/* Values for Base above (16=Hex, 10=Decimal) */
485 492
486#define ACPI_ANY_BASE 0 493#define ACPI_ANY_BASE 0
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c
index 3aae13f30c5e..f23fa0be6fc2 100644
--- a/drivers/acpi/acpica/dsinit.c
+++ b/drivers/acpi/acpica/dsinit.c
@@ -192,7 +192,7 @@ acpi_ds_initialize_objects(u32 table_index,
192 status = 192 status =
193 acpi_ns_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, 193 acpi_ns_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
194 ACPI_NS_WALK_UNLOCK, acpi_ds_init_one_object, 194 ACPI_NS_WALK_UNLOCK, acpi_ds_init_one_object,
195 &info, NULL); 195 NULL, &info, NULL);
196 if (ACPI_FAILURE(status)) { 196 if (ACPI_FAILURE(status)) {
197 ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); 197 ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace"));
198 } 198 }
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c
index 7d077bb2f525..0ba19f84ad82 100644
--- a/drivers/acpi/acpica/dsmthdat.c
+++ b/drivers/acpi/acpica/dsmthdat.c
@@ -409,13 +409,11 @@ acpi_ds_method_data_get_value(u8 type,
409 /* If slack enabled, init the local_x/arg_x to an Integer of value zero */ 409 /* If slack enabled, init the local_x/arg_x to an Integer of value zero */
410 410
411 if (acpi_gbl_enable_interpreter_slack) { 411 if (acpi_gbl_enable_interpreter_slack) {
412 object = 412 object = acpi_ut_create_integer_object((u64) 0);
413 acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
414 if (!object) { 413 if (!object) {
415 return_ACPI_STATUS(AE_NO_MEMORY); 414 return_ACPI_STATUS(AE_NO_MEMORY);
416 } 415 }
417 416
418 object->integer.value = 0;
419 node->object = object; 417 node->object = object;
420 } 418 }
421 419
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c
index 507e1f0bbdfd..9bc1ba076347 100644
--- a/drivers/acpi/acpica/dsobject.c
+++ b/drivers/acpi/acpica/dsobject.c
@@ -486,7 +486,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
486 * 486 *
487 * Note: technically, this is an error, from ACPI spec: "It is an error 487 * Note: technically, this is an error, from ACPI spec: "It is an error
488 * for NumElements to be less than the number of elements in the 488 * for NumElements to be less than the number of elements in the
489 * PackageList". However, we just print an error message and 489 * PackageList". However, we just print a message and
490 * no exception is returned. This provides Windows compatibility. Some 490 * no exception is returned. This provides Windows compatibility. Some
491 * BIOSs will alter the num_elements on the fly, creating this type 491 * BIOSs will alter the num_elements on the fly, creating this type
492 * of ill-formed package object. 492 * of ill-formed package object.
@@ -510,9 +510,9 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
510 arg = arg->common.next; 510 arg = arg->common.next;
511 } 511 }
512 512
513 ACPI_WARNING((AE_INFO, 513 ACPI_INFO((AE_INFO,
514 "Package List length (0x%X) larger than NumElements count (0x%X), truncated\n", 514 "Actual Package length (0x%X) is larger than NumElements field (0x%X), truncated\n",
515 i, element_count)); 515 i, element_count));
516 } else if (i < element_count) { 516 } else if (i < element_count) {
517 /* 517 /*
518 * Arg list (elements) was exhausted, but we did not reach num_elements count. 518 * Arg list (elements) was exhausted, but we did not reach num_elements count.
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c
index 6de3a99d4cd4..10fc78517843 100644
--- a/drivers/acpi/acpica/dswload.c
+++ b/drivers/acpi/acpica/dswload.c
@@ -639,26 +639,42 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
639 break; 639 break;
640 640
641 case AML_SCOPE_OP: 641 case AML_SCOPE_OP:
642 /* 642
643 * The Path is an object reference to an existing object. 643 /* Special case for Scope(\) -> refers to the Root node */
644 * Don't enter the name into the namespace, but look it up 644
645 * for use later. 645 if (op && (op->named.node == acpi_gbl_root_node)) {
646 */ 646 node = op->named.node;
647 status = 647
648 acpi_ns_lookup(walk_state->scope_info, buffer_ptr, 648 status =
649 object_type, ACPI_IMODE_EXECUTE, 649 acpi_ds_scope_stack_push(node, object_type,
650 ACPI_NS_SEARCH_PARENT, walk_state, &(node)); 650 walk_state);
651 if (ACPI_FAILURE(status)) { 651 if (ACPI_FAILURE(status)) {
652#ifdef ACPI_ASL_COMPILER 652 return_ACPI_STATUS(status);
653 if (status == AE_NOT_FOUND) {
654 status = AE_OK;
655 } else {
656 ACPI_ERROR_NAMESPACE(buffer_ptr, status);
657 } 653 }
654 } else {
655 /*
656 * The Path is an object reference to an existing object.
657 * Don't enter the name into the namespace, but look it up
658 * for use later.
659 */
660 status =
661 acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
662 object_type, ACPI_IMODE_EXECUTE,
663 ACPI_NS_SEARCH_PARENT, walk_state,
664 &(node));
665 if (ACPI_FAILURE(status)) {
666#ifdef ACPI_ASL_COMPILER
667 if (status == AE_NOT_FOUND) {
668 status = AE_OK;
669 } else {
670 ACPI_ERROR_NAMESPACE(buffer_ptr,
671 status);
672 }
658#else 673#else
659 ACPI_ERROR_NAMESPACE(buffer_ptr, status); 674 ACPI_ERROR_NAMESPACE(buffer_ptr, status);
660#endif 675#endif
661 return_ACPI_STATUS(status); 676 return_ACPI_STATUS(status);
677 }
662 } 678 }
663 679
664 /* 680 /*
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index a60aaa7635f3..247920900187 100644
--- a/drivers/acpi/acpica/evgpeblk.c
+++ b/drivers/acpi/acpica/evgpeblk.c
@@ -945,8 +945,8 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
945 945
946 status = acpi_ns_walk_namespace(ACPI_TYPE_METHOD, gpe_device, 946 status = acpi_ns_walk_namespace(ACPI_TYPE_METHOD, gpe_device,
947 ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, 947 ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
948 acpi_ev_save_method_info, gpe_block, 948 acpi_ev_save_method_info, NULL,
949 NULL); 949 gpe_block, NULL);
950 950
951 /* Return the new block */ 951 /* Return the new block */
952 952
@@ -1022,8 +1022,8 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
1022 status = 1022 status =
1023 acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 1023 acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
1024 ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, 1024 ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
1025 acpi_ev_match_prw_and_gpe, &gpe_info, 1025 acpi_ev_match_prw_and_gpe, NULL,
1026 NULL); 1026 &gpe_info, NULL);
1027 } 1027 }
1028 1028
1029 /* 1029 /*
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 98c7f9c62653..0bc807c33a56 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -51,6 +51,10 @@
51ACPI_MODULE_NAME("evregion") 51ACPI_MODULE_NAME("evregion")
52 52
53/* Local prototypes */ 53/* Local prototypes */
54static u8
55acpi_ev_has_default_handler(struct acpi_namespace_node *node,
56 acpi_adr_space_type space_id);
57
54static acpi_status 58static acpi_status
55acpi_ev_reg_run(acpi_handle obj_handle, 59acpi_ev_reg_run(acpi_handle obj_handle,
56 u32 level, void *context, void **return_value); 60 u32 level, void *context, void **return_value);
@@ -142,6 +146,50 @@ acpi_status acpi_ev_install_region_handlers(void)
142 146
143/******************************************************************************* 147/*******************************************************************************
144 * 148 *
149 * FUNCTION: acpi_ev_has_default_handler
150 *
151 * PARAMETERS: Node - Namespace node for the device
152 * space_id - The address space ID
153 *
154 * RETURN: TRUE if default handler is installed, FALSE otherwise
155 *
156 * DESCRIPTION: Check if the default handler is installed for the requested
157 * space ID.
158 *
159 ******************************************************************************/
160
161static u8
162acpi_ev_has_default_handler(struct acpi_namespace_node *node,
163 acpi_adr_space_type space_id)
164{
165 union acpi_operand_object *obj_desc;
166 union acpi_operand_object *handler_obj;
167
168 /* Must have an existing internal object */
169
170 obj_desc = acpi_ns_get_attached_object(node);
171 if (obj_desc) {
172 handler_obj = obj_desc->device.handler;
173
174 /* Walk the linked list of handlers for this object */
175
176 while (handler_obj) {
177 if (handler_obj->address_space.space_id == space_id) {
178 if (handler_obj->address_space.handler_flags &
179 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
180 return (TRUE);
181 }
182 }
183
184 handler_obj = handler_obj->address_space.next;
185 }
186 }
187
188 return (FALSE);
189}
190
191/*******************************************************************************
192 *
145 * FUNCTION: acpi_ev_initialize_op_regions 193 * FUNCTION: acpi_ev_initialize_op_regions
146 * 194 *
147 * PARAMETERS: None 195 * PARAMETERS: None
@@ -169,12 +217,18 @@ acpi_status acpi_ev_initialize_op_regions(void)
169 217
170 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { 218 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
171 /* 219 /*
172 * TBD: Make sure handler is the DEFAULT handler, otherwise 220 * Make sure the installed handler is the DEFAULT handler. If not the
173 * _REG will have already been run. 221 * default, the _REG methods will have already been run (when the
222 * handler was installed)
174 */ 223 */
175 status = acpi_ev_execute_reg_methods(acpi_gbl_root_node, 224 if (acpi_ev_has_default_handler(acpi_gbl_root_node,
176 acpi_gbl_default_address_spaces 225 acpi_gbl_default_address_spaces
177 [i]); 226 [i])) {
227 status =
228 acpi_ev_execute_reg_methods(acpi_gbl_root_node,
229 acpi_gbl_default_address_spaces
230 [i]);
231 }
178 } 232 }
179 233
180 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 234 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
@@ -235,23 +289,20 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
235 * connection status 1 for connecting the handler, 0 for disconnecting 289 * connection status 1 for connecting the handler, 0 for disconnecting
236 * the handler (Passed as a parameter) 290 * the handler (Passed as a parameter)
237 */ 291 */
238 args[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 292 args[0] =
293 acpi_ut_create_integer_object((u64) region_obj->region.space_id);
239 if (!args[0]) { 294 if (!args[0]) {
240 status = AE_NO_MEMORY; 295 status = AE_NO_MEMORY;
241 goto cleanup1; 296 goto cleanup1;
242 } 297 }
243 298
244 args[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 299 args[1] = acpi_ut_create_integer_object((u64) function);
245 if (!args[1]) { 300 if (!args[1]) {
246 status = AE_NO_MEMORY; 301 status = AE_NO_MEMORY;
247 goto cleanup2; 302 goto cleanup2;
248 } 303 }
249 304
250 /* Setup the parameter objects */ 305 args[2] = NULL; /* Terminate list */
251
252 args[0]->integer.value = region_obj->region.space_id;
253 args[1]->integer.value = function;
254 args[2] = NULL;
255 306
256 /* Execute the method, no return value */ 307 /* Execute the method, no return value */
257 308
@@ -971,8 +1022,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
971 */ 1022 */
972 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, 1023 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
973 ACPI_NS_WALK_UNLOCK, 1024 ACPI_NS_WALK_UNLOCK,
974 acpi_ev_install_handler, handler_obj, 1025 acpi_ev_install_handler, NULL,
975 NULL); 1026 handler_obj, NULL);
976 1027
977 unlock_and_exit: 1028 unlock_and_exit:
978 return_ACPI_STATUS(status); 1029 return_ACPI_STATUS(status);
@@ -1008,7 +1059,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
1008 */ 1059 */
1009 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, 1060 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
1010 ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, 1061 ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run,
1011 &space_id, NULL); 1062 NULL, &space_id, NULL);
1012 1063
1013 return_ACPI_STATUS(status); 1064 return_ACPI_STATUS(status);
1014} 1065}
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c
index 24afef81af39..46adfa541cbc 100644
--- a/drivers/acpi/acpica/exconfig.c
+++ b/drivers/acpi/acpica/exconfig.c
@@ -170,14 +170,12 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
170 170
171 /* Table not found, return an Integer=0 and AE_OK */ 171 /* Table not found, return an Integer=0 and AE_OK */
172 172
173 ddb_handle = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 173 ddb_handle = acpi_ut_create_integer_object((u64) 0);
174 if (!ddb_handle) { 174 if (!ddb_handle) {
175 return_ACPI_STATUS(AE_NO_MEMORY); 175 return_ACPI_STATUS(AE_NO_MEMORY);
176 } 176 }
177 177
178 ddb_handle->integer.value = 0;
179 *return_desc = ddb_handle; 178 *return_desc = ddb_handle;
180
181 return_ACPI_STATUS(AE_OK); 179 return_ACPI_STATUS(AE_OK);
182 } 180 }
183 181
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c
index 37d0d39e60a6..51d5f224f9fa 100644
--- a/drivers/acpi/acpica/exconvrt.c
+++ b/drivers/acpi/acpica/exconvrt.c
@@ -167,7 +167,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
167 167
168 /* Create a new integer */ 168 /* Create a new integer */
169 169
170 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 170 return_desc = acpi_ut_create_integer_object(result);
171 if (!return_desc) { 171 if (!return_desc) {
172 return_ACPI_STATUS(AE_NO_MEMORY); 172 return_ACPI_STATUS(AE_NO_MEMORY);
173 } 173 }
@@ -177,7 +177,6 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
177 177
178 /* Save the Result */ 178 /* Save the Result */
179 179
180 return_desc->integer.value = result;
181 acpi_ex_truncate_for32bit_table(return_desc); 180 acpi_ex_truncate_for32bit_table(return_desc);
182 *result_desc = return_desc; 181 *result_desc = return_desc;
183 return_ACPI_STATUS(AE_OK); 182 return_ACPI_STATUS(AE_OK);
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index 0b33d6c887b9..1588a2d660e7 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -162,13 +162,12 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
162 } else { 162 } else {
163 /* Field will fit within an Integer (normal case) */ 163 /* Field will fit within an Integer (normal case) */
164 164
165 buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 165 buffer_desc = acpi_ut_create_integer_object((u64) 0);
166 if (!buffer_desc) { 166 if (!buffer_desc) {
167 return_ACPI_STATUS(AE_NO_MEMORY); 167 return_ACPI_STATUS(AE_NO_MEMORY);
168 } 168 }
169 169
170 length = acpi_gbl_integer_byte_width; 170 length = acpi_gbl_integer_byte_width;
171 buffer_desc->integer.value = 0;
172 buffer = &buffer_desc->integer.value; 171 buffer = &buffer_desc->integer.value;
173 } 172 }
174 173
diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c
index 9635d21e568d..752fe48b2d20 100644
--- a/drivers/acpi/acpica/exoparg1.c
+++ b/drivers/acpi/acpica/exoparg1.c
@@ -100,12 +100,12 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state)
100 100
101 /* Create a return object of type Integer */ 101 /* Create a return object of type Integer */
102 102
103 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 103 return_desc =
104 acpi_ut_create_integer_object(acpi_os_get_timer());
104 if (!return_desc) { 105 if (!return_desc) {
105 status = AE_NO_MEMORY; 106 status = AE_NO_MEMORY;
106 goto cleanup; 107 goto cleanup;
107 } 108 }
108 return_desc->integer.value = acpi_os_get_timer();
109 break; 109 break;
110 110
111 default: /* Unknown opcode */ 111 default: /* Unknown opcode */
@@ -599,7 +599,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
599 switch (walk_state->opcode) { 599 switch (walk_state->opcode) {
600 case AML_LNOT_OP: /* LNot (Operand) */ 600 case AML_LNOT_OP: /* LNot (Operand) */
601 601
602 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 602 return_desc = acpi_ut_create_integer_object((u64) 0);
603 if (!return_desc) { 603 if (!return_desc) {
604 status = AE_NO_MEMORY; 604 status = AE_NO_MEMORY;
605 goto cleanup; 605 goto cleanup;
@@ -702,13 +702,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
702 702
703 /* Allocate a descriptor to hold the type. */ 703 /* Allocate a descriptor to hold the type. */
704 704
705 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 705 return_desc = acpi_ut_create_integer_object((u64) type);
706 if (!return_desc) { 706 if (!return_desc) {
707 status = AE_NO_MEMORY; 707 status = AE_NO_MEMORY;
708 goto cleanup; 708 goto cleanup;
709 } 709 }
710
711 return_desc->integer.value = type;
712 break; 710 break;
713 711
714 case AML_SIZE_OF_OP: /* size_of (source_object) */ 712 case AML_SIZE_OF_OP: /* size_of (source_object) */
@@ -777,13 +775,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
777 * Now that we have the size of the object, create a result 775 * Now that we have the size of the object, create a result
778 * object to hold the value 776 * object to hold the value
779 */ 777 */
780 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 778 return_desc = acpi_ut_create_integer_object(value);
781 if (!return_desc) { 779 if (!return_desc) {
782 status = AE_NO_MEMORY; 780 status = AE_NO_MEMORY;
783 goto cleanup; 781 goto cleanup;
784 } 782 }
785
786 return_desc->integer.value = value;
787 break; 783 break;
788 784
789 case AML_REF_OF_OP: /* ref_of (source_object) */ 785 case AML_REF_OF_OP: /* ref_of (source_object) */
@@ -946,24 +942,24 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
946 * NOTE: index into a buffer is NOT a pointer to a 942 * NOTE: index into a buffer is NOT a pointer to a
947 * sub-buffer of the main buffer, it is only a pointer to a 943 * sub-buffer of the main buffer, it is only a pointer to a
948 * single element (byte) of the buffer! 944 * single element (byte) of the buffer!
945 *
946 * Since we are returning the value of the buffer at the
947 * indexed location, we don't need to add an additional
948 * reference to the buffer itself.
949 */ 949 */
950 return_desc = 950 return_desc =
951 acpi_ut_create_internal_object 951 acpi_ut_create_integer_object((u64)
952 (ACPI_TYPE_INTEGER); 952 temp_desc->
953 buffer.
954 pointer
955 [operand
956 [0]->
957 reference.
958 value]);
953 if (!return_desc) { 959 if (!return_desc) {
954 status = AE_NO_MEMORY; 960 status = AE_NO_MEMORY;
955 goto cleanup; 961 goto cleanup;
956 } 962 }
957
958 /*
959 * Since we are returning the value of the buffer at the
960 * indexed location, we don't need to add an additional
961 * reference to the buffer itself.
962 */
963 return_desc->integer.value =
964 temp_desc->buffer.
965 pointer[operand[0]->reference.
966 value];
967 break; 963 break;
968 964
969 case ACPI_TYPE_PACKAGE: 965 case ACPI_TYPE_PACKAGE:
diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c
index ae43f7670a6c..295542e6bd51 100644
--- a/drivers/acpi/acpica/exoparg6.c
+++ b/drivers/acpi/acpica/exoparg6.c
@@ -253,18 +253,15 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
253 } 253 }
254 254
255 /* Create an integer for the return value */ 255 /* Create an integer for the return value */
256 /* Default return value is ACPI_INTEGER_MAX if no match found */
256 257
257 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 258 return_desc = acpi_ut_create_integer_object(ACPI_INTEGER_MAX);
258 if (!return_desc) { 259 if (!return_desc) {
259 status = AE_NO_MEMORY; 260 status = AE_NO_MEMORY;
260 goto cleanup; 261 goto cleanup;
261 262
262 } 263 }
263 264
264 /* Default return value if no match found */
265
266 return_desc->integer.value = ACPI_INTEGER_MAX;
267
268 /* 265 /*
269 * Examine each element until a match is found. Both match conditions 266 * Examine each element until a match is found. Both match conditions
270 * must be satisfied for a match to occur. Within the loop, 267 * must be satisfied for a match to occur. Within the loop,
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c
index 2bad613db73a..2deb986861ca 100644
--- a/drivers/acpi/acpica/nsdump.c
+++ b/drivers/acpi/acpica/nsdump.c
@@ -634,8 +634,8 @@ acpi_ns_dump_objects(acpi_object_type type,
634 (void)acpi_ns_walk_namespace(type, start_handle, max_depth, 634 (void)acpi_ns_walk_namespace(type, start_handle, max_depth,
635 ACPI_NS_WALK_NO_UNLOCK | 635 ACPI_NS_WALK_NO_UNLOCK |
636 ACPI_NS_WALK_TEMP_NODES, 636 ACPI_NS_WALK_TEMP_NODES,
637 acpi_ns_dump_one_object, (void *)&info, 637 acpi_ns_dump_one_object, NULL,
638 NULL); 638 (void *)&info, NULL);
639} 639}
640#endif /* ACPI_FUTURE_USAGE */ 640#endif /* ACPI_FUTURE_USAGE */
641 641
diff --git a/drivers/acpi/acpica/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c
index 0fe87f1aef16..36be7f0e97ec 100644
--- a/drivers/acpi/acpica/nsdumpdv.c
+++ b/drivers/acpi/acpica/nsdumpdv.c
@@ -131,7 +131,8 @@ void acpi_ns_dump_root_devices(void)
131 131
132 status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, sys_bus_handle, 132 status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, sys_bus_handle,
133 ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, 133 ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
134 acpi_ns_dump_one_device, NULL, NULL); 134 acpi_ns_dump_one_device, NULL, NULL,
135 NULL);
135} 136}
136 137
137#endif 138#endif
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c
index 846d1132feb1..f771e978c403 100644
--- a/drivers/acpi/acpica/nseval.c
+++ b/drivers/acpi/acpica/nseval.c
@@ -366,33 +366,49 @@ static void
366acpi_ns_exec_module_code(union acpi_operand_object *method_obj, 366acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
367 struct acpi_evaluate_info *info) 367 struct acpi_evaluate_info *info)
368{ 368{
369 union acpi_operand_object *root_obj; 369 union acpi_operand_object *parent_obj;
370 struct acpi_namespace_node *parent_node;
371 acpi_object_type type;
370 acpi_status status; 372 acpi_status status;
371 373
372 ACPI_FUNCTION_TRACE(ns_exec_module_code); 374 ACPI_FUNCTION_TRACE(ns_exec_module_code);
373 375
376 /*
377 * Get the parent node. We cheat by using the next_object field
378 * of the method object descriptor.
379 */
380 parent_node = ACPI_CAST_PTR(struct acpi_namespace_node,
381 method_obj->method.next_object);
382 type = acpi_ns_get_type(parent_node);
383
384 /* Must clear next_object (acpi_ns_attach_object needs the field) */
385
386 method_obj->method.next_object = NULL;
387
374 /* Initialize the evaluation information block */ 388 /* Initialize the evaluation information block */
375 389
376 ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info)); 390 ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info));
377 info->prefix_node = acpi_gbl_root_node; 391 info->prefix_node = parent_node;
378 392
379 /* 393 /*
380 * Get the currently attached root object. Add a reference, because the 394 * Get the currently attached parent object. Add a reference, because the
381 * ref count will be decreased when the method object is installed to 395 * ref count will be decreased when the method object is installed to
382 * the root node. 396 * the parent node.
383 */ 397 */
384 root_obj = acpi_ns_get_attached_object(acpi_gbl_root_node); 398 parent_obj = acpi_ns_get_attached_object(parent_node);
385 acpi_ut_add_reference(root_obj); 399 if (parent_obj) {
400 acpi_ut_add_reference(parent_obj);
401 }
386 402
387 /* Install the method (module-level code) in the root node */ 403 /* Install the method (module-level code) in the parent node */
388 404
389 status = acpi_ns_attach_object(acpi_gbl_root_node, method_obj, 405 status = acpi_ns_attach_object(parent_node, method_obj,
390 ACPI_TYPE_METHOD); 406 ACPI_TYPE_METHOD);
391 if (ACPI_FAILURE(status)) { 407 if (ACPI_FAILURE(status)) {
392 goto exit; 408 goto exit;
393 } 409 }
394 410
395 /* Execute the root node as a control method */ 411 /* Execute the parent node as a control method */
396 412
397 status = acpi_ns_evaluate(info); 413 status = acpi_ns_evaluate(info);
398 414
@@ -401,15 +417,19 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
401 417
402 /* Detach the temporary method object */ 418 /* Detach the temporary method object */
403 419
404 acpi_ns_detach_object(acpi_gbl_root_node); 420 acpi_ns_detach_object(parent_node);
405 421
406 /* Restore the original root object */ 422 /* Restore the original parent object */
407 423
408 status = 424 if (parent_obj) {
409 acpi_ns_attach_object(acpi_gbl_root_node, root_obj, 425 status = acpi_ns_attach_object(parent_node, parent_obj, type);
410 ACPI_TYPE_DEVICE); 426 } else {
427 parent_node->type = (u8)type;
428 }
411 429
412 exit: 430 exit:
413 acpi_ut_remove_reference(root_obj); 431 if (parent_obj) {
432 acpi_ut_remove_reference(parent_obj);
433 }
414 return_VOID; 434 return_VOID;
415} 435}
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index 1d5b360eb25b..4f8abac231d2 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -96,7 +96,7 @@ acpi_status acpi_ns_initialize_objects(void)
96 /* Walk entire namespace from the supplied root */ 96 /* Walk entire namespace from the supplied root */
97 97
98 status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, 98 status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
99 ACPI_UINT32_MAX, acpi_ns_init_one_object, 99 ACPI_UINT32_MAX, acpi_ns_init_one_object, NULL,
100 &info, NULL); 100 &info, NULL);
101 if (ACPI_FAILURE(status)) { 101 if (ACPI_FAILURE(status)) {
102 ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); 102 ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace"));
@@ -156,7 +156,8 @@ acpi_status acpi_ns_initialize_devices(void)
156 156
157 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, 157 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
158 ACPI_UINT32_MAX, FALSE, 158 ACPI_UINT32_MAX, FALSE,
159 acpi_ns_find_ini_methods, &info, NULL); 159 acpi_ns_find_ini_methods, NULL, &info,
160 NULL);
160 if (ACPI_FAILURE(status)) { 161 if (ACPI_FAILURE(status)) {
161 goto error_exit; 162 goto error_exit;
162 } 163 }
@@ -189,7 +190,8 @@ acpi_status acpi_ns_initialize_devices(void)
189 190
190 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, 191 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
191 ACPI_UINT32_MAX, FALSE, 192 ACPI_UINT32_MAX, FALSE,
192 acpi_ns_init_one_device, &info, NULL); 193 acpi_ns_init_one_device, NULL, &info,
194 NULL);
193 195
194 ACPI_FREE(info.evaluate_info); 196 ACPI_FREE(info.evaluate_info);
195 if (ACPI_FAILURE(status)) { 197 if (ACPI_FAILURE(status)) {
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index f8427afeebdf..b05f42903c86 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -232,6 +232,12 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
232 status = acpi_ns_check_package(data, return_object_ptr); 232 status = acpi_ns_check_package(data, return_object_ptr);
233 } 233 }
234 234
235 /*
236 * Perform additional, more complicated repairs on a per-name
237 * basis.
238 */
239 status = acpi_ns_complex_repairs(data, node, status, return_object_ptr);
240
235check_validation_status: 241check_validation_status:
236 /* 242 /*
237 * If the object validation failed or if we successfully repaired one 243 * If the object validation failed or if we successfully repaired one
@@ -601,7 +607,8 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
601 * there is only one entry). We may be able to repair this by 607 * there is only one entry). We may be able to repair this by
602 * wrapping the returned Package with a new outer Package. 608 * wrapping the returned Package with a new outer Package.
603 */ 609 */
604 if ((*elements)->common.type != ACPI_TYPE_PACKAGE) { 610 if (*elements
611 && ((*elements)->common.type != ACPI_TYPE_PACKAGE)) {
605 612
606 /* Create the new outer package and populate it */ 613 /* Create the new outer package and populate it */
607 614
@@ -673,6 +680,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
673 union acpi_operand_object *sub_package; 680 union acpi_operand_object *sub_package;
674 union acpi_operand_object **sub_elements; 681 union acpi_operand_object **sub_elements;
675 acpi_status status; 682 acpi_status status;
683 u8 non_trailing_null = FALSE;
676 u32 expected_count; 684 u32 expected_count;
677 u32 i; 685 u32 i;
678 u32 j; 686 u32 j;
@@ -680,6 +688,45 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
680 /* Validate each sub-Package in the parent Package */ 688 /* Validate each sub-Package in the parent Package */
681 689
682 for (i = 0; i < count; i++) { 690 for (i = 0; i < count; i++) {
691 /*
692 * Handling for NULL package elements. For now, we will simply allow
693 * a parent package with trailing NULL elements. This can happen if
694 * the package was defined to be longer than the initializer list.
695 * This is legal as per the ACPI specification. It is often used
696 * to allow for dynamic initialization of a Package.
697 *
698 * A future enhancement may be to simply truncate the package to
699 * remove the trailing NULL elements.
700 */
701 if (!(*elements)) {
702 if (!non_trailing_null) {
703
704 /* Ensure the remaining elements are all NULL */
705
706 for (j = 1; j < (count - i + 1); j++) {
707 if (elements[j]) {
708 non_trailing_null = TRUE;
709 }
710 }
711
712 if (!non_trailing_null) {
713
714 /* Ignore the trailing NULL elements */
715
716 return (AE_OK);
717 }
718 }
719
720 /* There are trailing non-null elements, issue warning */
721
722 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
723 data->node_flags,
724 "Found NULL element at package index %u",
725 i));
726 elements++;
727 continue;
728 }
729
683 sub_package = *elements; 730 sub_package = *elements;
684 sub_elements = sub_package->package.elements; 731 sub_elements = sub_package->package.elements;
685 732
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c
index db2b2a99c3a8..d563f1a564a7 100644
--- a/drivers/acpi/acpica/nsrepair.c
+++ b/drivers/acpi/acpica/nsrepair.c
@@ -44,6 +44,7 @@
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include "accommon.h" 45#include "accommon.h"
46#include "acnamesp.h" 46#include "acnamesp.h"
47#include "acinterp.h"
47#include "acpredef.h" 48#include "acpredef.h"
48 49
49#define _COMPONENT ACPI_NAMESPACE 50#define _COMPONENT ACPI_NAMESPACE
@@ -76,7 +77,13 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,
76 union acpi_operand_object *return_object = *return_object_ptr; 77 union acpi_operand_object *return_object = *return_object_ptr;
77 union acpi_operand_object *new_object; 78 union acpi_operand_object *new_object;
78 acpi_size length; 79 acpi_size length;
80 acpi_status status;
79 81
82 /*
83 * At this point, we know that the type of the returned object was not
84 * one of the expected types for this predefined name. Attempt to
85 * repair the object. Only a limited number of repairs are possible.
86 */
80 switch (return_object->common.type) { 87 switch (return_object->common.type) {
81 case ACPI_TYPE_BUFFER: 88 case ACPI_TYPE_BUFFER:
82 89
@@ -111,43 +118,94 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,
111 */ 118 */
112 ACPI_MEMCPY(new_object->string.pointer, 119 ACPI_MEMCPY(new_object->string.pointer,
113 return_object->buffer.pointer, length); 120 return_object->buffer.pointer, length);
121 break;
114 122
115 /* 123 case ACPI_TYPE_INTEGER:
116 * If the original object is a package element, we need to: 124
117 * 1. Set the reference count of the new object to match the 125 /* 1) Does the method/object legally return a buffer? */
118 * reference count of the old object. 126
119 * 2. Decrement the reference count of the original object. 127 if (expected_btypes & ACPI_RTYPE_BUFFER) {
120 */ 128 /*
121 if (package_index != ACPI_NOT_PACKAGE_ELEMENT) { 129 * Convert the Integer to a packed-byte buffer. _MAT needs
122 new_object->common.reference_count = 130 * this sometimes, if a read has been performed on a Field
123 return_object->common.reference_count; 131 * object that is less than or equal to the global integer
132 * size (32 or 64 bits).
133 */
134 status =
135 acpi_ex_convert_to_buffer(return_object,
136 &new_object);
137 if (ACPI_FAILURE(status)) {
138 return (status);
139 }
140 }
124 141
125 if (return_object->common.reference_count > 1) { 142 /* 2) Does the method/object legally return a string? */
126 return_object->common.reference_count--; 143
144 else if (expected_btypes & ACPI_RTYPE_STRING) {
145 /*
146 * The only supported Integer-to-String conversion is to convert
147 * an integer of value 0 to a NULL string. The last element of
148 * _BIF and _BIX packages occasionally need this fix.
149 */
150 if (return_object->integer.value != 0) {
151 return (AE_AML_OPERAND_TYPE);
127 } 152 }
128 153
129 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, 154 /* Allocate a new NULL string object */
130 data->node_flags, 155
131 "Converted Buffer to expected String at index %u", 156 new_object = acpi_ut_create_string_object(0);
132 package_index)); 157 if (!new_object) {
158 return (AE_NO_MEMORY);
159 }
133 } else { 160 } else {
134 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, 161 return (AE_AML_OPERAND_TYPE);
135 data->node_flags,
136 "Converted Buffer to expected String"));
137 } 162 }
163 break;
138 164
139 /* Delete old object, install the new return object */ 165 default:
140 166
141 acpi_ut_remove_reference(return_object); 167 /* We cannot repair this object */
142 *return_object_ptr = new_object;
143 data->flags |= ACPI_OBJECT_REPAIRED;
144 return (AE_OK);
145 168
146 default: 169 return (AE_AML_OPERAND_TYPE);
147 break; 170 }
171
172 /* Object was successfully repaired */
173
174 /*
175 * If the original object is a package element, we need to:
176 * 1. Set the reference count of the new object to match the
177 * reference count of the old object.
178 * 2. Decrement the reference count of the original object.
179 */
180 if (package_index != ACPI_NOT_PACKAGE_ELEMENT) {
181 new_object->common.reference_count =
182 return_object->common.reference_count;
183
184 if (return_object->common.reference_count > 1) {
185 return_object->common.reference_count--;
186 }
187
188 ACPI_INFO_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
189 "Converted %s to expected %s at index %u",
190 acpi_ut_get_object_type_name
191 (return_object),
192 acpi_ut_get_object_type_name(new_object),
193 package_index));
194 } else {
195 ACPI_INFO_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
196 "Converted %s to expected %s",
197 acpi_ut_get_object_type_name
198 (return_object),
199 acpi_ut_get_object_type_name
200 (new_object)));
148 } 201 }
149 202
150 return (AE_AML_OPERAND_TYPE); 203 /* Delete old object, install the new return object */
204
205 acpi_ut_remove_reference(return_object);
206 *return_object_ptr = new_object;
207 data->flags |= ACPI_OBJECT_REPAIRED;
208 return (AE_OK);
151} 209}
152 210
153/******************************************************************************* 211/*******************************************************************************
@@ -196,8 +254,8 @@ acpi_ns_repair_package_list(struct acpi_predefined_data *data,
196 *obj_desc_ptr = pkg_obj_desc; 254 *obj_desc_ptr = pkg_obj_desc;
197 data->flags |= ACPI_OBJECT_REPAIRED; 255 data->flags |= ACPI_OBJECT_REPAIRED;
198 256
199 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 257 ACPI_INFO_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
200 "Incorrectly formed Package, attempting repair")); 258 "Repaired Incorrectly formed Package"));
201 259
202 return (AE_OK); 260 return (AE_OK);
203} 261}
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
new file mode 100644
index 000000000000..d07b68613818
--- /dev/null
+++ b/drivers/acpi/acpica/nsrepair2.c
@@ -0,0 +1,540 @@
1/******************************************************************************
2 *
3 * Module Name: nsrepair2 - Repair for objects returned by specific
4 * predefined methods
5 *
6 *****************************************************************************/
7
8/*
9 * Copyright (C) 2000 - 2009, Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
45#include <acpi/acpi.h>
46#include "accommon.h"
47#include "acnamesp.h"
48
49#define _COMPONENT ACPI_NAMESPACE
50ACPI_MODULE_NAME("nsrepair2")
51
52/*
53 * Information structure and handler for ACPI predefined names that can
54 * be repaired on a per-name basis.
55 */
56typedef
57acpi_status(*acpi_repair_function) (struct acpi_predefined_data *data,
58 union acpi_operand_object **return_object_ptr);
59
60typedef struct acpi_repair_info {
61 char name[ACPI_NAME_SIZE];
62 acpi_repair_function repair_function;
63
64} acpi_repair_info;
65
66/* Local prototypes */
67
68static const struct acpi_repair_info *acpi_ns_match_repairable_name(struct
69 acpi_namespace_node
70 *node);
71
72static acpi_status
73acpi_ns_repair_ALR(struct acpi_predefined_data *data,
74 union acpi_operand_object **return_object_ptr);
75
76static acpi_status
77acpi_ns_repair_PSS(struct acpi_predefined_data *data,
78 union acpi_operand_object **return_object_ptr);
79
80static acpi_status
81acpi_ns_repair_TSS(struct acpi_predefined_data *data,
82 union acpi_operand_object **return_object_ptr);
83
84static acpi_status
85acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
86 union acpi_operand_object *return_object,
87 u32 expected_count,
88 u32 sort_index,
89 u8 sort_direction, char *sort_key_name);
90
91static acpi_status
92acpi_ns_remove_null_elements(union acpi_operand_object *package);
93
94static acpi_status
95acpi_ns_sort_list(union acpi_operand_object **elements,
96 u32 count, u32 index, u8 sort_direction);
97
98/* Values for sort_direction above */
99
100#define ACPI_SORT_ASCENDING 0
101#define ACPI_SORT_DESCENDING 1
102
103/*
104 * This table contains the names of the predefined methods for which we can
105 * perform more complex repairs.
106 *
107 * _ALR: Sort the list ascending by ambient_illuminance if necessary
108 * _PSS: Sort the list descending by Power if necessary
109 * _TSS: Sort the list descending by Power if necessary
110 */
111static const struct acpi_repair_info acpi_ns_repairable_names[] = {
112 {"_ALR", acpi_ns_repair_ALR},
113 {"_PSS", acpi_ns_repair_PSS},
114 {"_TSS", acpi_ns_repair_TSS},
115 {{0, 0, 0, 0}, NULL} /* Table terminator */
116};
117
118/******************************************************************************
119 *
120 * FUNCTION: acpi_ns_complex_repairs
121 *
122 * PARAMETERS: Data - Pointer to validation data structure
123 * Node - Namespace node for the method/object
124 * validate_status - Original status of earlier validation
125 * return_object_ptr - Pointer to the object returned from the
126 * evaluation of a method or object
127 *
128 * RETURN: Status. AE_OK if repair was successful. If name is not
129 * matched, validate_status is returned.
130 *
131 * DESCRIPTION: Attempt to repair/convert a return object of a type that was
132 * not expected.
133 *
134 *****************************************************************************/
135
136acpi_status
137acpi_ns_complex_repairs(struct acpi_predefined_data *data,
138 struct acpi_namespace_node *node,
139 acpi_status validate_status,
140 union acpi_operand_object **return_object_ptr)
141{
142 const struct acpi_repair_info *predefined;
143 acpi_status status;
144
145 /* Check if this name is in the list of repairable names */
146
147 predefined = acpi_ns_match_repairable_name(node);
148 if (!predefined) {
149 return (validate_status);
150 }
151
152 status = predefined->repair_function(data, return_object_ptr);
153 return (status);
154}
155
156/******************************************************************************
157 *
158 * FUNCTION: acpi_ns_match_repairable_name
159 *
160 * PARAMETERS: Node - Namespace node for the method/object
161 *
162 * RETURN: Pointer to entry in repair table. NULL indicates not found.
163 *
164 * DESCRIPTION: Check an object name against the repairable object list.
165 *
166 *****************************************************************************/
167
168static const struct acpi_repair_info *acpi_ns_match_repairable_name(struct
169 acpi_namespace_node
170 *node)
171{
172 const struct acpi_repair_info *this_name;
173
174 /* Search info table for a repairable predefined method/object name */
175
176 this_name = acpi_ns_repairable_names;
177 while (this_name->repair_function) {
178 if (ACPI_COMPARE_NAME(node->name.ascii, this_name->name)) {
179 return (this_name);
180 }
181 this_name++;
182 }
183
184 return (NULL); /* Not found */
185}
186
187/******************************************************************************
188 *
189 * FUNCTION: acpi_ns_repair_ALR
190 *
191 * PARAMETERS: Data - Pointer to validation data structure
192 * return_object_ptr - Pointer to the object returned from the
193 * evaluation of a method or object
194 *
195 * RETURN: Status. AE_OK if object is OK or was repaired successfully
196 *
197 * DESCRIPTION: Repair for the _ALR object. If necessary, sort the object list
198 * ascending by the ambient illuminance values.
199 *
200 *****************************************************************************/
201
202static acpi_status
203acpi_ns_repair_ALR(struct acpi_predefined_data *data,
204 union acpi_operand_object **return_object_ptr)
205{
206 union acpi_operand_object *return_object = *return_object_ptr;
207 acpi_status status;
208
209 status = acpi_ns_check_sorted_list(data, return_object, 2, 1,
210 ACPI_SORT_ASCENDING,
211 "AmbientIlluminance");
212
213 return (status);
214}
215
216/******************************************************************************
217 *
218 * FUNCTION: acpi_ns_repair_TSS
219 *
220 * PARAMETERS: Data - Pointer to validation data structure
221 * return_object_ptr - Pointer to the object returned from the
222 * evaluation of a method or object
223 *
224 * RETURN: Status. AE_OK if object is OK or was repaired successfully
225 *
226 * DESCRIPTION: Repair for the _TSS object. If necessary, sort the object list
227 * descending by the power dissipation values.
228 *
229 *****************************************************************************/
230
231static acpi_status
232acpi_ns_repair_TSS(struct acpi_predefined_data *data,
233 union acpi_operand_object **return_object_ptr)
234{
235 union acpi_operand_object *return_object = *return_object_ptr;
236 acpi_status status;
237
238 status = acpi_ns_check_sorted_list(data, return_object, 5, 1,
239 ACPI_SORT_DESCENDING,
240 "PowerDissipation");
241
242 return (status);
243}
244
245/******************************************************************************
246 *
247 * FUNCTION: acpi_ns_repair_PSS
248 *
249 * PARAMETERS: Data - Pointer to validation data structure
250 * return_object_ptr - Pointer to the object returned from the
251 * evaluation of a method or object
252 *
253 * RETURN: Status. AE_OK if object is OK or was repaired successfully
254 *
255 * DESCRIPTION: Repair for the _PSS object. If necessary, sort the object list
256 * by the CPU frequencies. Check that the power dissipation values
257 * are all proportional to CPU frequency (i.e., sorting by
258 * frequency should be the same as sorting by power.)
259 *
260 *****************************************************************************/
261
262static acpi_status
263acpi_ns_repair_PSS(struct acpi_predefined_data *data,
264 union acpi_operand_object **return_object_ptr)
265{
266 union acpi_operand_object *return_object = *return_object_ptr;
267 union acpi_operand_object **outer_elements;
268 u32 outer_element_count;
269 union acpi_operand_object **elements;
270 union acpi_operand_object *obj_desc;
271 u32 previous_value;
272 acpi_status status;
273 u32 i;
274
275 /*
276 * Entries (sub-packages) in the _PSS Package must be sorted by power
277 * dissipation, in descending order. If it appears that the list is
278 * incorrectly sorted, sort it. We sort by cpu_frequency, since this
279 * should be proportional to the power.
280 */
281 status = acpi_ns_check_sorted_list(data, return_object, 6, 0,
282 ACPI_SORT_DESCENDING,
283 "CpuFrequency");
284 if (ACPI_FAILURE(status)) {
285 return (status);
286 }
287
288 /*
289 * We now know the list is correctly sorted by CPU frequency. Check if
290 * the power dissipation values are proportional.
291 */
292 previous_value = ACPI_UINT32_MAX;
293 outer_elements = return_object->package.elements;
294 outer_element_count = return_object->package.count;
295
296 for (i = 0; i < outer_element_count; i++) {
297 elements = (*outer_elements)->package.elements;
298 obj_desc = elements[1]; /* Index1 = power_dissipation */
299
300 if ((u32) obj_desc->integer.value > previous_value) {
301 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
302 data->node_flags,
303 "SubPackage[%u,%u] - suspicious power dissipation values",
304 i - 1, i));
305 }
306
307 previous_value = (u32) obj_desc->integer.value;
308 outer_elements++;
309 }
310
311 return (AE_OK);
312}
313
314/******************************************************************************
315 *
316 * FUNCTION: acpi_ns_check_sorted_list
317 *
318 * PARAMETERS: Data - Pointer to validation data structure
319 * return_object - Pointer to the top-level returned object
320 * expected_count - Minimum length of each sub-package
321 * sort_index - Sub-package entry to sort on
322 * sort_direction - Ascending or descending
323 * sort_key_name - Name of the sort_index field
324 *
325 * RETURN: Status. AE_OK if the list is valid and is sorted correctly or
326 * has been repaired by sorting the list.
327 *
328 * DESCRIPTION: Check if the package list is valid and sorted correctly by the
329 * sort_index. If not, then sort the list.
330 *
331 *****************************************************************************/
332
333static acpi_status
334acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
335 union acpi_operand_object *return_object,
336 u32 expected_count,
337 u32 sort_index,
338 u8 sort_direction, char *sort_key_name)
339{
340 u32 outer_element_count;
341 union acpi_operand_object **outer_elements;
342 union acpi_operand_object **elements;
343 union acpi_operand_object *obj_desc;
344 u32 i;
345 u32 previous_value;
346 acpi_status status;
347
348 /* The top-level object must be a package */
349
350 if (return_object->common.type != ACPI_TYPE_PACKAGE) {
351 return (AE_AML_OPERAND_TYPE);
352 }
353
354 /*
355 * Detect any NULL package elements and remove them from the
356 * package.
357 *
358 * TBD: We may want to do this for all predefined names that
359 * return a variable-length package of packages.
360 */
361 status = acpi_ns_remove_null_elements(return_object);
362 if (status == AE_NULL_ENTRY) {
363 ACPI_INFO_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
364 "NULL elements removed from package"));
365
366 /* Exit if package is now zero length */
367
368 if (!return_object->package.count) {
369 return (AE_NULL_ENTRY);
370 }
371 }
372
373 outer_elements = return_object->package.elements;
374 outer_element_count = return_object->package.count;
375 if (!outer_element_count) {
376 return (AE_AML_PACKAGE_LIMIT);
377 }
378
379 previous_value = 0;
380 if (sort_direction == ACPI_SORT_DESCENDING) {
381 previous_value = ACPI_UINT32_MAX;
382 }
383
384 /* Examine each subpackage */
385
386 for (i = 0; i < outer_element_count; i++) {
387
388 /* Each element of the top-level package must also be a package */
389
390 if ((*outer_elements)->common.type != ACPI_TYPE_PACKAGE) {
391 return (AE_AML_OPERAND_TYPE);
392 }
393
394 /* Each sub-package must have the minimum length */
395
396 if ((*outer_elements)->package.count < expected_count) {
397 return (AE_AML_PACKAGE_LIMIT);
398 }
399
400 elements = (*outer_elements)->package.elements;
401 obj_desc = elements[sort_index];
402
403 if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
404 return (AE_AML_OPERAND_TYPE);
405 }
406
407 /*
408 * The list must be sorted in the specified order. If we detect a
409 * discrepancy, issue a warning and sort the entire list
410 */
411 if (((sort_direction == ACPI_SORT_ASCENDING) &&
412 (obj_desc->integer.value < previous_value)) ||
413 ((sort_direction == ACPI_SORT_DESCENDING) &&
414 (obj_desc->integer.value > previous_value))) {
415 status =
416 acpi_ns_sort_list(return_object->package.elements,
417 outer_element_count, sort_index,
418 sort_direction);
419 if (ACPI_FAILURE(status)) {
420 return (status);
421 }
422
423 data->flags |= ACPI_OBJECT_REPAIRED;
424
425 ACPI_INFO_PREDEFINED((AE_INFO, data->pathname,
426 data->node_flags,
427 "Repaired unsorted list - now sorted by %s",
428 sort_key_name));
429 return (AE_OK);
430 }
431
432 previous_value = (u32) obj_desc->integer.value;
433 outer_elements++;
434 }
435
436 return (AE_OK);
437}
438
439/******************************************************************************
440 *
441 * FUNCTION: acpi_ns_remove_null_elements
442 *
443 * PARAMETERS: obj_desc - A Package object
444 *
445 * RETURN: Status. AE_NULL_ENTRY means that one or more elements were
446 * removed.
447 *
448 * DESCRIPTION: Remove all NULL package elements and update the package count.
449 *
450 *****************************************************************************/
451
452static acpi_status
453acpi_ns_remove_null_elements(union acpi_operand_object *obj_desc)
454{
455 union acpi_operand_object **source;
456 union acpi_operand_object **dest;
457 acpi_status status = AE_OK;
458 u32 count;
459 u32 new_count;
460 u32 i;
461
462 count = obj_desc->package.count;
463 new_count = count;
464
465 source = obj_desc->package.elements;
466 dest = source;
467
468 /* Examine all elements of the package object */
469
470 for (i = 0; i < count; i++) {
471 if (!*source) {
472 status = AE_NULL_ENTRY;
473 new_count--;
474 } else {
475 *dest = *source;
476 dest++;
477 }
478 source++;
479 }
480
481 if (status == AE_NULL_ENTRY) {
482
483 /* NULL terminate list and update the package count */
484
485 *dest = NULL;
486 obj_desc->package.count = new_count;
487 }
488
489 return (status);
490}
491
492/******************************************************************************
493 *
494 * FUNCTION: acpi_ns_sort_list
495 *
496 * PARAMETERS: Elements - Package object element list
497 * Count - Element count for above
498 * Index - Sort by which package element
499 * sort_direction - Ascending or Descending sort
500 *
501 * RETURN: Status
502 *
503 * DESCRIPTION: Sort the objects that are in a package element list.
504 *
505 * NOTE: Assumes that all NULL elements have been removed from the package.
506 *
507 *****************************************************************************/
508
509static acpi_status
510acpi_ns_sort_list(union acpi_operand_object **elements,
511 u32 count, u32 index, u8 sort_direction)
512{
513 union acpi_operand_object *obj_desc1;
514 union acpi_operand_object *obj_desc2;
515 union acpi_operand_object *temp_obj;
516 u32 i;
517 u32 j;
518
519 /* Simple bubble sort */
520
521 for (i = 1; i < count; i++) {
522 for (j = (count - 1); j >= i; j--) {
523 obj_desc1 = elements[j - 1]->package.elements[index];
524 obj_desc2 = elements[j]->package.elements[index];
525
526 if (((sort_direction == ACPI_SORT_ASCENDING) &&
527 (obj_desc1->integer.value >
528 obj_desc2->integer.value))
529 || ((sort_direction == ACPI_SORT_DESCENDING)
530 && (obj_desc1->integer.value <
531 obj_desc2->integer.value))) {
532 temp_obj = elements[j - 1];
533 elements[j - 1] = elements[j];
534 elements[j] = temp_obj;
535 }
536 }
537 }
538
539 return (AE_OK);
540}
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c
index 35539df5c75d..d7e6b52b4482 100644
--- a/drivers/acpi/acpica/nswalk.c
+++ b/drivers/acpi/acpica/nswalk.c
@@ -165,24 +165,27 @@ struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type,
165 * max_depth - Depth to which search is to reach 165 * max_depth - Depth to which search is to reach
166 * Flags - Whether to unlock the NS before invoking 166 * Flags - Whether to unlock the NS before invoking
167 * the callback routine 167 * the callback routine
168 * user_function - Called when an object of "Type" is found 168 * pre_order_visit - Called during tree pre-order visit
169 * Context - Passed to user function 169 * when an object of "Type" is found
170 * return_value - from the user_function if terminated early. 170 * post_order_visit - Called during tree post-order visit
171 * Otherwise, returns NULL. 171 * when an object of "Type" is found
172 * Context - Passed to user function(s) above
173 * return_value - from the user_function if terminated
174 * early. Otherwise, returns NULL.
172 * RETURNS: Status 175 * RETURNS: Status
173 * 176 *
174 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, 177 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
175 * starting (and ending) at the node specified by start_handle. 178 * starting (and ending) at the node specified by start_handle.
176 * The user_function is called whenever a node that matches 179 * The callback function is called whenever a node that matches
177 * the type parameter is found. If the user function returns 180 * the type parameter is found. If the callback function returns
178 * a non-zero value, the search is terminated immediately and 181 * a non-zero value, the search is terminated immediately and
179 * this value is returned to the caller. 182 * this value is returned to the caller.
180 * 183 *
181 * The point of this procedure is to provide a generic namespace 184 * The point of this procedure is to provide a generic namespace
182 * walk routine that can be called from multiple places to 185 * walk routine that can be called from multiple places to
183 * provide multiple services; the User Function can be tailored 186 * provide multiple services; the callback function(s) can be
184 * to each task, whether it is a print function, a compare 187 * tailored to each task, whether it is a print function,
185 * function, etc. 188 * a compare function, etc.
186 * 189 *
187 ******************************************************************************/ 190 ******************************************************************************/
188 191
@@ -191,7 +194,8 @@ acpi_ns_walk_namespace(acpi_object_type type,
191 acpi_handle start_node, 194 acpi_handle start_node,
192 u32 max_depth, 195 u32 max_depth,
193 u32 flags, 196 u32 flags,
194 acpi_walk_callback user_function, 197 acpi_walk_callback pre_order_visit,
198 acpi_walk_callback post_order_visit,
195 void *context, void **return_value) 199 void *context, void **return_value)
196{ 200{
197 acpi_status status; 201 acpi_status status;
@@ -200,6 +204,7 @@ acpi_ns_walk_namespace(acpi_object_type type,
200 struct acpi_namespace_node *parent_node; 204 struct acpi_namespace_node *parent_node;
201 acpi_object_type child_type; 205 acpi_object_type child_type;
202 u32 level; 206 u32 level;
207 u8 node_previously_visited = FALSE;
203 208
204 ACPI_FUNCTION_TRACE(ns_walk_namespace); 209 ACPI_FUNCTION_TRACE(ns_walk_namespace);
205 210
@@ -212,7 +217,7 @@ acpi_ns_walk_namespace(acpi_object_type type,
212 /* Null child means "get first node" */ 217 /* Null child means "get first node" */
213 218
214 parent_node = start_node; 219 parent_node = start_node;
215 child_node = NULL; 220 child_node = acpi_ns_get_next_node(parent_node, NULL);
216 child_type = ACPI_TYPE_ANY; 221 child_type = ACPI_TYPE_ANY;
217 level = 1; 222 level = 1;
218 223
@@ -221,102 +226,129 @@ acpi_ns_walk_namespace(acpi_object_type type,
221 * started. When Level is zero, the loop is done because we have 226 * started. When Level is zero, the loop is done because we have
222 * bubbled up to (and passed) the original parent handle (start_entry) 227 * bubbled up to (and passed) the original parent handle (start_entry)
223 */ 228 */
224 while (level > 0) { 229 while (level > 0 && child_node) {
230 status = AE_OK;
225 231
226 /* Get the next node in this scope. Null if not found */ 232 /* Found next child, get the type if we are not searching for ANY */
227 233
228 status = AE_OK; 234 if (type != ACPI_TYPE_ANY) {
229 child_node = acpi_ns_get_next_node(parent_node, child_node); 235 child_type = child_node->type;
230 if (child_node) { 236 }
231 237
232 /* Found next child, get the type if we are not searching for ANY */ 238 /*
239 * Ignore all temporary namespace nodes (created during control
240 * method execution) unless told otherwise. These temporary nodes
241 * can cause a race condition because they can be deleted during
242 * the execution of the user function (if the namespace is
243 * unlocked before invocation of the user function.) Only the
244 * debugger namespace dump will examine the temporary nodes.
245 */
246 if ((child_node->flags & ANOBJ_TEMPORARY) &&
247 !(flags & ACPI_NS_WALK_TEMP_NODES)) {
248 status = AE_CTRL_DEPTH;
249 }
233 250
234 if (type != ACPI_TYPE_ANY) { 251 /* Type must match requested type */
235 child_type = child_node->type;
236 }
237 252
253 else if (child_type == type) {
238 /* 254 /*
239 * Ignore all temporary namespace nodes (created during control 255 * Found a matching node, invoke the user callback function.
240 * method execution) unless told otherwise. These temporary nodes 256 * Unlock the namespace if flag is set.
241 * can cause a race condition because they can be deleted during
242 * the execution of the user function (if the namespace is
243 * unlocked before invocation of the user function.) Only the
244 * debugger namespace dump will examine the temporary nodes.
245 */ 257 */
246 if ((child_node->flags & ANOBJ_TEMPORARY) && 258 if (flags & ACPI_NS_WALK_UNLOCK) {
247 !(flags & ACPI_NS_WALK_TEMP_NODES)) { 259 mutex_status =
248 status = AE_CTRL_DEPTH; 260 acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
261 if (ACPI_FAILURE(mutex_status)) {
262 return_ACPI_STATUS(mutex_status);
263 }
249 } 264 }
250 265
251 /* Type must match requested type */ 266 /*
252 267 * Invoke the user function, either pre-order or post-order
253 else if (child_type == type) { 268 * or both.
254 /* 269 */
255 * Found a matching node, invoke the user callback function. 270 if (!node_previously_visited) {
256 * Unlock the namespace if flag is set. 271 if (pre_order_visit) {
257 */ 272 status =
258 if (flags & ACPI_NS_WALK_UNLOCK) { 273 pre_order_visit(child_node, level,
259 mutex_status = 274 context,
260 acpi_ut_release_mutex 275 return_value);
261 (ACPI_MTX_NAMESPACE);
262 if (ACPI_FAILURE(mutex_status)) {
263 return_ACPI_STATUS
264 (mutex_status);
265 }
266 } 276 }
277 } else {
278 if (post_order_visit) {
279 status =
280 post_order_visit(child_node, level,
281 context,
282 return_value);
283 }
284 }
267 285
268 status = 286 if (flags & ACPI_NS_WALK_UNLOCK) {
269 user_function(child_node, level, context, 287 mutex_status =
270 return_value); 288 acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
271 289 if (ACPI_FAILURE(mutex_status)) {
272 if (flags & ACPI_NS_WALK_UNLOCK) { 290 return_ACPI_STATUS(mutex_status);
273 mutex_status =
274 acpi_ut_acquire_mutex
275 (ACPI_MTX_NAMESPACE);
276 if (ACPI_FAILURE(mutex_status)) {
277 return_ACPI_STATUS
278 (mutex_status);
279 }
280 } 291 }
292 }
281 293
282 switch (status) { 294 switch (status) {
283 case AE_OK: 295 case AE_OK:
284 case AE_CTRL_DEPTH: 296 case AE_CTRL_DEPTH:
285 297
286 /* Just keep going */ 298 /* Just keep going */
287 break; 299 break;
288 300
289 case AE_CTRL_TERMINATE: 301 case AE_CTRL_TERMINATE:
290 302
291 /* Exit now, with OK status */ 303 /* Exit now, with OK status */
292 304
293 return_ACPI_STATUS(AE_OK); 305 return_ACPI_STATUS(AE_OK);
294 306
295 default: 307 default:
296 308
297 /* All others are valid exceptions */ 309 /* All others are valid exceptions */
298 310
299 return_ACPI_STATUS(status); 311 return_ACPI_STATUS(status);
300 } 312 }
313 }
314
315 /*
316 * Depth first search: Attempt to go down another level in the
317 * namespace if we are allowed to. Don't go any further if we have
318 * reached the caller specified maximum depth or if the user
319 * function has specified that the maximum depth has been reached.
320 */
321 if (!node_previously_visited &&
322 (level < max_depth) && (status != AE_CTRL_DEPTH)) {
323 if (child_node->child) {
324
325 /* There is at least one child of this node, visit it */
326
327 level++;
328 parent_node = child_node;
329 child_node =
330 acpi_ns_get_next_node(parent_node, NULL);
331 continue;
301 } 332 }
333 }
302 334
303 /* 335 /* No more children, re-visit this node */
304 * Depth first search: Attempt to go down another level in the
305 * namespace if we are allowed to. Don't go any further if we have
306 * reached the caller specified maximum depth or if the user
307 * function has specified that the maximum depth has been reached.
308 */
309 if ((level < max_depth) && (status != AE_CTRL_DEPTH)) {
310 if (child_node->child) {
311 336
312 /* There is at least one child of this node, visit it */ 337 if (!node_previously_visited) {
338 node_previously_visited = TRUE;
339 continue;
340 }
313 341
314 level++; 342 /* No more children, visit peers */
315 parent_node = child_node; 343
316 child_node = NULL; 344 child_node = acpi_ns_get_next_node(parent_node, child_node);
317 } 345 if (child_node) {
318 } 346 node_previously_visited = FALSE;
319 } else { 347 }
348
349 /* No peers, re-visit parent */
350
351 else {
320 /* 352 /*
321 * No more children of this node (acpi_ns_get_next_node failed), go 353 * No more children of this node (acpi_ns_get_next_node failed), go
322 * back upwards in the namespace tree to the node's parent. 354 * back upwards in the namespace tree to the node's parent.
@@ -324,6 +356,8 @@ acpi_ns_walk_namespace(acpi_object_type type,
324 level--; 356 level--;
325 child_node = parent_node; 357 child_node = parent_node;
326 parent_node = acpi_ns_get_parent_node(parent_node); 358 parent_node = acpi_ns_get_parent_node(parent_node);
359
360 node_previously_visited = TRUE;
327 } 361 }
328 } 362 }
329 363
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index 4929dbdbc8f0..f2bd1da77001 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -433,8 +433,11 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
433 * PARAMETERS: Type - acpi_object_type to search for 433 * PARAMETERS: Type - acpi_object_type to search for
434 * start_object - Handle in namespace where search begins 434 * start_object - Handle in namespace where search begins
435 * max_depth - Depth to which search is to reach 435 * max_depth - Depth to which search is to reach
436 * user_function - Called when an object of "Type" is found 436 * pre_order_visit - Called during tree pre-order visit
437 * Context - Passed to user function 437 * when an object of "Type" is found
438 * post_order_visit - Called during tree post-order visit
439 * when an object of "Type" is found
440 * Context - Passed to user function(s) above
438 * return_value - Location where return value of 441 * return_value - Location where return value of
439 * user_function is put if terminated early 442 * user_function is put if terminated early
440 * 443 *
@@ -443,16 +446,16 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
443 * 446 *
444 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, 447 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
445 * starting (and ending) at the object specified by start_handle. 448 * starting (and ending) at the object specified by start_handle.
446 * The user_function is called whenever an object that matches 449 * The callback function is called whenever an object that matches
447 * the type parameter is found. If the user function returns 450 * the type parameter is found. If the callback function returns
448 * a non-zero value, the search is terminated immediately and this 451 * a non-zero value, the search is terminated immediately and this
449 * value is returned to the caller. 452 * value is returned to the caller.
450 * 453 *
451 * The point of this procedure is to provide a generic namespace 454 * The point of this procedure is to provide a generic namespace
452 * walk routine that can be called from multiple places to 455 * walk routine that can be called from multiple places to
453 * provide multiple services; the User Function can be tailored 456 * provide multiple services; the callback function(s) can be
454 * to each task, whether it is a print function, a compare 457 * tailored to each task, whether it is a print function,
455 * function, etc. 458 * a compare function, etc.
456 * 459 *
457 ******************************************************************************/ 460 ******************************************************************************/
458 461
@@ -460,7 +463,8 @@ acpi_status
460acpi_walk_namespace(acpi_object_type type, 463acpi_walk_namespace(acpi_object_type type,
461 acpi_handle start_object, 464 acpi_handle start_object,
462 u32 max_depth, 465 u32 max_depth,
463 acpi_walk_callback user_function, 466 acpi_walk_callback pre_order_visit,
467 acpi_walk_callback post_order_visit,
464 void *context, void **return_value) 468 void *context, void **return_value)
465{ 469{
466 acpi_status status; 470 acpi_status status;
@@ -469,7 +473,8 @@ acpi_walk_namespace(acpi_object_type type,
469 473
470 /* Parameter validation */ 474 /* Parameter validation */
471 475
472 if ((type > ACPI_TYPE_LOCAL_MAX) || (!max_depth) || (!user_function)) { 476 if ((type > ACPI_TYPE_LOCAL_MAX) ||
477 (!max_depth) || (!pre_order_visit && !post_order_visit)) {
473 return_ACPI_STATUS(AE_BAD_PARAMETER); 478 return_ACPI_STATUS(AE_BAD_PARAMETER);
474 } 479 }
475 480
@@ -501,8 +506,9 @@ acpi_walk_namespace(acpi_object_type type,
501 } 506 }
502 507
503 status = acpi_ns_walk_namespace(type, start_object, max_depth, 508 status = acpi_ns_walk_namespace(type, start_object, max_depth,
504 ACPI_NS_WALK_UNLOCK, user_function, 509 ACPI_NS_WALK_UNLOCK, pre_order_visit,
505 context, return_value); 510 post_order_visit, context,
511 return_value);
506 512
507 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 513 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
508 514
@@ -681,8 +687,8 @@ acpi_get_devices(const char *HID,
681 687
682 status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 688 status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
683 ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, 689 ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
684 acpi_ns_get_device_callback, &info, 690 acpi_ns_get_device_callback, NULL,
685 return_value); 691 &info, return_value);
686 692
687 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 693 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
688 return_ACPI_STATUS(status); 694 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c
index cd7995b3aed4..0988e4a8901d 100644
--- a/drivers/acpi/acpica/psloop.c
+++ b/drivers/acpi/acpica/psloop.c
@@ -87,7 +87,8 @@ acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
87 union acpi_parse_object *op, acpi_status status); 87 union acpi_parse_object *op, acpi_status status);
88 88
89static void 89static void
90acpi_ps_link_module_code(u8 *aml_start, u32 aml_length, acpi_owner_id owner_id); 90acpi_ps_link_module_code(union acpi_parse_object *parent_op,
91 u8 *aml_start, u32 aml_length, acpi_owner_id owner_id);
91 92
92/******************************************************************************* 93/*******************************************************************************
93 * 94 *
@@ -479,11 +480,14 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
479 */ 480 */
480 if (walk_state->pass_number == 481 if (walk_state->pass_number ==
481 ACPI_IMODE_LOAD_PASS1) { 482 ACPI_IMODE_LOAD_PASS1) {
482 acpi_ps_link_module_code(aml_op_start, 483 acpi_ps_link_module_code(op->common.
483 walk_state-> 484 parent,
485 aml_op_start,
486 (u32)
487 (walk_state->
484 parser_state. 488 parser_state.
485 pkg_end - 489 pkg_end -
486 aml_op_start, 490 aml_op_start),
487 walk_state-> 491 walk_state->
488 owner_id); 492 owner_id);
489 } 493 }
@@ -598,7 +602,8 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
598 * 602 *
599 * FUNCTION: acpi_ps_link_module_code 603 * FUNCTION: acpi_ps_link_module_code
600 * 604 *
601 * PARAMETERS: aml_start - Pointer to the AML 605 * PARAMETERS: parent_op - Parent parser op
606 * aml_start - Pointer to the AML
602 * aml_length - Length of executable AML 607 * aml_length - Length of executable AML
603 * owner_id - owner_id of module level code 608 * owner_id - owner_id of module level code
604 * 609 *
@@ -611,11 +616,13 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
611 ******************************************************************************/ 616 ******************************************************************************/
612 617
613static void 618static void
614acpi_ps_link_module_code(u8 *aml_start, u32 aml_length, acpi_owner_id owner_id) 619acpi_ps_link_module_code(union acpi_parse_object *parent_op,
620 u8 *aml_start, u32 aml_length, acpi_owner_id owner_id)
615{ 621{
616 union acpi_operand_object *prev; 622 union acpi_operand_object *prev;
617 union acpi_operand_object *next; 623 union acpi_operand_object *next;
618 union acpi_operand_object *method_obj; 624 union acpi_operand_object *method_obj;
625 struct acpi_namespace_node *parent_node;
619 626
620 /* Get the tail of the list */ 627 /* Get the tail of the list */
621 628
@@ -639,11 +646,24 @@ acpi_ps_link_module_code(u8 *aml_start, u32 aml_length, acpi_owner_id owner_id)
639 return; 646 return;
640 } 647 }
641 648
649 if (parent_op->common.node) {
650 parent_node = parent_op->common.node;
651 } else {
652 parent_node = acpi_gbl_root_node;
653 }
654
642 method_obj->method.aml_start = aml_start; 655 method_obj->method.aml_start = aml_start;
643 method_obj->method.aml_length = aml_length; 656 method_obj->method.aml_length = aml_length;
644 method_obj->method.owner_id = owner_id; 657 method_obj->method.owner_id = owner_id;
645 method_obj->method.flags |= AOPOBJ_MODULE_LEVEL; 658 method_obj->method.flags |= AOPOBJ_MODULE_LEVEL;
646 659
660 /*
661 * Save the parent node in next_object. This is cheating, but we
662 * don't want to expand the method object.
663 */
664 method_obj->method.next_object =
665 ACPI_CAST_PTR(union acpi_operand_object, parent_node);
666
647 if (!prev) { 667 if (!prev) {
648 acpi_gbl_module_code_list = method_obj; 668 acpi_gbl_module_code_list = method_obj;
649 } else { 669 } else {
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c
index 70838e9b608c..4df8f139026c 100644
--- a/drivers/acpi/acpica/psparse.c
+++ b/drivers/acpi/acpica/psparse.c
@@ -610,17 +610,13 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
610 implicit_return_obj) { 610 implicit_return_obj) {
611 previous_walk_state-> 611 previous_walk_state->
612 implicit_return_obj = 612 implicit_return_obj =
613 acpi_ut_create_internal_object 613 acpi_ut_create_integer_object
614 (ACPI_TYPE_INTEGER); 614 ((u64) 0);
615 if (!previous_walk_state-> 615 if (!previous_walk_state->
616 implicit_return_obj) { 616 implicit_return_obj) {
617 return_ACPI_STATUS 617 return_ACPI_STATUS
618 (AE_NO_MEMORY); 618 (AE_NO_MEMORY);
619 } 619 }
620
621 previous_walk_state->
622 implicit_return_obj->
623 integer.value = 0;
624 } 620 }
625 621
626 /* Restart the calling control method */ 622 /* Restart the calling control method */
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c
index dd9731c29a79..12934ad6da8e 100644
--- a/drivers/acpi/acpica/psxface.c
+++ b/drivers/acpi/acpica/psxface.c
@@ -306,14 +306,12 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
306 */ 306 */
307 if (acpi_gbl_enable_interpreter_slack) { 307 if (acpi_gbl_enable_interpreter_slack) {
308 walk_state->implicit_return_obj = 308 walk_state->implicit_return_obj =
309 acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 309 acpi_ut_create_integer_object((u64) 0);
310 if (!walk_state->implicit_return_obj) { 310 if (!walk_state->implicit_return_obj) {
311 status = AE_NO_MEMORY; 311 status = AE_NO_MEMORY;
312 acpi_ds_delete_walk_state(walk_state); 312 acpi_ds_delete_walk_state(walk_state);
313 goto cleanup; 313 goto cleanup;
314 } 314 }
315
316 walk_state->implicit_return_obj->integer.value = 0;
317 } 315 }
318 316
319 /* Parse the AML */ 317 /* Parse the AML */
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index 61f6315fce9f..6c6a5137b728 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -1161,3 +1161,45 @@ acpi_ut_predefined_warning(const char *module_name,
1161 ACPI_COMMON_MSG_SUFFIX; 1161 ACPI_COMMON_MSG_SUFFIX;
1162 va_end(args); 1162 va_end(args);
1163} 1163}
1164
1165/*******************************************************************************
1166 *
1167 * FUNCTION: acpi_ut_predefined_info
1168 *
1169 * PARAMETERS: module_name - Caller's module name (for error output)
1170 * line_number - Caller's line number (for error output)
1171 * Pathname - Full pathname to the node
1172 * node_flags - From Namespace node for the method/object
1173 * Format - Printf format string + additional args
1174 *
1175 * RETURN: None
1176 *
1177 * DESCRIPTION: Info messages for the predefined validation module. Messages
1178 * are only emitted the first time a problem with a particular
1179 * method/object is detected. This prevents a flood of
1180 * messages for methods that are repeatedly evaluated.
1181 *
1182 ******************************************************************************/
1183
1184void ACPI_INTERNAL_VAR_XFACE
1185acpi_ut_predefined_info(const char *module_name,
1186 u32 line_number,
1187 char *pathname, u8 node_flags, const char *format, ...)
1188{
1189 va_list args;
1190
1191 /*
1192 * Warning messages for this method/object will be disabled after the
1193 * first time a validation fails or an object is successfully repaired.
1194 */
1195 if (node_flags & ANOBJ_EVALUATED) {
1196 return;
1197 }
1198
1199 acpi_os_printf("ACPI Info for %s: ", pathname);
1200
1201 va_start(args, format);
1202 acpi_os_vprintf(format, args);
1203 ACPI_COMMON_MSG_SUFFIX;
1204 va_end(args);
1205}
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
index 0207b625274a..42e658b543f1 100644
--- a/drivers/acpi/acpica/utobject.c
+++ b/drivers/acpi/acpica/utobject.c
@@ -190,6 +190,35 @@ union acpi_operand_object *acpi_ut_create_package_object(u32 count)
190 190
191/******************************************************************************* 191/*******************************************************************************
192 * 192 *
193 * FUNCTION: acpi_ut_create_integer_object
194 *
195 * PARAMETERS: initial_value - Initial value for the integer
196 *
197 * RETURN: Pointer to a new Integer object, null on failure
198 *
199 * DESCRIPTION: Create an initialized integer object
200 *
201 ******************************************************************************/
202
203union acpi_operand_object *acpi_ut_create_integer_object(u64 initial_value)
204{
205 union acpi_operand_object *integer_desc;
206
207 ACPI_FUNCTION_TRACE(ut_create_integer_object);
208
209 /* Create and initialize a new integer object */
210
211 integer_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
212 if (!integer_desc) {
213 return_PTR(NULL);
214 }
215
216 integer_desc->integer.value = initial_value;
217 return_PTR(integer_desc);
218}
219
220/*******************************************************************************
221 *
193 * FUNCTION: acpi_ut_create_buffer_object 222 * FUNCTION: acpi_ut_create_buffer_object
194 * 223 *
195 * PARAMETERS: buffer_size - Size of buffer to be created 224 * PARAMETERS: buffer_size - Size of buffer to be created
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index 642bb305cb65..5faf6c21257d 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -258,7 +258,7 @@ static int __init acpi_container_init(void)
258 acpi_walk_namespace(ACPI_TYPE_DEVICE, 258 acpi_walk_namespace(ACPI_TYPE_DEVICE,
259 ACPI_ROOT_OBJECT, 259 ACPI_ROOT_OBJECT,
260 ACPI_UINT32_MAX, 260 ACPI_UINT32_MAX,
261 container_walk_namespace_cb, &action, NULL); 261 container_walk_namespace_cb, NULL, &action, NULL);
262 262
263 return (0); 263 return (0);
264} 264}
@@ -271,7 +271,7 @@ static void __exit acpi_container_exit(void)
271 acpi_walk_namespace(ACPI_TYPE_DEVICE, 271 acpi_walk_namespace(ACPI_TYPE_DEVICE,
272 ACPI_ROOT_OBJECT, 272 ACPI_ROOT_OBJECT,
273 ACPI_UINT32_MAX, 273 ACPI_UINT32_MAX,
274 container_walk_namespace_cb, &action, NULL); 274 container_walk_namespace_cb, NULL, &action, NULL);
275 275
276 acpi_bus_unregister_driver(&acpi_container_driver); 276 acpi_bus_unregister_driver(&acpi_container_driver);
277 277
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 7338b6a3e049..30be3c148f7e 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -1030,8 +1030,8 @@ static int dock_add(acpi_handle handle)
1030 1030
1031 /* Find dependent devices */ 1031 /* Find dependent devices */
1032 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 1032 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
1033 ACPI_UINT32_MAX, find_dock_devices, dock_station, 1033 ACPI_UINT32_MAX, find_dock_devices, NULL,
1034 NULL); 1034 dock_station, NULL);
1035 1035
1036 /* add the dock station as a device dependent on itself */ 1036 /* add the dock station as a device dependent on itself */
1037 dd = alloc_dock_dependent_device(handle); 1037 dd = alloc_dock_dependent_device(handle);
@@ -1127,11 +1127,11 @@ static int __init dock_init(void)
1127 1127
1128 /* look for a dock station */ 1128 /* look for a dock station */
1129 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 1129 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
1130 ACPI_UINT32_MAX, find_dock, NULL, NULL); 1130 ACPI_UINT32_MAX, find_dock, NULL, NULL, NULL);
1131 1131
1132 /* look for bay */ 1132 /* look for bay */
1133 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 1133 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
1134 ACPI_UINT32_MAX, find_bay, NULL, NULL); 1134 ACPI_UINT32_MAX, find_bay, NULL, NULL, NULL);
1135 if (!dock_station_count) { 1135 if (!dock_station_count) {
1136 printk(KERN_INFO PREFIX "No dock devices found.\n"); 1136 printk(KERN_INFO PREFIX "No dock devices found.\n");
1137 return 0; 1137 return 0;
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index baef28c1e630..75b147f5c8fd 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -820,7 +820,7 @@ static int acpi_ec_add(struct acpi_device *device)
820 820
821 /* Find and register all query methods */ 821 /* Find and register all query methods */
822 acpi_walk_namespace(ACPI_TYPE_METHOD, ec->handle, 1, 822 acpi_walk_namespace(ACPI_TYPE_METHOD, ec->handle, 1,
823 acpi_ec_register_query_methods, ec, NULL); 823 acpi_ec_register_query_methods, NULL, ec, NULL);
824 824
825 if (!first_ec) 825 if (!first_ec)
826 first_ec = ec; 826 first_ec = ec;
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index c6645f26224b..4c8fcff662cf 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -113,7 +113,7 @@ acpi_handle acpi_get_child(acpi_handle parent, acpi_integer address)
113 if (!parent) 113 if (!parent)
114 return NULL; 114 return NULL;
115 acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 115 acpi_walk_namespace(ACPI_TYPE_DEVICE, parent,
116 1, do_acpi_find_child, &find, NULL); 116 1, do_acpi_find_child, NULL, &find, NULL);
117 return find.handle; 117 return find.handle;
118} 118}
119 119
diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c
index 45da2bae36c8..11f219743204 100644
--- a/drivers/acpi/pci_slot.c
+++ b/drivers/acpi/pci_slot.c
@@ -219,12 +219,12 @@ walk_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv)
219 219
220 dbg("p2p bridge walk, pci_bus = %x\n", dev->subordinate->number); 220 dbg("p2p bridge walk, pci_bus = %x\n", dev->subordinate->number);
221 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, 221 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1,
222 user_function, &child_context, NULL); 222 user_function, NULL, &child_context, NULL);
223 if (ACPI_FAILURE(status)) 223 if (ACPI_FAILURE(status))
224 goto out; 224 goto out;
225 225
226 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, 226 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1,
227 walk_p2p_bridge, &child_context, NULL); 227 walk_p2p_bridge, NULL, &child_context, NULL);
228out: 228out:
229 pci_dev_put(dev); 229 pci_dev_put(dev);
230 return AE_OK; 230 return AE_OK;
@@ -277,12 +277,12 @@ walk_root_bridge(acpi_handle handle, acpi_walk_callback user_function)
277 277
278 dbg("root bridge walk, pci_bus = %x\n", pci_bus->number); 278 dbg("root bridge walk, pci_bus = %x\n", pci_bus->number);
279 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, 279 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1,
280 user_function, &context, NULL); 280 user_function, NULL, &context, NULL);
281 if (ACPI_FAILURE(status)) 281 if (ACPI_FAILURE(status))
282 return status; 282 return status;
283 283
284 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, 284 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1,
285 walk_p2p_bridge, &context, NULL); 285 walk_p2p_bridge, NULL, &context, NULL);
286 if (ACPI_FAILURE(status)) 286 if (ACPI_FAILURE(status))
287 err("%s: walk_p2p_bridge failure - %d\n", __func__, status); 287 err("%s: walk_p2p_bridge failure - %d\n", __func__, status);
288 288
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index ec742a4e5635..cb4283f5a79d 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -1102,7 +1102,7 @@ void acpi_processor_install_hotplug_notify(void)
1102 acpi_walk_namespace(ACPI_TYPE_PROCESSOR, 1102 acpi_walk_namespace(ACPI_TYPE_PROCESSOR,
1103 ACPI_ROOT_OBJECT, 1103 ACPI_ROOT_OBJECT,
1104 ACPI_UINT32_MAX, 1104 ACPI_UINT32_MAX,
1105 processor_walk_namespace_cb, &action, NULL); 1105 processor_walk_namespace_cb, NULL, &action, NULL);
1106#endif 1106#endif
1107 register_hotcpu_notifier(&acpi_cpu_notifier); 1107 register_hotcpu_notifier(&acpi_cpu_notifier);
1108} 1108}
@@ -1115,7 +1115,7 @@ void acpi_processor_uninstall_hotplug_notify(void)
1115 acpi_walk_namespace(ACPI_TYPE_PROCESSOR, 1115 acpi_walk_namespace(ACPI_TYPE_PROCESSOR,
1116 ACPI_ROOT_OBJECT, 1116 ACPI_ROOT_OBJECT,
1117 ACPI_UINT32_MAX, 1117 ACPI_UINT32_MAX,
1118 processor_walk_namespace_cb, &action, NULL); 1118 processor_walk_namespace_cb, NULL, &action, NULL);
1119#endif 1119#endif
1120 unregister_hotcpu_notifier(&acpi_cpu_notifier); 1120 unregister_hotcpu_notifier(&acpi_cpu_notifier);
1121} 1121}
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 14a7481c97d7..ff9f6226085d 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1332,7 +1332,7 @@ static int acpi_bus_scan(acpi_handle handle, struct acpi_bus_ops *ops,
1332 status = acpi_bus_check_add(handle, 0, ops, &device); 1332 status = acpi_bus_check_add(handle, 0, ops, &device);
1333 if (ACPI_SUCCESS(status)) 1333 if (ACPI_SUCCESS(status))
1334 acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, 1334 acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
1335 acpi_bus_check_add, ops, &device); 1335 acpi_bus_check_add, NULL, ops, &device);
1336 1336
1337 if (child) 1337 if (child)
1338 *child = device; 1338 *child = device;
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index 27c77729c7ca..fc2f26b9b407 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -101,7 +101,7 @@ long acpi_is_video_device(struct acpi_device *device)
101 /* Only check for backlight functionality if one of the above hit. */ 101 /* Only check for backlight functionality if one of the above hit. */
102 if (video_caps) 102 if (video_caps)
103 acpi_walk_namespace(ACPI_TYPE_DEVICE, device->handle, 103 acpi_walk_namespace(ACPI_TYPE_DEVICE, device->handle,
104 ACPI_UINT32_MAX, acpi_backlight_cap_match, 104 ACPI_UINT32_MAX, acpi_backlight_cap_match, NULL,
105 &video_caps, NULL); 105 &video_caps, NULL);
106 106
107 return video_caps; 107 return video_caps;
@@ -151,7 +151,7 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle)
151 if (!graphics_handle) { 151 if (!graphics_handle) {
152 /* Only do the global walk through all graphics devices once */ 152 /* Only do the global walk through all graphics devices once */
153 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 153 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
154 ACPI_UINT32_MAX, find_video, 154 ACPI_UINT32_MAX, find_video, NULL,
155 &caps, NULL); 155 &caps, NULL);
156 /* There might be boot param flags set already... */ 156 /* There might be boot param flags set already... */
157 acpi_video_support |= caps; 157 acpi_video_support |= caps;
@@ -173,7 +173,7 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle)
173 return 0; 173 return 0;
174 } 174 }
175 acpi_walk_namespace(ACPI_TYPE_DEVICE, graphics_handle, 175 acpi_walk_namespace(ACPI_TYPE_DEVICE, graphics_handle,
176 ACPI_UINT32_MAX, find_video, 176 ACPI_UINT32_MAX, find_video, NULL,
177 &caps, NULL); 177 &caps, NULL);
178 } 178 }
179 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "We have 0x%lX video support %s %s\n", 179 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "We have 0x%lX video support %s %s\n",
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 05598ae10c4b..eb365021bb5a 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -899,7 +899,7 @@ static int intel_lid_present(void)
899 899
900 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 900 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
901 ACPI_UINT32_MAX, 901 ACPI_UINT32_MAX,
902 check_lid_device, &lid_present, NULL); 902 check_lid_device, NULL, &lid_present, NULL);
903 903
904 return lid_present; 904 return lid_present;
905} 905}
diff --git a/drivers/i2c/busses/i2c-scmi.c b/drivers/i2c/busses/i2c-scmi.c
index b4a55d407bf5..365e0becaf12 100644
--- a/drivers/i2c/busses/i2c-scmi.c
+++ b/drivers/i2c/busses/i2c-scmi.c
@@ -363,7 +363,7 @@ static int acpi_smbus_cmi_add(struct acpi_device *device)
363 smbus_cmi->cap_write = 0; 363 smbus_cmi->cap_write = 0;
364 364
365 acpi_walk_namespace(ACPI_TYPE_METHOD, smbus_cmi->handle, 1, 365 acpi_walk_namespace(ACPI_TYPE_METHOD, smbus_cmi->handle, 1,
366 acpi_smbus_cmi_query_methods, smbus_cmi, NULL); 366 acpi_smbus_cmi_query_methods, NULL, smbus_cmi, NULL);
367 367
368 if (smbus_cmi->cap_info == 0) 368 if (smbus_cmi->cap_info == 0)
369 goto err; 369 goto err;
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c
index a73028ec52e5..0f32571b94df 100644
--- a/drivers/pci/hotplug/acpi_pcihp.c
+++ b/drivers/pci/hotplug/acpi_pcihp.c
@@ -471,7 +471,7 @@ int acpi_pci_detect_ejectable(acpi_handle handle)
471 return found; 471 return found;
472 472
473 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, 473 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1,
474 check_hotplug, (void *)&found, NULL); 474 check_hotplug, NULL, (void *)&found, NULL);
475 return found; 475 return found;
476} 476}
477EXPORT_SYMBOL_GPL(acpi_pci_detect_ejectable); 477EXPORT_SYMBOL_GPL(acpi_pci_detect_ejectable);
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 58d25a163a8b..df1b0ea089d1 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -266,7 +266,7 @@ static int detect_ejectable_slots(acpi_handle handle)
266 int found = acpi_pci_detect_ejectable(handle); 266 int found = acpi_pci_detect_ejectable(handle);
267 if (!found) { 267 if (!found) {
268 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, 268 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1,
269 is_pci_dock_device, (void *)&found, NULL); 269 is_pci_dock_device, NULL, (void *)&found, NULL);
270 } 270 }
271 return found; 271 return found;
272} 272}
@@ -281,7 +281,7 @@ static void init_bridge_misc(struct acpiphp_bridge *bridge)
281 281
282 /* register all slot objects under this bridge */ 282 /* register all slot objects under this bridge */
283 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, bridge->handle, (u32)1, 283 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, bridge->handle, (u32)1,
284 register_slot, bridge, NULL); 284 register_slot, NULL, bridge, NULL);
285 if (ACPI_FAILURE(status)) { 285 if (ACPI_FAILURE(status)) {
286 list_del(&bridge->list); 286 list_del(&bridge->list);
287 return; 287 return;
@@ -447,7 +447,7 @@ find_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv)
447 447
448 /* search P2P bridges under this p2p bridge */ 448 /* search P2P bridges under this p2p bridge */
449 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, 449 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1,
450 find_p2p_bridge, NULL, NULL); 450 find_p2p_bridge, NULL, NULL, NULL);
451 if (ACPI_FAILURE(status)) 451 if (ACPI_FAILURE(status))
452 warn("find_p2p_bridge failed (error code = 0x%x)\n", status); 452 warn("find_p2p_bridge failed (error code = 0x%x)\n", status);
453 453
@@ -485,7 +485,7 @@ static int add_bridge(acpi_handle handle)
485 485
486 /* search P2P bridges under this host bridge */ 486 /* search P2P bridges under this host bridge */
487 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, 487 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1,
488 find_p2p_bridge, NULL, NULL); 488 find_p2p_bridge, NULL, NULL, NULL);
489 489
490 if (ACPI_FAILURE(status)) 490 if (ACPI_FAILURE(status))
491 warn("find_p2p_bridge failed (error code = 0x%x)\n", status); 491 warn("find_p2p_bridge failed (error code = 0x%x)\n", status);
@@ -573,7 +573,7 @@ cleanup_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv)
573 /* cleanup p2p bridges under this P2P bridge 573 /* cleanup p2p bridges under this P2P bridge
574 in a depth-first manner */ 574 in a depth-first manner */
575 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, 575 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1,
576 cleanup_p2p_bridge, NULL, NULL); 576 cleanup_p2p_bridge, NULL, NULL, NULL);
577 577
578 bridge = acpiphp_handle_to_bridge(handle); 578 bridge = acpiphp_handle_to_bridge(handle);
579 if (bridge) 579 if (bridge)
@@ -589,7 +589,7 @@ static void remove_bridge(acpi_handle handle)
589 /* cleanup p2p bridges under this host bridge 589 /* cleanup p2p bridges under this host bridge
590 in a depth-first manner */ 590 in a depth-first manner */
591 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 591 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle,
592 (u32)1, cleanup_p2p_bridge, NULL, NULL); 592 (u32)1, cleanup_p2p_bridge, NULL, NULL, NULL);
593 593
594 /* 594 /*
595 * On root bridges with hotplug slots directly underneath (ie, 595 * On root bridges with hotplug slots directly underneath (ie,
@@ -778,7 +778,7 @@ static int acpiphp_configure_ioapics(acpi_handle handle)
778{ 778{
779 ioapic_add(handle, 0, NULL, NULL); 779 ioapic_add(handle, 0, NULL, NULL);
780 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 780 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle,
781 ACPI_UINT32_MAX, ioapic_add, NULL, NULL); 781 ACPI_UINT32_MAX, ioapic_add, NULL, NULL, NULL);
782 return 0; 782 return 0;
783} 783}
784 784
@@ -786,7 +786,7 @@ static int acpiphp_unconfigure_ioapics(acpi_handle handle)
786{ 786{
787 ioapic_remove(handle, 0, NULL, NULL); 787 ioapic_remove(handle, 0, NULL, NULL);
788 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 788 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle,
789 ACPI_UINT32_MAX, ioapic_remove, NULL, NULL); 789 ACPI_UINT32_MAX, ioapic_remove, NULL, NULL, NULL);
790 return 0; 790 return 0;
791} 791}
792 792
@@ -1367,7 +1367,7 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont
1367 bridge = acpiphp_handle_to_bridge(handle); 1367 bridge = acpiphp_handle_to_bridge(handle);
1368 if (type == ACPI_NOTIFY_BUS_CHECK) { 1368 if (type == ACPI_NOTIFY_BUS_CHECK) {
1369 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, ACPI_UINT32_MAX, 1369 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, ACPI_UINT32_MAX,
1370 count_sub_bridges, &num_sub_bridges, NULL); 1370 count_sub_bridges, NULL, &num_sub_bridges, NULL);
1371 } 1371 }
1372 1372
1373 if (!bridge && !num_sub_bridges) { 1373 if (!bridge && !num_sub_bridges) {
@@ -1388,7 +1388,7 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont
1388 } 1388 }
1389 if (num_sub_bridges) 1389 if (num_sub_bridges)
1390 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1390 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle,
1391 ACPI_UINT32_MAX, check_sub_bridges, NULL, NULL); 1391 ACPI_UINT32_MAX, check_sub_bridges, NULL, NULL, NULL);
1392 break; 1392 break;
1393 1393
1394 case ACPI_NOTIFY_DEVICE_CHECK: 1394 case ACPI_NOTIFY_DEVICE_CHECK:
@@ -1512,7 +1512,7 @@ int __init acpiphp_glue_init(void)
1512 int num = 0; 1512 int num = 0;
1513 1513
1514 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 1514 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
1515 ACPI_UINT32_MAX, find_root_bridges, &num, NULL); 1515 ACPI_UINT32_MAX, find_root_bridges, NULL, &num, NULL);
1516 1516
1517 if (num <= 0) 1517 if (num <= 0)
1518 return -1; 1518 return -1;
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index e7be66dbac21..aa5df485f8cf 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -434,7 +434,7 @@ static int __init ibm_acpiphp_init(void)
434 dbg("%s\n", __func__); 434 dbg("%s\n", __func__);
435 435
436 if (acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 436 if (acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
437 ACPI_UINT32_MAX, ibm_find_acpi_device, 437 ACPI_UINT32_MAX, ibm_find_acpi_device, NULL,
438 &ibm_acpi_handle, NULL) != FOUND_APCI) { 438 &ibm_acpi_handle, NULL) != FOUND_APCI) {
439 err("%s: acpi_walk_namespace failed\n", __func__); 439 err("%s: acpi_walk_namespace failed\n", __func__);
440 retval = -ENODEV; 440 retval = -ENODEV;
diff --git a/drivers/platform/x86/intel_menlow.c b/drivers/platform/x86/intel_menlow.c
index 29432a50be45..f0a90a6bf396 100644
--- a/drivers/platform/x86/intel_menlow.c
+++ b/drivers/platform/x86/intel_menlow.c
@@ -510,7 +510,7 @@ static int __init intel_menlow_module_init(void)
510 /* Looking for sensors in each ACPI thermal zone */ 510 /* Looking for sensors in each ACPI thermal zone */
511 status = acpi_walk_namespace(ACPI_TYPE_THERMAL, ACPI_ROOT_OBJECT, 511 status = acpi_walk_namespace(ACPI_TYPE_THERMAL, ACPI_ROOT_OBJECT,
512 ACPI_UINT32_MAX, 512 ACPI_UINT32_MAX,
513 intel_menlow_register_sensor, NULL, NULL); 513 intel_menlow_register_sensor, NULL, NULL, NULL);
514 if (ACPI_FAILURE(status)) 514 if (ACPI_FAILURE(status))
515 return -ENODEV; 515 return -ENODEV;
516 516
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index a2a742c8ff7e..7a2cc8a5c975 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -1203,7 +1203,7 @@ static int sony_nc_add(struct acpi_device *device)
1203 1203
1204 if (debug) { 1204 if (debug) {
1205 status = acpi_walk_namespace(ACPI_TYPE_METHOD, sony_nc_acpi_handle, 1205 status = acpi_walk_namespace(ACPI_TYPE_METHOD, sony_nc_acpi_handle,
1206 1, sony_walk_callback, NULL, NULL); 1206 1, sony_walk_callback, NULL, NULL, NULL);
1207 if (ACPI_FAILURE(status)) { 1207 if (ACPI_FAILURE(status)) {
1208 printk(KERN_WARNING DRV_PFX "unable to walk acpi resources\n"); 1208 printk(KERN_WARNING DRV_PFX "unable to walk acpi resources\n");
1209 result = -ENODEV; 1209 result = -ENODEV;
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index edb169083840..0ed84806f8ae 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -1087,7 +1087,7 @@ static int __init tpacpi_check_std_acpi_brightness_support(void)
1087 */ 1087 */
1088 1088
1089 status = acpi_walk_namespace(ACPI_TYPE_METHOD, vid_handle, 3, 1089 status = acpi_walk_namespace(ACPI_TYPE_METHOD, vid_handle, 3,
1090 tpacpi_acpi_walk_find_bcl, NULL, 1090 tpacpi_acpi_walk_find_bcl, NULL, NULL,
1091 &bcl_ptr); 1091 &bcl_ptr);
1092 1092
1093 if (ACPI_SUCCESS(status) && bcl_levels > 2) { 1093 if (ACPI_SUCCESS(status) && bcl_levels > 2) {