DEVICE_SET_DRIVER(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’« DEVICE_SET_DRIVER πŸ’«

okay so bestie, welcome to DEVICE_SET_DRIVER(9) from the Kernel Developer's Manual β€” yes it's giving kernel-dev main character energy and honestly? iconic. let's get into it 🫢


✨ NAME ✨

device_set_driver β€” the little function that goes "hey, this driver? it belongs to this device node in the tree." matching them up like it's prom πŸ’…


🌸 SYNOPSIS 🌸

#include <sys/param.h>
#include <sys/bus.h>

void
device_set_driver(device_t dev, driver_t *driver);

like, literally copy that in and you're set ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so what does it actually do? device_set_driver() associates a specific driver with a given device node in the tree. that's the whole vibe β€” you hand it a device_t dev and a driver_t *driver, and boom, they're linked πŸ”₯

where you'll see this used fr fr: it's typically used inside DEVICE_IDENTIFY(9) functions, specifically to add devices to a bus that does not support doing so automatically β€” the ISA bus being the classic example here πŸ‘‘

so basically: bus won't do the matching itself? not on your watch. you do it manually and slay πŸŽ€


πŸ‘‘ SEE ALSO πŸ‘‘

  • device(9) β€” go read this one too, iykyk

πŸ’– AUTHORS πŸ’–

this manual page was written by M. Warner Losh β€” thank you for your service, king 🌈


and that's the whole page, bestie! short, sweet, and 100% useful πŸ’œ

sign-off time πŸŽ€ β€” this one's straight out of the Debian edition, dated April 21, 2003, and the page is literally named DEVICE_SET_DRIVER(9). periodt.

πŸ“¦ where this page comes from