* Kill everything still on the list. The driver should already have * disposed of any softc hung of the struct cdev *'s at this time. */
| 1393 | * disposed of any softc hung of the struct cdev *'s at this time. |
| 1394 | */ |
| 1395 | void |
| 1396 | clone_cleanup(struct clonedevs **cdp) |
| 1397 | { |
| 1398 | struct cdev *dev; |
| 1399 | struct cdev_priv *cp; |
| 1400 | struct clonedevs *cd; |
| 1401 | |
| 1402 | cd = *cdp; |
| 1403 | if (cd == NULL) |
| 1404 | return; |
| 1405 | dev_lock(); |
| 1406 | while (!LIST_EMPTY(&cd->head)) { |
| 1407 | dev = LIST_FIRST(&cd->head); |
| 1408 | LIST_REMOVE(dev, si_clone); |
| 1409 | KASSERT(dev->si_flags & SI_CLONELIST, |
| 1410 | ("Dev %p(%s) should be on clonelist", dev, dev->si_name)); |
| 1411 | dev->si_flags &= ~SI_CLONELIST; |
| 1412 | cp = cdev2priv(dev); |
| 1413 | if (!(cp->cdp_flags & CDP_SCHED_DTR)) { |
| 1414 | cp->cdp_flags |= CDP_SCHED_DTR; |
| 1415 | KASSERT(dev->si_flags & SI_NAMED, |
| 1416 | ("Driver has goofed in cloning underways udev %jx unit %x", |
| 1417 | (uintmax_t)dev2udev(dev), dev2unit(dev))); |
| 1418 | destroy_devl(dev); |
| 1419 | } |
| 1420 | } |
| 1421 | dev_unlock_and_free(); |
| 1422 | free(cd, M_DEVBUF); |
| 1423 | *cdp = NULL; |
| 1424 | } |
| 1425 | |
| 1426 | static TAILQ_HEAD(, cdev_priv) dev_ddtr = |
| 1427 | TAILQ_HEAD_INITIALIZER(dev_ddtr); |
no test coverage detected