FreeBSD/sys/kern/subr_bus.c
/**
 * @brief Quiesces a set of device drivers from a device class
 *
 * Quiesce a device driver from a devclass. This is normally called
 * automatically by DRIVER_MODULE().
 *
 * If the driver is currently attached to any devices,
 * devclass_quiesece_driver() will first attempt to quiesce each
 * device.
 *
 * @param dc		the devclass to edit
 * @param driver	the driver to unregister
 */
@brief Quiesces a set of device drivers from a device class
Quiesce a device driver from a devclass. This is normally called
automatically by DRIVER_MODULE().

If the driver is currently attached to any devices,
devclass_quiesece_driver() will first attempt to quiesce each
device.

@param dc            the devclass to edit
@param driver        the driver to unregister
@brief Quiesces a set of device drivers from a device class Quiesce a device driver from a devclass . This is normally called automatically by DRIVER_MODULE () . If the driver is currently attached to any devices devclass_quiesece_driver () will first attempt to quiesce each device . @param dc the devclass to edit @param driver the driver to unregister
static int
devclass_quiesce_driver(devclass_t busclass, driver_t *driver)
{
	devclass_t dc = devclass_find(driver->name);
	driverlink_t dl;
	device_t dev;
	int i;
	int error;
	PDEBUG(("%s from devclass %s", driver->name, DEVCLANAME(busclass)));
	if (!dc)
		return (0);
	TAILQ_FOREACH(dl, &busclass->drivers, link) {
		if (dl->driver == driver)
			break;
	}
	if (!dl) {
		PDEBUG(("%s not found in %s list", driver->name,
		    busclass->name));
		return (ENOENT);
	}
	for (i = 0; i < dc->maxunit; i++) {
		if (dc->devices[i]) {
			dev = dc->devices[i];
			if (dev->driver == driver && dev->parent &&
			    dev->parent->devclass == busclass) {
				if ((error = device_quiesce(dev)) != 0)
					return (error);
			}
		}
	}
	return (0);
}
static int devclass_quiesce_driver ( devclass_t busclass , driver_t * driver ) { devclass_t dc = devclass_find ( driver -> name ) ; driverlink_t dl ; device_t dev ; int i ; int error ; PDEBUG ( ( " " , driver -> name , DEVCLANAME ( busclass ) ) ) ; if ( ! dc ) return ( 0 ) ; TAILQ_FOREACH ( dl , & busclass -> drivers , link ) { if ( dl -> driver == driver ) break ; } if ( ! dl ) { PDEBUG ( ( " " , driver -> name , busclass -> name ) ) ; return ( ENOENT ) ; } for ( i = 0 ; i < dc -> maxunit ; i ++ ) { if ( dc -> devices [ i ] ) { dev = dc -> devices [ i ] ; if ( dev -> driver == driver && dev -> parent && dev -> parent -> devclass == busclass ) { if ( ( error = device_quiesce ( dev ) ) != 0 ) return ( error ) ; } } } return ( 0 ) ; }
@brief Quiesces a set of device drivers from a device class
 Quiesce a device driver from a devclass.
@brief Quiesces a set of device drivers from a device class Quiesce a device driver from a devclass .
/*
	 * Find the link structure in the bus' list of drivers.
	 */ /*
	 * Quiesce all devices.  We iterate through all the devices in
	 * the devclass of the driver and quiesce any which are using
	 * the driver and which have a parent in the devclass which we
	 * are quiescing.
	 *
	 * Note that since a driver can be in multiple devclasses, we
	 * should not quiesce devices which are not children of
	 * devices in the affected devclass.
	 */