xref: /freebsd/share/man/man9/BUS_ADD_CHILD.9 (revision 7029da5c36f2d3cf6bb6c81bf551229f416399e8)
1.\" -*- nroff -*-
2.\"
3.\" Copyright (c) 2004 M. Warner Losh <imp@FreeBSD.org>
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
15.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
18.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd April 8, 2018
28.Dt BUS_ADD_CHILD 9
29.Os
30.Sh NAME
31.Nm BUS_ADD_CHILD
32.Nd "add a device node to the tree with a given priority"
33.Sh SYNOPSIS
34.In sys/param.h
35.In sys/bus.h
36.Ft device_t
37.Fn BUS_ADD_CHILD "device_t dev" "int order" "const char *name" "int unit"
38.Sh DESCRIPTION
39The
40.Fn BUS_ADD_CHILD
41method
42is used by the driver identify routine to add devices to the tree.
43It can also be used to add children to buses that implement this
44routine in other contexts, although the behavior is bus specific.
45Please see
46.Xr device_add_child 9
47for more details.
48The interface is the same as
49.Xr device_add_child 9
50however, the bus'
51.Fn BUS_ADD_CHILD
52is called.
53.Pp
54Buses implementing
55.Fn BUS_ADD_CHILD
56should insert the device into the tree using
57.Xr device_add_child 9
58before adding things such as their own ivars and resource lists to the device.
59.Fn BUS_ADD_CHILD
60is not called by
61.Xr device_add_child 9 .
62.Fn BUS_ADD_CHILD
63instead calls
64.Xr device_add_child 9 .
65.Pp
66A panic will result when called for a bus that does not implement
67.Fn BUS_ADD_CHILD .
68Some buses require a special bus-specific routine to be called instead
69of
70.Fn BUS_ADD_CHILD .
71.Sh RETURN VALUES
72The
73.Fn BUS_ADD_CHILD
74method returns
75.Vt device_t
76added to the tree, or
77.Dv NULL
78to indicate failure.
79.Sh SEE ALSO
80.Xr device 9 ,
81.Xr device_add_child 9 ,
82.Xr driver 9
83.Sh AUTHORS
84This manual page was written by
85.An M. Warner Losh .
86