git: 1ad335196656 - main - device_delete_child: Update comments
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 16 Oct 2024 18:09:16 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=1ad3351966563b71b9e45803abd5c3e12af3b65a
commit 1ad3351966563b71b9e45803abd5c3e12af3b65a
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-10-16 18:08:24 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-10-16 18:08:24 +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
---
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 ef71588f7157..f41884d576a8 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -1477,11 +1477,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)