aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLin Ming <ming.m.lin@intel.com>2009-11-12 21:06:08 -0500
committerLen Brown <len.brown@intel.com>2009-11-24 21:31:10 -0500
commit2263576cfc6e8f6ab038126c3254404b9fcb1c33 (patch)
tree1c1bd06cc5d89978a23a19d549764d3dc8c7c6c4
parent7d5d05d0704127c9acd24090c14731c111bd0af1 (diff)
ACPICA: Add post-order callback to acpi_walk_namespace
The existing interface only has a pre-order callback. This change adds an additional parameter for a post-order callback which will be more useful for bus scans. ACPICA BZ 779. Also update the external calls to acpi_walk_namespace. http://www.acpica.org/bugzilla/show_bug.cgi?id=779 Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--arch/ia64/sn/kernel/io_acpi_init.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/longhaul.c2
-rw-r--r--drivers/acpi/acpi_memhotplug.c4
-rw-r--r--drivers/acpi/acpica/acnamesp.h3
-rw-r--r--drivers/acpi/acpica/dsinit.c2
-rw-r--r--drivers/acpi/acpica/evgpeblk.c8
-rw-r--r--drivers/acpi/acpica/evregion.c6
-rw-r--r--drivers/acpi/acpica/nsdump.c4
-rw-r--r--drivers/acpi/acpica/nsdumpdv.c3
-rw-r--r--drivers/acpi/acpica/nsinit.c8
-rw-r--r--drivers/acpi/acpica/nswalk.c200
-rw-r--r--drivers/acpi/acpica/nsxfeval.c32
-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
-rw-r--r--include/acpi/acpixf.h3
29 files changed, 197 insertions, 152 deletions
diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c
index fd50ff94302b..66f633bff059 100644
--- a/arch/ia64/sn/kernel/io_acpi_init.c
+++ b/arch/ia64/sn/kernel/io_acpi_init.c
@@ -390,7 +390,7 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info,
390 pcidev_match.handle = NULL; 390 pcidev_match.handle = NULL;
391 391
392 acpi_walk_namespace(ACPI_TYPE_DEVICE, rootbus_handle, ACPI_UINT32_MAX, 392 acpi_walk_namespace(ACPI_TYPE_DEVICE, rootbus_handle, ACPI_UINT32_MAX,
393 find_matching_device, &pcidev_match, NULL); 393 find_matching_device, NULL, &pcidev_match, NULL);
394 394
395 if (!pcidev_match.handle) { 395 if (!pcidev_match.handle) {
396 printk(KERN_ERR 396 printk(KERN_ERR
diff --git a/arch/x86/kernel/cpu/cpufreq/longhaul.c b/arch/x86/kernel/cpu/cpufreq/longhaul.c
index cabd2fa3fc93..7e7eea4f8261 100644
--- a/arch/x86/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/x86/kernel/cpu/cpufreq/longhaul.c
@@ -885,7 +885,7 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
885 885
886 /* Find ACPI data for processor */ 886 /* Find ACPI data for processor */
887 acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, 887 acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
888 ACPI_UINT32_MAX, &longhaul_walk_callback, 888 ACPI_UINT32_MAX, &longhaul_walk_callback, NULL,
889 NULL, (void *)&pr); 889 NULL, (void *)&pr);
890 890
891 /* Check ACPI support for C3 state */ 891 /* Check ACPI support for C3 state */
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/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index 09a2764c734b..168e60893a2a 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
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/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 c9fa040725d4..582b0af01e99 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -1025,8 +1025,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
1025 */ 1025 */
1026 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, 1026 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
1027 ACPI_NS_WALK_UNLOCK, 1027 ACPI_NS_WALK_UNLOCK,
1028 acpi_ev_install_handler, handler_obj, 1028 acpi_ev_install_handler, NULL,
1029 NULL); 1029 handler_obj, NULL);
1030 1030
1031 unlock_and_exit: 1031 unlock_and_exit:
1032 return_ACPI_STATUS(status); 1032 return_ACPI_STATUS(status);
@@ -1062,7 +1062,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
1062 */ 1062 */
1063 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, 1063 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
1064 ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, 1064 ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run,
1065 &space_id, NULL); 1065 NULL, &space_id, NULL);
1066 1066
1067 return_ACPI_STATUS(status); 1067 return_ACPI_STATUS(status);
1068} 1068}
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/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/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/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 575593a8b4e6..8c1b431616df 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 d93108d148fc..22cb50fe2b2c 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) {
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 0e7efeacf6cb..f9b8b28ad802 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -154,7 +154,8 @@ acpi_status
154acpi_walk_namespace(acpi_object_type type, 154acpi_walk_namespace(acpi_object_type type,
155 acpi_handle start_object, 155 acpi_handle start_object,
156 u32 max_depth, 156 u32 max_depth,
157 acpi_walk_callback user_function, 157 acpi_walk_callback pre_order_visit,
158 acpi_walk_callback post_order_visit,
158 void *context, void **return_value); 159 void *context, void **return_value);
159 160
160acpi_status 161acpi_status