Manual Page Search Parameters

CONFIG_ATTACH(9) Kernel Developer's Manual CONFIG_ATTACH(9)

config_attach, config_detach, config_detach_children
attach and detach devices

#include <sys/param.h>
#include <sys/device.h>
struct device *
config_attach(struct device *parent, void *cf, void *aux, cfprint_t print);
config_detach(struct device *dev, int flags);
config_detach_children(struct device *parent, int flags);

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 successful, config_attach() returns the softc. If unsuccessful, it returns NULL.
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 */

config_detach() is always called from process context, allowing tsleep(9) to be called while the device detaches itself (to deal with processes which have a device open).

config_detach() returns zero if successful and an error code otherwise.

July 13, 2014 OpenBSD-5.6