sys/kern/subr_bus.c
/**
 * @internal
 * @brief Delete a device from a devclass
 *
 * The device is removed from the devclass's device list and its unit
 * number is freed.

 * @param dc		the devclass to delete from
 * @param dev		the device to delete
 *
 * @retval 0		success
 */
@internal
@brief Delete a device from a devclass

The device is removed from the devclass's device list and its unit
number is freed.

@param dc            the devclass to delete from
@param dev           the device to delete

@retval 0            success
@internal @brief Delete a device from a devclass The device is removed from the devclass ' s device list and its unit number is freed . @param dc the devclass to delete from @param dev the device to delete @retval 0 success
static int
devclass_delete_device(devclass_t dc, device_t dev)
{
	if (!dc || !dev)
		return (0);
	PDEBUG(("%s in devclass %s", DEVICENAME(dev), DEVCLANAME(dc)));
	if (dev->devclass != dc || dc->devices[dev->unit] != dev)
		panic("devclass_delete_device: inconsistent device class");
	dc->devices[dev->unit] = NULL;
	if (dev->flags & DF_WILDCARD)
		dev->unit = -1;
	dev->devclass = NULL;
	free(dev->nameunit, M_BUS);
	dev->nameunit = NULL;
	return (0);
}
static int devclass_delete_device ( devclass_t dc , device_t dev ) { if ( ! dc || ! dev ) return ( 0 ) ; PDEBUG ( ( " " , DEVICENAME ( dev ) , DEVCLANAME ( dc ) ) ) ; if ( dev -> devclass != dc || dc -> devices [ dev -> unit ] != dev ) panic ( " " ) ; dc -> devices [ dev -> unit ] = NULL ; if ( dev -> flags & DF_WILDCARD ) dev -> unit = -1 ; dev -> devclass = NULL ; free ( dev -> nameunit , M_BUS ) ; dev -> nameunit = NULL ; return ( 0 ) ; }
@internal
 @brief Delete a device from a devclass
@internal @brief Delete a device from a devclass