Index: kern/subr_bus.c =================================================================== --- kern/subr_bus.c (revision 236313) +++ kern/subr_bus.c (working copy) @@ -1873,6 +1873,8 @@ return (error); if (child->devclass) devclass_delete_device(child->devclass, child); + if (child->parent) + BUS_CHILD_DELETED(dev, child); TAILQ_REMOVE(&dev->children, child, link); TAILQ_REMOVE(&bus_data_devices, child, devlink); kobj_delete((kobj_t) child, M_BUS); Index: kern/bus_if.m =================================================================== --- kern/bus_if.m (revision 236313) +++ kern/bus_if.m (working copy) @@ -160,6 +160,20 @@ }; /** + * @brief Notify a bus that a child was deleted + * + * Called at the beginning of device_delete_child() to allow the parent + * to teardown any bus-specific state for the child. + * + * @param _dev the device whose child is being deleted + * @param _child the child device which is being deleted + */ +METHOD void child_deleted { + device_t _dev; + device_t _child; +}; + +/** * @brief Notify a bus that a child was detached * * Called after the child's DEVICE_DETACH() method to allow the parent