xref: /freebsd/share/man/man9/BUS_ADD_CHILD.9 (revision 1719886f6d08408b834d270c59ffcfd821c8f63a)
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.Dd April 8, 2018
26.Dt BUS_ADD_CHILD 9
27.Os
28.Sh NAME
29.Nm BUS_ADD_CHILD
30.Nd "add a device node to the tree with a given priority"
31.Sh SYNOPSIS
32.In sys/param.h
33.In sys/bus.h
34.Ft device_t
35.Fn BUS_ADD_CHILD "device_t dev" "int order" "const char *name" "int unit"
36.Sh DESCRIPTION
37The
38.Fn BUS_ADD_CHILD
39method
40is used by the driver identify routine to add devices to the tree.
41It can also be used to add children to buses that implement this
42routine in other contexts, although the behavior is bus specific.
43Please see
44.Xr device_add_child 9
45for more details.
46The interface is the same as
47.Xr device_add_child 9
48however, the bus'
49.Fn BUS_ADD_CHILD
50is called.
51.Pp
52Buses implementing
53.Fn BUS_ADD_CHILD
54should insert the device into the tree using
55.Xr device_add_child 9
56before adding things such as their own ivars and resource lists to the device.
57.Fn BUS_ADD_CHILD
58is not called by
59.Xr device_add_child 9 .
60.Fn BUS_ADD_CHILD
61instead calls
62.Xr device_add_child 9 .
63.Pp
64A panic will result when called for a bus that does not implement
65.Fn BUS_ADD_CHILD .
66Some buses require a special bus-specific routine to be called instead
67of
68.Fn BUS_ADD_CHILD .
69.Sh RETURN VALUES
70The
71.Fn BUS_ADD_CHILD
72method returns
73.Vt device_t
74added to the tree, or
75.Dv NULL
76to indicate failure.
77.Sh SEE ALSO
78.Xr device 9 ,
79.Xr device_add_child 9 ,
80.Xr driver 9
81.Sh AUTHORS
82This manual page was written by
83.An M. Warner Losh .
84