/* The Device tree is traversed in a depth-first search, starting from Node. The input Node is skipped. */
STATIC EFI_STATUS EFIAPI FdtGetNextCondNode(IN CONST VOID *Fdt, IN OUT INT32 *Node, IN OUT INT32 *Depth, IN NODE_CHECKER_FUNC NodeChecker, IN CONST VOID *Context)
/* The Device tree is traversed in a depth-first search, starting from Node. The input Node is skipped. */
STATIC EFI_STATUS EFIAPI FdtGetNextCondNode(IN CONST VOID *Fdt, IN OUT INT32 *Node, IN OUT INT32 *Depth, IN NODE_CHECKER_FUNC NodeChecker, IN CONST VOID *Context)
{
  INT32  CurrNode;
  if ((Fdt == NULL)   ||
      (Node == NULL)  ||
      (Depth == NULL) ||
      (NodeChecker == NULL))
  {
    ASSERT (0);
    return EFI_INVALID_PARAMETER;
  }
  CurrNode = *Node;
  do {
    CurrNode = fdt_next_node (Fdt, CurrNode, Depth);
    if ((CurrNode == -FDT_ERR_NOTFOUND) ||
        (*Depth < 0))
    {
      return EFI_NOT_FOUND;
    } else if (CurrNode < 0) {
      ASSERT (0);
      return EFI_ABORTED;
    }
  } while (!NodeChecker (Fdt, CurrNode, Context));
  *Node = CurrNode;
  return EFI_SUCCESS;
}