BUS_ADD_CHILD(9)
π BUS_ADD_CHILD(9) π
okay bestie, welcome to the Kernel Developer's Manual entry for BUS_ADD_CHILD(9) β¨ this is the whole vibe: add a device node to the tree with a given priority. no cap, it's giving kernel-tree matchmaker energy π«Ά
πΈ 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 π¦
so the BUS_ADD_CHILD() method is what the driver identify routine uses to add devices to the tree π it can also be used to add children to buses that implement this routine in other contexts, but the behavior is bus specific, so check yourself before you wreck yourself π please see device_add_child(9) for more details, iykyk.
the interface is the same as device_add_child(9), however the bus' BUS_ADD_CHILD() is the one that gets called β¨
if you're a bus implementing BUS_ADD_CHILD(), the move is to insert the device into the tree using device_add_child(9) before you start adding things like your own ivars and resource lists to that device π
and no, device_add_child(9) does not call BUS_ADD_CHILD(). it's the other way around: BUS_ADD_CHILD() calls device_add_child(9) π
π¨ warning bestie π¨ A panic will result when called for a bus that does not implementBUS_ADD_CHILD(). that is not the cute outcome. also, some buses require a special bus-specific routine to be called instead ofBUS_ADD_CHILD()π
π RETURN VALUES π
the BUS_ADD_CHILD() method returns the device_t added to the tree, or NULL to indicate failure πΈ so if you get NULL, that's a no from the kernel, bestie π
π₯ SEE ALSO π₯
π AUTHORS π
this manual page was written by M. Warner Losh π iconic behavior, honestly.
cute little sign-off: this footer moment is brought to you by Debian, dated April 8, 2018 β mwah πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2004 M. Warner Losh <imp@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms