aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica
diff options
context:
space:
mode:
authorAlexey Starikovskiy <astarikovskiy@suse.de>2010-05-25 23:53:07 -0400
committerLen Brown <len.brown@intel.com>2010-07-06 22:33:56 -0400
commitc45b5c097001480e66d4c523eb715ad317a4ef77 (patch)
tree5b9415840b97a724537273db99b2c66975c63347 /drivers/acpi/acpica
parent5821f75421aa7c7bafdec291223153597f649934 (diff)
ACPICA: Performance enhancement for namespace search and access
This change enhances the performance of namespace searches and walks by adding a backpointer to the parent in each namespace node. On large namespaces, this change can improve overall ACPI performance by up to 9X. Adding a pointer to each namespace node increases the overall size of the internal namespace by about 5%, since each namespace entry usually consists of both a namespace node and an ACPI operand object. Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r--drivers/acpi/acpica/aclocal.h5
-rw-r--r--drivers/acpi/acpica/acnamesp.h7
-rw-r--r--drivers/acpi/acpica/dsmthdat.c6
-rw-r--r--drivers/acpi/acpica/dsopcode.c6
-rw-r--r--drivers/acpi/acpica/evrgnini.c10
-rw-r--r--drivers/acpi/acpica/exdump.c2
-rw-r--r--drivers/acpi/acpica/nsaccess.c5
-rw-r--r--drivers/acpi/acpica/nsalloc.c74
-rw-r--r--drivers/acpi/acpica/nsinit.c4
-rw-r--r--drivers/acpi/acpica/nsnames.c4
-rw-r--r--drivers/acpi/acpica/nssearch.c15
-rw-r--r--drivers/acpi/acpica/nsutils.c113
-rw-r--r--drivers/acpi/acpica/nswalk.c15
-rw-r--r--drivers/acpi/acpica/nsxfobj.c2
-rw-r--r--drivers/acpi/acpica/utglobal.c2
15 files changed, 52 insertions, 218 deletions
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 147a7e6bd38f..eb2d420b39ec 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -184,8 +184,9 @@ struct acpi_namespace_node {
184 u8 flags; /* Miscellaneous flags */ 184 u8 flags; /* Miscellaneous flags */
185 acpi_owner_id owner_id; /* Node creator */ 185 acpi_owner_id owner_id; /* Node creator */
186 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ 186 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
187 struct acpi_namespace_node *parent; /* Parent node */
187 struct acpi_namespace_node *child; /* First child */ 188 struct acpi_namespace_node *child; /* First child */
188 struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */ 189 struct acpi_namespace_node *peer; /* First peer */
189 190
190 /* 191 /*
191 * The following fields are used by the ASL compiler and disassembler only 192 * The following fields are used by the ASL compiler and disassembler only
@@ -199,7 +200,7 @@ struct acpi_namespace_node {
199 200
200/* Namespace Node flags */ 201/* Namespace Node flags */
201 202
202#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */ 203#define ANOBJ_RESERVED 0x01 /* Available for use */
203#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */ 204#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
204#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ 205#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
205#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ 206#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index 258159cfcdfa..9f60ff002203 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -369,11 +369,4 @@ struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle);
369 369
370void acpi_ns_terminate(void); 370void acpi_ns_terminate(void);
371 371
372struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
373 *node);
374
375struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
376 acpi_namespace_node
377 *node);
378
379#endif /* __ACNAMESP_H__ */ 372#endif /* __ACNAMESP_H__ */
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c
index d5e927f818a0..8095306fcd8c 100644
--- a/drivers/acpi/acpica/dsmthdat.c
+++ b/drivers/acpi/acpica/dsmthdat.c
@@ -102,8 +102,7 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state)
102 walk_state->arguments[i].name.integer |= (i << 24); 102 walk_state->arguments[i].name.integer |= (i << 24);
103 walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED; 103 walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED;
104 walk_state->arguments[i].type = ACPI_TYPE_ANY; 104 walk_state->arguments[i].type = ACPI_TYPE_ANY;
105 walk_state->arguments[i].flags = 105 walk_state->arguments[i].flags = ANOBJ_METHOD_ARG;
106 ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
107 } 106 }
108 107
109 /* Init the method locals */ 108 /* Init the method locals */
@@ -116,8 +115,7 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state)
116 walk_state->local_variables[i].descriptor_type = 115 walk_state->local_variables[i].descriptor_type =
117 ACPI_DESC_TYPE_NAMED; 116 ACPI_DESC_TYPE_NAMED;
118 walk_state->local_variables[i].type = ACPI_TYPE_ANY; 117 walk_state->local_variables[i].type = ACPI_TYPE_ANY;
119 walk_state->local_variables[i].flags = 118 walk_state->local_variables[i].flags = ANOBJ_METHOD_LOCAL;
120 ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
121 } 119 }
122 120
123 return_VOID; 121 return_VOID;
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c
index 53a7e416f33e..7c0e74227171 100644
--- a/drivers/acpi/acpica/dsopcode.c
+++ b/drivers/acpi/acpica/dsopcode.c
@@ -213,7 +213,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc)
213 213
214 /* Execute the AML code for the term_arg arguments */ 214 /* Execute the AML code for the term_arg arguments */
215 215
216 status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), 216 status = acpi_ds_execute_arguments(node, node->parent,
217 extra_desc->extra.aml_length, 217 extra_desc->extra.aml_length,
218 extra_desc->extra.aml_start); 218 extra_desc->extra.aml_start);
219 return_ACPI_STATUS(status); 219 return_ACPI_STATUS(status);
@@ -257,7 +257,7 @@ acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc)
257 257
258 /* Execute the AML code for the term_arg arguments */ 258 /* Execute the AML code for the term_arg arguments */
259 259
260 status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), 260 status = acpi_ds_execute_arguments(node, node->parent,
261 extra_desc->extra.aml_length, 261 extra_desc->extra.aml_length,
262 extra_desc->extra.aml_start); 262 extra_desc->extra.aml_start);
263 return_ACPI_STATUS(status); 263 return_ACPI_STATUS(status);
@@ -394,7 +394,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
394 394
395 /* Execute the argument AML */ 395 /* Execute the argument AML */
396 396
397 status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), 397 status = acpi_ds_execute_arguments(node, node->parent,
398 extra_desc->extra.aml_length, 398 extra_desc->extra.aml_length,
399 extra_desc->extra.aml_start); 399 extra_desc->extra.aml_start);
400 if (ACPI_FAILURE(status)) { 400 if (ACPI_FAILURE(status)) {
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index 2e3b0334072f..f40d271bf568 100644
--- a/drivers/acpi/acpica/evrgnini.c
+++ b/drivers/acpi/acpica/evrgnini.c
@@ -199,7 +199,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
199 return_ACPI_STATUS(status); 199 return_ACPI_STATUS(status);
200 } 200 }
201 201
202 parent_node = acpi_ns_get_parent_node(region_obj->region.node); 202 parent_node = region_obj->region.node->parent;
203 203
204 /* 204 /*
205 * Get the _SEG and _BBN values from the device upon which the handler 205 * Get the _SEG and _BBN values from the device upon which the handler
@@ -248,7 +248,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
248 break; 248 break;
249 } 249 }
250 250
251 pci_root_node = acpi_ns_get_parent_node(pci_root_node); 251 pci_root_node = pci_root_node->parent;
252 } 252 }
253 253
254 /* PCI root bridge not found, use namespace root node */ 254 /* PCI root bridge not found, use namespace root node */
@@ -280,7 +280,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
280 */ 280 */
281 pci_device_node = region_obj->region.node; 281 pci_device_node = region_obj->region.node;
282 while (pci_device_node && (pci_device_node->type != ACPI_TYPE_DEVICE)) { 282 while (pci_device_node && (pci_device_node->type != ACPI_TYPE_DEVICE)) {
283 pci_device_node = acpi_ns_get_parent_node(pci_device_node); 283 pci_device_node = pci_device_node->parent;
284 } 284 }
285 285
286 if (!pci_device_node) { 286 if (!pci_device_node) {
@@ -521,7 +521,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
521 return_ACPI_STATUS(AE_NOT_EXIST); 521 return_ACPI_STATUS(AE_NOT_EXIST);
522 } 522 }
523 523
524 node = acpi_ns_get_parent_node(region_obj->region.node); 524 node = region_obj->region.node->parent;
525 space_id = region_obj->region.space_id; 525 space_id = region_obj->region.space_id;
526 526
527 /* Setup defaults */ 527 /* Setup defaults */
@@ -654,7 +654,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
654 654
655 /* This node does not have the handler we need; Pop up one level */ 655 /* This node does not have the handler we need; Pop up one level */
656 656
657 node = acpi_ns_get_parent_node(node); 657 node = node->parent;
658 } 658 }
659 659
660 /* If we get here, there is no handler for this region */ 660 /* If we get here, there is no handler for this region */
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index cdb66d1e3fde..f067bbb0d961 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -812,7 +812,7 @@ void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags)
812 acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type)); 812 acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type));
813 acpi_ex_out_pointer("Attached Object", 813 acpi_ex_out_pointer("Attached Object",
814 acpi_ns_get_attached_object(node)); 814 acpi_ns_get_attached_object(node));
815 acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node)); 815 acpi_ex_out_pointer("Parent", node->parent);
816 816
817 acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node), 817 acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node),
818 acpi_ex_dump_node); 818 acpi_ex_dump_node);
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c
index 2cebfa94b79a..0cd925be5fc1 100644
--- a/drivers/acpi/acpica/nsaccess.c
+++ b/drivers/acpi/acpica/nsaccess.c
@@ -338,8 +338,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
338 */ 338 */
339 while (!acpi_ns_opens_scope(prefix_node->type) && 339 while (!acpi_ns_opens_scope(prefix_node->type) &&
340 prefix_node->type != ACPI_TYPE_ANY) { 340 prefix_node->type != ACPI_TYPE_ANY) {
341 prefix_node = 341 prefix_node = prefix_node->parent;
342 acpi_ns_get_parent_node(prefix_node);
343 } 342 }
344 } 343 }
345 } 344 }
@@ -419,7 +418,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
419 /* Backup to the parent node */ 418 /* Backup to the parent node */
420 419
421 num_carats++; 420 num_carats++;
422 this_node = acpi_ns_get_parent_node(this_node); 421 this_node = this_node->parent;
423 if (!this_node) { 422 if (!this_node) {
424 423
425 /* Current scope has no parent scope */ 424 /* Current scope has no parent scope */
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c
index 982269c1fa48..8d3a43a061ab 100644
--- a/drivers/acpi/acpica/nsalloc.c
+++ b/drivers/acpi/acpica/nsalloc.c
@@ -159,7 +159,7 @@ void acpi_ns_remove_node(struct acpi_namespace_node *node)
159 159
160 ACPI_FUNCTION_TRACE_PTR(ns_remove_node, node); 160 ACPI_FUNCTION_TRACE_PTR(ns_remove_node, node);
161 161
162 parent_node = acpi_ns_get_parent_node(node); 162 parent_node = node->parent;
163 163
164 prev_node = NULL; 164 prev_node = NULL;
165 next_node = parent_node->child; 165 next_node = parent_node->child;
@@ -168,29 +168,20 @@ void acpi_ns_remove_node(struct acpi_namespace_node *node)
168 168
169 while (next_node != node) { 169 while (next_node != node) {
170 prev_node = next_node; 170 prev_node = next_node;
171 next_node = prev_node->peer; 171 next_node = next_node->peer;
172 } 172 }
173 173
174 if (prev_node) { 174 if (prev_node) {
175 175
176 /* Node is not first child, unlink it */ 176 /* Node is not first child, unlink it */
177 177
178 prev_node->peer = next_node->peer; 178 prev_node->peer = node->peer;
179 if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
180 prev_node->flags |= ANOBJ_END_OF_PEER_LIST;
181 }
182 } else { 179 } else {
183 /* Node is first child (has no previous peer) */ 180 /*
184 181 * Node is first child (has no previous peer).
185 if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { 182 * Link peer list to parent
186 183 */
187 /* No peers at all */ 184 parent_node->child = node->peer;
188
189 parent_node->child = NULL;
190 } else { /* Link peer list to parent */
191
192 parent_node->child = next_node->peer;
193 }
194 } 185 }
195 186
196 /* Delete the node and any attached objects */ 187 /* Delete the node and any attached objects */
@@ -238,23 +229,20 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp
238 229
239 /* Link the new entry into the parent and existing children */ 230 /* Link the new entry into the parent and existing children */
240 231
232 node->peer = NULL;
233 node->parent = parent_node;
241 child_node = parent_node->child; 234 child_node = parent_node->child;
235
242 if (!child_node) { 236 if (!child_node) {
243 parent_node->child = node; 237 parent_node->child = node;
244 node->flags |= ANOBJ_END_OF_PEER_LIST;
245 node->peer = parent_node;
246 } else { 238 } else {
247 while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) { 239 /* Add node to the end of the peer list */
240
241 while (child_node->peer) {
248 child_node = child_node->peer; 242 child_node = child_node->peer;
249 } 243 }
250 244
251 child_node->peer = node; 245 child_node->peer = node;
252
253 /* Clear end-of-list flag */
254
255 child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
256 node->flags |= ANOBJ_END_OF_PEER_LIST;
257 node->peer = parent_node;
258 } 246 }
259 247
260 /* Init the new entry */ 248 /* Init the new entry */
@@ -288,9 +276,8 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp
288 276
289void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) 277void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
290{ 278{
291 struct acpi_namespace_node *child_node;
292 struct acpi_namespace_node *next_node; 279 struct acpi_namespace_node *next_node;
293 u8 flags; 280 struct acpi_namespace_node *node_to_delete;
294 281
295 ACPI_FUNCTION_TRACE_PTR(ns_delete_children, parent_node); 282 ACPI_FUNCTION_TRACE_PTR(ns_delete_children, parent_node);
296 283
@@ -298,37 +285,26 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
298 return_VOID; 285 return_VOID;
299 } 286 }
300 287
301 /* If no children, all done! */
302
303 child_node = parent_node->child;
304 if (!child_node) {
305 return_VOID;
306 }
307
308 /* Deallocate all children at this level */ 288 /* Deallocate all children at this level */
309 289
310 do { 290 next_node = parent_node->child;
311 291 while (next_node) {
312 /* Get the things we need */
313
314 next_node = child_node->peer;
315 flags = child_node->flags;
316 292
317 /* Grandchildren should have all been deleted already */ 293 /* Grandchildren should have all been deleted already */
318 294
319 if (child_node->child) { 295 if (next_node->child) {
320 ACPI_ERROR((AE_INFO, "Found a grandchild! P=%p C=%p", 296 ACPI_ERROR((AE_INFO, "Found a grandchild! P=%p C=%p",
321 parent_node, child_node)); 297 parent_node, next_node));
322 } 298 }
323 299
324 /* 300 /*
325 * Delete this child node and move on to the next child in the list. 301 * Delete this child node and move on to the next child in the list.
326 * No need to unlink the node since we are deleting the entire branch. 302 * No need to unlink the node since we are deleting the entire branch.
327 */ 303 */
328 acpi_ns_delete_node(child_node); 304 node_to_delete = next_node;
329 child_node = next_node; 305 next_node = next_node->peer;
330 306 acpi_ns_delete_node(node_to_delete);
331 } while (!(flags & ANOBJ_END_OF_PEER_LIST)); 307 };
332 308
333 /* Clear the parent's child pointer */ 309 /* Clear the parent's child pointer */
334 310
@@ -405,7 +381,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
405 381
406 /* Move up the tree to the grandparent */ 382 /* Move up the tree to the grandparent */
407 383
408 parent_node = acpi_ns_get_parent_node(parent_node); 384 parent_node = parent_node->parent;
409 } 385 }
410 } 386 }
411 387
@@ -510,7 +486,7 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
510 486
511 /* Move up the tree to the grandparent */ 487 /* Move up the tree to the grandparent */
512 488
513 parent_node = acpi_ns_get_parent_node(parent_node); 489 parent_node = parent_node->parent;
514 } 490 }
515 } 491 }
516 492
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index f0e49df7c13b..660a2728908d 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -410,7 +410,7 @@ acpi_ns_find_ini_methods(acpi_handle obj_handle,
410 * The only _INI methods that we care about are those that are 410 * The only _INI methods that we care about are those that are
411 * present under Device, Processor, and Thermal objects. 411 * present under Device, Processor, and Thermal objects.
412 */ 412 */
413 parent_node = acpi_ns_get_parent_node(node); 413 parent_node = node->parent;
414 switch (parent_node->type) { 414 switch (parent_node->type) {
415 case ACPI_TYPE_DEVICE: 415 case ACPI_TYPE_DEVICE:
416 case ACPI_TYPE_PROCESSOR: 416 case ACPI_TYPE_PROCESSOR:
@@ -420,7 +420,7 @@ acpi_ns_find_ini_methods(acpi_handle obj_handle,
420 420
421 while (parent_node) { 421 while (parent_node) {
422 parent_node->flags |= ANOBJ_SUBTREE_HAS_INI; 422 parent_node->flags |= ANOBJ_SUBTREE_HAS_INI;
423 parent_node = acpi_ns_get_parent_node(parent_node); 423 parent_node = parent_node->parent;
424 } 424 }
425 break; 425 break;
426 426
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c
index 7dea0031605c..d3104af57e13 100644
--- a/drivers/acpi/acpica/nsnames.c
+++ b/drivers/acpi/acpica/nsnames.c
@@ -93,7 +93,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node,
93 /* Put the name into the buffer */ 93 /* Put the name into the buffer */
94 94
95 ACPI_MOVE_32_TO_32((name_buffer + index), &parent_node->name); 95 ACPI_MOVE_32_TO_32((name_buffer + index), &parent_node->name);
96 parent_node = acpi_ns_get_parent_node(parent_node); 96 parent_node = parent_node->parent;
97 97
98 /* Prefix name with the path separator */ 98 /* Prefix name with the path separator */
99 99
@@ -198,7 +198,7 @@ acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node)
198 return 0; 198 return 0;
199 } 199 }
200 size += ACPI_PATH_SEGMENT_LENGTH; 200 size += ACPI_PATH_SEGMENT_LENGTH;
201 next_node = acpi_ns_get_parent_node(next_node); 201 next_node = next_node->parent;
202 } 202 }
203 203
204 if (!size) { 204 if (!size) {
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c
index a8e42b5e9463..41102a84272f 100644
--- a/drivers/acpi/acpica/nssearch.c
+++ b/drivers/acpi/acpica/nssearch.c
@@ -152,17 +152,6 @@ acpi_ns_search_one_scope(u32 target_name,
152 return_ACPI_STATUS(AE_OK); 152 return_ACPI_STATUS(AE_OK);
153 } 153 }
154 154
155 /*
156 * The last entry in the list points back to the parent,
157 * so a flag is used to indicate the end-of-list
158 */
159 if (node->flags & ANOBJ_END_OF_PEER_LIST) {
160
161 /* Searched entire list, we are done */
162
163 break;
164 }
165
166 /* Didn't match name, move on to the next peer object */ 155 /* Didn't match name, move on to the next peer object */
167 156
168 node = node->peer; 157 node = node->peer;
@@ -217,7 +206,7 @@ acpi_ns_search_parent_tree(u32 target_name,
217 206
218 ACPI_FUNCTION_TRACE(ns_search_parent_tree); 207 ACPI_FUNCTION_TRACE(ns_search_parent_tree);
219 208
220 parent_node = acpi_ns_get_parent_node(node); 209 parent_node = node->parent;
221 210
222 /* 211 /*
223 * If there is no parent (i.e., we are at the root) or type is "local", 212 * If there is no parent (i.e., we are at the root) or type is "local",
@@ -261,7 +250,7 @@ acpi_ns_search_parent_tree(u32 target_name,
261 250
262 /* Not found here, go up another level (until we reach the root) */ 251 /* Not found here, go up another level (until we reach the root) */
263 252
264 parent_node = acpi_ns_get_parent_node(parent_node); 253 parent_node = parent_node->parent;
265 } 254 }
266 255
267 /* Not found in parent tree */ 256 /* Not found in parent tree */
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index bab559712da1..e1add3491b04 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -847,116 +847,3 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
847 ACPI_FREE(internal_path); 847 ACPI_FREE(internal_path);
848 return_ACPI_STATUS(status); 848 return_ACPI_STATUS(status);
849} 849}
850
851/*******************************************************************************
852 *
853 * FUNCTION: acpi_ns_get_parent_node
854 *
855 * PARAMETERS: Node - Current table entry
856 *
857 * RETURN: Parent entry of the given entry
858 *
859 * DESCRIPTION: Obtain the parent entry for a given entry in the namespace.
860 *
861 ******************************************************************************/
862
863struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
864 *node)
865{
866 ACPI_FUNCTION_ENTRY();
867
868 if (!node) {
869 return (NULL);
870 }
871
872 /*
873 * Walk to the end of this peer list. The last entry is marked with a flag
874 * and the peer pointer is really a pointer back to the parent. This saves
875 * putting a parent back pointer in each and every named object!
876 */
877 while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
878 node = node->peer;
879 }
880
881 return (node->peer);
882}
883
884/*******************************************************************************
885 *
886 * FUNCTION: acpi_ns_get_next_valid_node
887 *
888 * PARAMETERS: Node - Current table entry
889 *
890 * RETURN: Next valid Node in the linked node list. NULL if no more valid
891 * nodes.
892 *
893 * DESCRIPTION: Find the next valid node within a name table.
894 * Useful for implementing NULL-end-of-list loops.
895 *
896 ******************************************************************************/
897
898struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
899 acpi_namespace_node
900 *node)
901{
902
903 /* If we are at the end of this peer list, return NULL */
904
905 if (node->flags & ANOBJ_END_OF_PEER_LIST) {
906 return NULL;
907 }
908
909 /* Otherwise just return the next peer */
910
911 return (node->peer);
912}
913
914#ifdef ACPI_OBSOLETE_FUNCTIONS
915/*******************************************************************************
916 *
917 * FUNCTION: acpi_ns_find_parent_name
918 *
919 * PARAMETERS: *child_node - Named Obj whose name is to be found
920 *
921 * RETURN: The ACPI name
922 *
923 * DESCRIPTION: Search for the given obj in its parent scope and return the
924 * name segment, or "????" if the parent name can't be found
925 * (which "should not happen").
926 *
927 ******************************************************************************/
928
929acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node)
930{
931 struct acpi_namespace_node *parent_node;
932
933 ACPI_FUNCTION_TRACE(ns_find_parent_name);
934
935 if (child_node) {
936
937 /* Valid entry. Get the parent Node */
938
939 parent_node = acpi_ns_get_parent_node(child_node);
940 if (parent_node) {
941 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
942 "Parent of %p [%4.4s] is %p [%4.4s]\n",
943 child_node,
944 acpi_ut_get_node_name(child_node),
945 parent_node,
946 acpi_ut_get_node_name(parent_node)));
947
948 if (parent_node->name.integer) {
949 return_VALUE((acpi_name) parent_node->name.
950 integer);
951 }
952 }
953
954 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
955 "Unable to find parent of %p (%4.4s)\n",
956 child_node,
957 acpi_ut_get_node_name(child_node)));
958 }
959
960 return_VALUE(ACPI_UNKNOWN_NAME);
961}
962#endif
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c
index 00e79fb26029..2cd5be8fe10f 100644
--- a/drivers/acpi/acpica/nswalk.c
+++ b/drivers/acpi/acpica/nswalk.c
@@ -79,15 +79,6 @@ struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node
79 return parent_node->child; 79 return parent_node->child;
80 } 80 }
81 81
82 /*
83 * Get the next node.
84 *
85 * If we are at the end of this peer list, return NULL
86 */
87 if (child_node->flags & ANOBJ_END_OF_PEER_LIST) {
88 return NULL;
89 }
90
91 /* Otherwise just return the next peer */ 82 /* Otherwise just return the next peer */
92 83
93 return child_node->peer; 84 return child_node->peer;
@@ -146,9 +137,9 @@ struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type,
146 return (next_node); 137 return (next_node);
147 } 138 }
148 139
149 /* Otherwise, move on to the next node */ 140 /* Otherwise, move on to the next peer node */
150 141
151 next_node = acpi_ns_get_next_valid_node(next_node); 142 next_node = next_node->peer;
152 } 143 }
153 144
154 /* Not found */ 145 /* Not found */
@@ -355,7 +346,7 @@ acpi_ns_walk_namespace(acpi_object_type type,
355 */ 346 */
356 level--; 347 level--;
357 child_node = parent_node; 348 child_node = parent_node;
358 parent_node = acpi_ns_get_parent_node(parent_node); 349 parent_node = parent_node->parent;
359 350
360 node_previously_visited = TRUE; 351 node_previously_visited = TRUE;
361 } 352 }
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c
index eafef24ea448..a1f04e9b8030 100644
--- a/drivers/acpi/acpica/nsxfobj.c
+++ b/drivers/acpi/acpica/nsxfobj.c
@@ -190,7 +190,7 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
190 190
191 /* Get the parent entry */ 191 /* Get the parent entry */
192 192
193 parent_node = acpi_ns_get_parent_node(node); 193 parent_node = node->parent;
194 *ret_handle = ACPI_CAST_PTR(acpi_handle, parent_node); 194 *ret_handle = ACPI_CAST_PTR(acpi_handle, parent_node);
195 195
196 /* Return exception if parent is null */ 196 /* Return exception if parent is null */
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index 66116750a0f9..0558747579ef 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -813,10 +813,10 @@ acpi_status acpi_ut_init_globals(void)
813 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; 813 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
814 acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; 814 acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
815 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; 815 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
816 acpi_gbl_root_node_struct.parent = NULL;
816 acpi_gbl_root_node_struct.child = NULL; 817 acpi_gbl_root_node_struct.child = NULL;
817 acpi_gbl_root_node_struct.peer = NULL; 818 acpi_gbl_root_node_struct.peer = NULL;
818 acpi_gbl_root_node_struct.object = NULL; 819 acpi_gbl_root_node_struct.object = NULL;
819 acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST;
820 820
821#ifdef ACPI_DEBUG_OUTPUT 821#ifdef ACPI_DEBUG_OUTPUT
822 acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX); 822 acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX);