xref: /freebsd/share/man/man9/OF_child.9 (revision 0dbdecfd4f23486da21345fe446a28a1c27db3f2)
1.\"
2.\" Copyright (c) 2018 Oleksandr Tymoshenko <gonzo@FreeBSD.org>
3.\"
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25.\"
26.\" $FreeBSD$
27.\"
28.Dd April 9, 2018
29.Dt OF_CHILD 9
30.Os
31.Sh NAME
32.Nm OF_child ,
33.Nm OF_parent ,
34.Nm OF_peer
35.Nd navigate device tree
36.Sh SYNOPSIS
37.In dev/ofw/ofw_bus.h
38.In dev/ofw/ofw_bus_subr.h
39.Ft phandle_t
40.Fn OF_child "phandle_t node"
41.Ft phandle_t
42.Fn OF_parent "phandle_t node"
43.Ft phandle_t
44.Fn OF_peer "phandle_t node"
45.Sh DESCRIPTION
46.Pp
47.Fn OF_child
48returns the phandle value of the first child of the
49.Fa node .
50Zero is returned if there are no child nodes.
51.Pp
52.Fn OF_parent
53returns the phandle for the parent of the
54.Fa node .
55Zero is returned if
56.Fa node
57is the root node.
58.Pp
59.Fn OF_peer
60returns the phandle value of the next sibling of the
61.Fa node .
62Zero is returned if there is no sibling node.
63.Sh EXAMPLES
64.Bd -literal
65phandle_t node, child;
66 ...
67for (child = OF_child(node); child != 0; child = OF_peer(child) {
68	...
69}
70.Ed
71.Sh SEE ALSO
72.Xr OF_finddevice 9
73.Sh AUTHORS
74.An -nosplit
75This manual page was written by
76.An Oleksandr Tymoshenko Aq Mt gonzo@FreeBSD.org .
77