From nobody Sun Dec 01 04:57:43 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y1F602Pn9z5gDHQ; Sun, 01 Dec 2024 04:57:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y1F6010Dlz4CNL; Sun, 1 Dec 2024 04:57:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HHpW6px5YTd7n7FF7waPgF1fp8h2+D1I8kIGjQC9xfk=; b=X/eXbA5ZGx+mqTxrGRQFnJ91nBihdn7ARfxDMbEF+vjwkq2CodDf8R23cQTTtWXAHinZNo GIolBpejAbwm8DrYxT/rXwVI1OV6v5jSAkaAJczskcwM+mmb1QSvK2mZ7kRazhFzeGfd7T jB7daqqRseEVdyGEOq3ygkuxAaBzJy+s1AWULa+kgVqsovh3VepOhZErr08G5hn0wtcYFd kBbWn895/MU04P3JLOLV0XbvpVB9ZFMfsf9U6zdffkeM06WpTJiWeMkeOCntdDGgFU9yGA IqSfUkjvfVNPs6czF2Wmeehvy+T1AeiNvYVUIHwtsuCfcsSAvW5eKcJ5Axi2Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HHpW6px5YTd7n7FF7waPgF1fp8h2+D1I8kIGjQC9xfk=; b=NN6FwxOynncOFYuA58qLhXAEinP82jJw2sfvz0Auh+DGBA3sQM8GybXJWG/eXtzlLHBGco ghVPUlv0pEpxOU4BCmcA7OnWq16VxN1Zqt6L2hSYEwnm/pSnc26Ji/eNcyHwXOUbjs//cy 3lTrm1JuPwa3xGSA7wcg07HTPgnbRC2LQ1vMverqlWFvC/2YL005ORyvHJbZX9PAo17me/ mibGmhefpbDKUmkMsuWzEWWkpyydVHDlh4WXdVwz34Qp0o7/ddRjxzVSq6Zvfegon4acX7 M1FG8F6gUfxi8AdTf0WLDjYe6+NK3Ojhhentb2Cu9X+MYsVOhbKJg61lBLL3Gg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733029064; a=rsa-sha256; cv=none; b=hRo6mEdNmY86DQrbViZgyyIrIOPCitxa6KO4d/5OSiDNgM26qI+N8ouwfRL+GsfkKuJfqU iorMS5knr+zNnj48vur0SeG7MuPpmGzk04IrjBfrjQGRh46ZbJzmpPKijtcjWayMHesXDQ 8Ey9uShfNVQr/eCd7H3AnVBbaYRh03BAKTyfyXU2UR9IvkYJV81xlJNFWTo6vWkdwWBG3r pGssOILSoAKto3ak5HIyh4VRwMCjCuIH5xMR/euIYt7K7HjFM36yE1GDuhV99Tr/vdZ31T zRrSFgyRnYJRgMF5trNdE2wCWopM4tXrCgSHBENqZi8av3kB8GuTh/i3vlSZZw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y1F600bMJzfLN; Sun, 1 Dec 2024 04:57:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B14vhqE096780; Sun, 1 Dec 2024 04:57:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B14vhW0096775; Sun, 1 Dec 2024 04:57:43 GMT (envelope-from git) Date: Sun, 1 Dec 2024 04:57:43 GMT Message-Id: <202412010457.4B14vhW0096775@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 664491911597 - stable/13 - device_delete_child: Update comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 664491911597bdefa4ae2273218ca216b8693290 Auto-Submitted: auto-generated The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=664491911597bdefa4ae2273218ca216b8693290 commit 664491911597bdefa4ae2273218ca216b8693290 Author: John Baldwin AuthorDate: 2024-10-16 18:08:24 +0000 Commit: John Baldwin 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)