DEVICE_DETACH(9)

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

✨ DEVICE_DETACH(9) ✨

okay so bestie, this one is from the Kernel Developer's Manual and it's lowkey the breakup manual for devices πŸ’” the way that drivers and hardware can just... part ways. iconic.


🌸 NAME 🌸

DEVICE_DETACH β€” detach a device


πŸŽ€ SYNOPSIS πŸŽ€

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

int
DEVICE_DETACH(device_t dev);

πŸ’… DESCRIPTION πŸ’…

So you're detaching a device. Main character move honestly. This can be called if the user is replacing the driver software, or if a device is about to be physically removed from the system 🫢 no cap, those are the two situations.

The method should deallocate any system resources allocated during the DEVICE_ATTACH(9) method, and reset the hardware to a sane state (i.e., disable interrupts etc.) ✨ like, clean up after yourself, don't just leave your stuff everywhere. be a decent ex, yk?

tl;dr β€” whatever you allocated in attach, you free here. and put the hardware back in a sane state (interrupts off, etc.).

🌈 RETURN VALUES 🌈

Zero is returned on success, otherwise an appropriate error is returned. fr fr, zero means slay πŸ’– anything else means something went sideways.


πŸ¦‹ SEE ALSO πŸ¦‹


πŸ‘‘ AUTHORS πŸ‘‘

This manual page was written by Doug Rabson. giving credit where credit is due 🫢


πŸ’– that's the whole page bestie, go detach something responsibly πŸ’–

this one's from the Debian build of the manpage, dated June 16, 1998 β€” yes, a literal 90s icon πŸ‘‘βœ¨

πŸ“¦ where this page comes from