Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Dec 2024 04:56:53 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: bce5607513fa - stable/14 - device_delete_child: Update comments
Message-ID:  <202412010456.4B14urqJ094374@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=bce5607513fa59b066f8a4eff05545f5169eb268

commit bce5607513fa59b066f8a4eff05545f5169eb268
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-10-16 18:08:24 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-12-01 02:46:04 +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 f55a7210e825..982eeaebf21c 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -1522,11 +1522,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?202412010456.4B14urqJ094374>