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

# BUS\_ADD\_CHILD(9freebsd)

add a device node to the tree with a given priority

## NAME

**BUS\_ADD\_CHILD** – add a device node to the tree with a given priority

## SYNOPSIS

**#include \<sys/param.h\>**

**#include \<sys/bus.h\>**

*device\_t*\

**BUS\_ADD\_CHILD**(*device\_t dev*, *int order*, *const char \*name*, *int unit*);

## DESCRIPTION

The **BUS\_ADD\_CHILD**() method is used by the driver identify routine to add devices to the tree. It can also be used to add children to buses that implement this routine in other contexts, although the behavior is bus specific. Please see [device\_add\_child(9)](/device_add_child/9.md) for more details. The interface is the same as [device\_add\_child(9)](/device_add_child/9.md) however, the bus' **BUS\_ADD\_CHILD**() is called.

Buses implementing **BUS\_ADD\_CHILD**() should insert the device into the tree using [device\_add\_child(9)](/device_add_child/9.md) before adding things such as their own ivars and resource lists to the device. **BUS\_ADD\_CHILD**() is not called by [device\_add\_child(9)](/device_add_child/9.md). **BUS\_ADD\_CHILD**() instead calls [device\_add\_child(9)](/device_add_child/9.md).

A panic will result when called for a bus that does not implement **BUS\_ADD\_CHILD**(). Some buses require a special bus-specific routine to be called instead of **BUS\_ADD\_CHILD**().

## RETURN VALUES

The **BUS\_ADD\_CHILD**() method returns *device\_t* added to the tree, or NULL to indicate failure.

## SEE ALSO

[device(9)](/device/9.md), [device\_add\_child(9)](/device_add_child/9.md), [driver(9)](/driver/9.md)

## AUTHORS

This manual page was written by M. Warner Losh.
