sys/kern/subr_bus.c
/**
 * @brief Set the device's softc field
 *
 * Most drivers do not need to use this since the softc is allocated
 * automatically when the driver is attached.
 */
@brief Set the device's softc field
Most drivers do not need to use this since the softc is allocated
automatically when the driver is attached.
@brief Set the device ' s softc field Most drivers do not need to use this since the softc is allocated automatically when the driver is attached .
void
device_set_softc(device_t dev, void *softc)
{
	if (dev->softc && !(dev->flags & DF_EXTERNALSOFTC))
		free(dev->softc, M_BUS_SC);
	dev->softc = softc;
	if (dev->softc)
		dev->flags |= DF_EXTERNALSOFTC;
	else
		dev->flags &= ~DF_EXTERNALSOFTC;
}
void device_set_softc ( device_t dev , void * softc ) { if ( dev -> softc && ! ( dev -> flags & DF_EXTERNALSOFTC ) ) free ( dev -> softc , M_BUS_SC ) ; dev -> softc = softc ; if ( dev -> softc ) dev -> flags |= DF_EXTERNALSOFTC ; else dev -> flags &= ~ DF_EXTERNALSOFTC ; }
@brief Set the device's softc field
 Most drivers do not need to use this since the softc is allocated
 automatically when the driver is attached.
@brief Set the device ' s softc field Most drivers do not need to use this since the softc is allocated automatically when the driver is attached .