FreeBSD/sys/kern/kern_conf.c
/*
 * Kill everything still on the list.  The driver should already have
 * disposed of any softc hung of the struct cdev *'s at this time.
 */
Kill everything still on the list.  The driver should already have
disposed of any softc hung of the struct cdev *'s at this time.
Kill everything still on the list . The driver should already have disposed of any softc hung of the struct cdev * ' s at this time .
void
clone_cleanup(struct clonedevs **cdp)
{
	struct cdev *dev;
	struct cdev_priv *cp;
	struct clonedevs *cd;
	cd = *cdp;
	if (cd == NULL)
		return;
	dev_lock();
	while (!LIST_EMPTY(&cd->head)) {
		dev = LIST_FIRST(&cd->head);
		LIST_REMOVE(dev, si_clone);
		KASSERT(dev->si_flags & SI_CLONELIST,
		    ("Dev %p(%s) should be on clonelist", dev, dev->si_name));
		dev->si_flags &= ~SI_CLONELIST;
		cp = cdev2priv(dev);
		if (!(cp->cdp_flags & CDP_SCHED_DTR)) {
			cp->cdp_flags |= CDP_SCHED_DTR;
			KASSERT(dev->si_flags & SI_NAMED,
				("Driver has goofed in cloning underways udev %jx unit %x",
				(uintmax_t)dev2udev(dev), dev2unit(dev)));
			destroy_devl(dev);
		}
	}
	dev_unlock_and_free();
	free(cd, M_DEVBUF);
	*cdp = NULL;
}
void clone_cleanup ( struct clonedevs * * cdp ) { struct cdev * dev ; struct cdev_priv * cp ; struct clonedevs * cd ; cd = * cdp ; if ( cd == NULL ) return ; dev_lock ( ) ; while ( ! LIST_EMPTY ( & cd -> head ) ) { dev = LIST_FIRST ( & cd -> head ) ; LIST_REMOVE ( dev , si_clone ) ; KASSERT ( dev -> si_flags & SI_CLONELIST , ( " " , dev , dev -> si_name ) ) ; dev -> si_flags &= ~ SI_CLONELIST ; cp = cdev2priv ( dev ) ; if ( ! ( cp -> cdp_flags & CDP_SCHED_DTR ) ) { cp -> cdp_flags |= CDP_SCHED_DTR ; KASSERT ( dev -> si_flags & SI_NAMED , ( " " , ( uintmax_t ) dev2udev ( dev ) , dev2unit ( dev ) ) ) ; destroy_devl ( dev ) ; } } dev_unlock_and_free ( ) ; free ( cd , M_DEVBUF ) ; * cdp = NULL ; }
Kill everything still on the list.
Kill everything still on the list .