---
name: "OF_peer"
section: "9freebsd"
platform: "linux"
package: "freebsd-manpages"
version: "12.2-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/OF_child/9freebsd"
---

# OF\_peer(9freebsd)

navigate device tree

Part of [OF\_child(9freebsd)](/OF_child/9freebsd.md).

## NAME

**OF\_child**, **OF\_parent**, **OF\_peer** – navigate device tree

## SYNOPSIS

**#include \<dev/ofw/ofw\_bus.h\>**

**#include \<dev/ofw/ofw\_bus\_subr.h\>**

*phandle\_t*\

**OF\_child**(*phandle\_t node*);

*phandle\_t*\

**OF\_parent**(*phandle\_t node*);

*phandle\_t*\

**OF\_peer**(*phandle\_t node*);

## DESCRIPTION

**OF\_child**() returns the phandle value of the first child of the *node*. Zero is returned if there are no child nodes.

**OF\_parent**() returns the phandle for the parent of the *node*. Zero is returned if *node* is the root node.

**OF\_peer**() returns the phandle value of the next sibling of the *node*. Zero is returned if there is no sibling node.

## EXAMPLES

```
phandle_t node, child;
 ...
for (child = OF_child(node); child != 0; child = OF_peer(child) {
	...
}
```

## SEE ALSO

[OF\_finddevice(9)](/OF_finddevice/9.md)

## AUTHORS

This manual page was written by Oleksandr Tymoshenko ⟨*gonzo@FreeBSD.org*⟩.
