FreeBSD/sys/kern/subr_bus.c
/**
 * @brief Delete all children devices of the given device, if any.
 *
 * This function deletes all children devices of the given device, if
 * any, using the device_delete_child() function for each device it
 * finds. If a child device cannot be deleted, this function will
 * return an error code.
 *
 * @param dev		the parent device
 *
 * @retval 0		success
 * @retval non-zero	a device would not detach
 */
@brief Delete all children devices of the given device, if any.
This function deletes all children devices of the given device, if
any, using the device_delete_child() function for each device it
finds. If a child device cannot be deleted, this function will
return an error code.

@param dev           the parent device

@retval 0            success
@retval non-zero     a device would not detach
@brief Delete all children devices of the given device if any . This function deletes all children devices of the given device if any using the device_delete_child () function for each device it finds . If a child device cannot be deleted this function will return an error code . @param dev the parent device @retval 0 success @retval non - zero a device would not detach
int
device_delete_children(device_t dev)
{
	device_t child;
	int error;
	PDEBUG(("Deleting all children of %s", DEVICENAME(dev)));
	error = 0;
	while ((child = TAILQ_FIRST(&dev->children)) != NULL) {
		error = device_delete_child(dev, child);
		if (error) {
			PDEBUG(("Failed deleting %s", DEVICENAME(child)));
			break;
		}
	}
	return (error);
}
int device_delete_children ( device_t dev ) { device_t child ; int error ; PDEBUG ( ( " " , DEVICENAME ( dev ) ) ) ; error = 0 ; while ( ( child = TAILQ_FIRST ( & dev -> children ) ) != NULL ) { error = device_delete_child ( dev , child ) ; if ( error ) { PDEBUG ( ( " " , DEVICENAME ( child ) ) ) ; break ; } } return ( error ) ; }
@brief Delete all children devices of the given device, if any.
@brief Delete all children devices of the given device if any .