X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Facpi%2Fparser%2Fpswalk.c;h=a84a547a0f1b469706cff58935750ed4ec05db56;hb=refs%2Fheads%2Fvserver;hp=110d2ce917b643a92f44b0f2967d04871bd23582;hpb=f7f1b0f1e2fbadeab12d24236000e778aa9b1ead;p=linux-2.6.git diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c index 110d2ce91..a84a547a0 100644 --- a/drivers/acpi/parser/pswalk.c +++ b/drivers/acpi/parser/pswalk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,13 +41,11 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("pswalk") - +ACPI_MODULE_NAME("pswalk") /******************************************************************************* * @@ -60,29 +58,27 @@ * DESCRIPTION: Delete a portion of or an entire parse tree. * ******************************************************************************/ - -void -acpi_ps_delete_parse_tree ( - union acpi_parse_object *subtree_root) +void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) { - union acpi_parse_object *op = subtree_root; - union acpi_parse_object *next = NULL; - union acpi_parse_object *parent = NULL; - - - ACPI_FUNCTION_TRACE_PTR ("ps_delete_parse_tree", subtree_root); + union acpi_parse_object *op = subtree_root; + union acpi_parse_object *next = NULL; + union acpi_parse_object *parent = NULL; + ACPI_FUNCTION_TRACE_PTR(ps_delete_parse_tree, subtree_root); /* Visit all nodes in the subtree */ while (op) { + /* Check if we are not ascending */ if (op != parent) { + /* Look for an argument or child of the current op */ - next = acpi_ps_get_arg (op, 0); + next = acpi_ps_get_arg(op, 0); if (next) { + /* Still going downward in tree (Op is not completed yet) */ op = next; @@ -90,26 +86,24 @@ acpi_ps_delete_parse_tree ( } } - /* - * No more children, this Op is complete. - */ + /* No more children, this Op is complete. */ + next = op->common.next; parent = op->common.parent; - acpi_ps_free_op (op); + acpi_ps_free_op(op); + + /* If we are back to the starting point, the walk is complete. */ - /* - * If we are back to the starting point, the walk is complete. - */ if (op == subtree_root) { return_VOID; } if (next) { op = next; - } - else { + } else { op = parent; } } + return_VOID; }