Date: Sun, 1 Dec 2024 04:57:43 GMT From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 664491911597 - stable/13 - device_delete_child: Update comments Message-ID: <202412010457.4B14vhW0096775@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=664491911597bdefa4ae2273218ca216b8693290 commit 664491911597bdefa4ae2273218ca216b8693290 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-10-16 18:08:24 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-11-30 21:31:44 +0000 device_delete_child: Update comments This better matches the variable names and the function comment as well as clarifying the reason for the order of operations. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47154 (cherry picked from commit 1ad3351966563b71b9e45803abd5c3e12af3b65a) --- sys/kern/subr_bus.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 9b4a4c65190a..5e76bbeee2bb 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -1968,11 +1968,14 @@ device_delete_child(device_t dev, device_t child) PDEBUG(("%s from %s", DEVICENAME(child), DEVICENAME(dev))); - /* detach parent before deleting children, if any */ + /* + * Detach child. Ideally this cleans up any grandchild + * devices. + */ if ((error = device_detach(child)) != 0) return (error); - /* remove children second */ + /* Delete any grandchildren left after detach. */ while ((grandchild = TAILQ_FIRST(&child->children)) != NULL) { error = device_delete_child(child, grandchild); if (error)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202412010457.4B14vhW0096775>