CONFIG_ATTACH(9)

πŸ“¦ in nixpkgs unstable

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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms