CONFIG_ATTACH(9)
okay so this is CONFIG_ATTACH(9) from the Kernel Developer's Manual β attach and detach devices, bestie π
β¨ NAME β¨
config_attach, config_detach, config_detach_children β attach and detach devices. That's the trio. Periodt. π
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/device.h>
struct device *
config_attach(struct device *parent, void *cf, void *aux,
cfprint_t print);
int
config_detach(struct device *dev, int flags);
int
config_detach_children(struct device *parent, int flags);
π DESCRIPTION π
The config_attach() function attaches a found device. Memory is allocated for the softc structure, and the driver's attach function is called according to the configuration table. If it's successful, config_attach() returns the softc. If it's unsuccessful, it returns NULL. No softc, no slay π.
The config_detach() function is called by the parent to detach the child device. The second argument flags contains detachment flags:
#define DETACH_FORCE 0x01 /* Force detachment; hardware gone */
#define DETACH_QUIET 0x02 /* Don't print a notice */
So yes bestie, DETACH_FORCE is 0x01 β force detachment; hardware gone β and DETACH_QUIET is 0x02 β don't print a notice. Keep those exact, okay? π
Also config_detach_children() is in the synopsis β she's part of the squad too. π«Ά
π§ CONTEXT π§
config_detach() is always called from process context. That's what allows tsleep(9) to be called while the device detaches itself β specifically to deal with processes which have a device open. Lowkey important. β¨
π RETURN VALUES π
config_detach() returns zero if successful, and an error code otherwise. That's the whole return-value vibe check. π
π¦ SEE ALSO π¦
config_found(9)
this page is from Debian, dated June 13, 2025 β source/version and date noted, mwah ππ«Ά
π¦ where this page comes from
- nixpkgs unstable: cvs-export
- Copyright (c) 2001 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms