From nobody Sun Dec 1 04:56:53 2024 X-Original-To: dev-commits-src-branches@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 4Y1F524lf0z5gD5S; Sun, 01 Dec 2024 04:56:54 +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 4Y1F521CdNz47vL; Sun, 1 Dec 2024 04:56:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029014; 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=4cKLoFCOSOcCprkKe8T9HcT/rEtuezQMrt2ByJvvNSo=; b=KyRk5jF5f21dgwhpQheyPz01baoe6lbM9v6FAt4EneBYr8DAXrVXuIbDGWQ7TBS+UfMDFw XaTifuWW37oOEuRo1rfwgf+Rko6eXJH+rbU3eGYmn3F/TA5KmXh0pXOe6okbKWxFcix2Ve mDRfxlHSrGPrP/FU6vem4RfiEGM1xc4UlM9igPm2Pq7T5ibWyp8Bb5AmEy13jrOkBI7eQv +YsAFZRhudKLK2nF1aNOU2bLflXKNQ7rYbCswQenIF1tByohKfRfxpK1HTtuHF4hVlFUsz nIIhrj9ivACKKzotHFPlUD8jCXT7BDI3gEuaKXg9cU9xZ1Hj+OzGLu411ZjRXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029014; 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=4cKLoFCOSOcCprkKe8T9HcT/rEtuezQMrt2ByJvvNSo=; b=tBWA1Zf0eF90G2a4QKCaD+hGT6vD5EgtERXM95ywJQ5B+m05wbPh7GIzyHeLbjej3xztL6 btmr094nGzwjNlsT1QdsB+YEilmNvsVfJBBWG5Fj0Dvm6H1KrgTt5dE5ZLqTLjILwt1ZaK z37dl/yqqi3kK7LhbXSoZ7dZ+KgbDtw1lpReowKYzzm71ZPW6oR0/q9+DRi3MW6UI+CJLW pJaEe4+syViY80Aqa0UtdyaYWteHQ60OHc4Q2h9tsCezXjGfmRJ9U2txT8ONbkDwtEIntB CGEhAddhk9hSE6CJvMaL5UJu9m77XOWIxaBdViUNnzmrOy50yxZS5AyrderwFg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733029014; a=rsa-sha256; cv=none; b=qcxQI0yUAyU78lXZg2mJJyCjNof7MMipHxa8bsQtSBc1FlUVb7lUuOOYnL5FHA0ongwbt6 7gbi4XVY5clugkF0MR6MqlhgCPUjXz5XjhIkEwro/i9kWvDJVhC7aS8/YJANQfbExB/vGa 2+DpoAGszEqpq8tUE40dL63BPnpNuR8azyXR2r27b7f+kZoOk4fZ5I9lYsmvyy3OPwAhqK BZOreLHhHTZ3o4AfThMMXOiy5190PscvO22+/NSoiqdcH2WQx4utJy3y6GKsdpFSSAh+wC ak2+KIpKsH65TZYbW4Ksaa6urwUeGq6fOTHEH6H/xfwOAYdg27ir5Ixl5hgLfg== 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 4Y1F520SlGzf7Q; Sun, 1 Dec 2024 04:56:54 +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 4B14urS4094377; Sun, 1 Dec 2024 04:56:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B14urqJ094374; Sun, 1 Dec 2024 04:56:53 GMT (envelope-from git) Date: Sun, 1 Dec 2024 04:56:53 GMT Message-Id: <202412010456.4B14urqJ094374@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: bce5607513fa - stable/14 - device_delete_child: Update comments List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/14 X-Git-Reftype: branch X-Git-Commit: bce5607513fa59b066f8a4eff05545f5169eb268 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=bce5607513fa59b066f8a4eff05545f5169eb268 commit bce5607513fa59b066f8a4eff05545f5169eb268 Author: John Baldwin AuthorDate: 2024-10-16 18:08:24 +0000 Commit: John Baldwin 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)