FreeBSD/sys/kern/subr_bus.c
/**
 * @brief Helper function for implementing DEVICE_SUSPEND()
 *
 * This function can be used to help implement the DEVICE_SUSPEND()
 * for a bus. It calls DEVICE_SUSPEND() for each of the device's
 * children. If any call to DEVICE_SUSPEND() fails, the suspend
 * operation is aborted and any devices which were suspended are
 * resumed immediately by calling their DEVICE_RESUME() methods.
 */
@brief Helper function for implementing DEVICE_SUSPEND()
This function can be used to help implement the DEVICE_SUSPEND()
for a bus. It calls DEVICE_SUSPEND() for each of the device's
children. If any call to DEVICE_SUSPEND() fails, the suspend
operation is aborted and any devices which were suspended are
resumed immediately by calling their DEVICE_RESUME() methods.
@brief Helper function for implementing DEVICE_SUSPEND () This function can be used to help implement the DEVICE_SUSPEND () for a bus . It calls DEVICE_SUSPEND () for each of the device ' s children . If any call to DEVICE_SUSPEND () fails the suspend operation is aborted and any devices which were suspended are resumed immediately by calling their DEVICE_RESUME () methods .
int
bus_generic_suspend(device_t dev)
{
	int		error;
	device_t	child, child2;
	TAILQ_FOREACH(child, &dev->children, link) {
		error = BUS_SUSPEND_CHILD(dev, child);
		if (error) {
			for (child2 = TAILQ_FIRST(&dev->children);
			     child2 && child2 != child;
			     child2 = TAILQ_NEXT(child2, link))
				BUS_RESUME_CHILD(dev, child2);
			return (error);
		}
	}
	return (0);
}
int bus_generic_suspend ( device_t dev ) { int error ; device_t child , child2 ; TAILQ_FOREACH ( child , & dev -> children , link ) { error = BUS_SUSPEND_CHILD ( dev , child ) ; if ( error ) { for ( child2 = TAILQ_FIRST ( & dev -> children ) ; child2 && child2 != child ; child2 = TAILQ_NEXT ( child2 , link ) ) BUS_RESUME_CHILD ( dev , child2 ) ; return ( error ) ; } } return ( 0 ) ; }
@brief Helper function for implementing DEVICE_SUSPEND()
 This function can be used to help implement the DEVICE_SUSPEND()
 for a bus.
@brief Helper function for implementing DEVICE_SUSPEND () This function can be used to help implement the DEVICE_SUSPEND () for a bus .