/**ltl * 功能:获取下一个节点对象 * 参数: type ->节点类型 * parent_node -> * child_node -> * 返回值: * 说明: */ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, struct acpi_namespace_node *parent_node, struct acpi_namespace_node *child_node) { struct acpi_namespace_node *next_node = NULL; ACPI_FUNCTION_ENTRY(); /* 子节点为NULL */ if (!child_node) { /* It's really the parent's _scope_ that we want */ if (parent_node->child) { /* 父节点的第一个子节点 */ next_node = parent_node->child; } } else { /* Start search at the NEXT node */ next_node = acpi_ns_get_next_valid_node(child_node); /* 从同伴节点中获取 */ } /* If any type is OK, we are done */ if (type == ACPI_TYPE_ANY) { /* next_node is NULL if we are at the end-of-list */ return (next_node); } /* Must search for the node -- but within this scope only */ while (next_node) { /* 下一节点不为NULL */ /* If type matches, we are done */ if (next_node->type == type) { /* 类型一致 */ return (next_node); } /* Otherwise, move on to the next node */ /* 获取下一个同伴节点 */ next_node = acpi_ns_get_next_valid_node(next_node); } /* Not found */ return (NULL); }
struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type, struct acpi_namespace_node *parent_node, struct acpi_namespace_node *child_node) { struct acpi_namespace_node *next_node = NULL; ACPI_FUNCTION_ENTRY(); next_node = acpi_ns_get_next_node(parent_node, child_node); /* If any type is OK, we are done */ if (type == ACPI_TYPE_ANY) { /* next_node is NULL if we are at the end-of-list */ return (next_node); } /* Must search for the node -- but within this scope only */ while (next_node) { /* If type matches, we are done */ if (next_node->type == type) { return (next_node); } /* Otherwise, move on to the next node */ next_node = acpi_ns_get_next_valid_node(next_node); } /* Not found */ return (NULL); }