The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3f93f96c26e51a42822c61e73252f4aeb6bb303a
commit 3f93f96c26e51a42822c61e73252f4aeb6bb303a Author: John Baldwin <j...@freebsd.org> AuthorDate: 2025-02-05 19:45:54 +0000 Commit: John Baldwin <j...@freebsd.org> CommitDate: 2025-02-05 19:46:23 +0000 device_delete_child.9: Reference device_detach.9 and BUS_CHILD_DELETED.9 Refer to device_detach(9) for the description of detaching a device. Note that descendants of the child device are also deleted (though in theory a proper detach routine should have already deleted these). Finally, note that BUS_CHILD_DELETED(9) is invoked on each deleted device. Differential Revision: https://reviews.freebsd.org/D48365 --- share/man/man9/device_delete_child.9 | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/share/man/man9/device_delete_child.9 b/share/man/man9/device_delete_child.9 index f6c08cb52e16..819c7f5e36b9 100644 --- a/share/man/man9/device_delete_child.9 +++ b/share/man/man9/device_delete_child.9 @@ -26,7 +26,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd June 16, 1998 +.Dd February 5, 2025 .Dt DEVICE_DELETE_CHILD 9 .Os .Sh NAME @@ -41,13 +41,26 @@ The specified device is removed from .Fa dev and deleted. -If the device is currently attached, it is first detached (see -.Xr DEVICE_ATTACH 9 -and -.Xr DEVICE_DETACH 9 ) . +If the device is currently attached, it is first detached via +.Xr device_detach 9 . +If +.Fn device_detach +fails, +its error value is returned. +Otherwise, +all descendant devices of +.Fa child +are deleted and zero is returned. +.Pp +The +.Xr BUS_CHILD_DELETED 9 +method is invoked for each device that is deleted. +This permits the parent device's driver to tear down any state associated +with child devices such as ivars. .Sh RETURN VALUES Zero is returned on success, otherwise an error is returned. .Sh SEE ALSO +.Xr BUS_CHILD_DELETED 9 , .Xr device_add_child 9 .Sh AUTHORS This manual page was written by