From nobody Fri Nov 01 14:13:03 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 4Xg2rb2yCYz5bq87; Fri, 01 Nov 2024 14:13:03 +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 4Xg2rb1MtXz4bWQ; Fri, 1 Nov 2024 14:13:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730470383; 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=J3G1mwN5L2m6mt/ID/hZVZ5gfpGyNGHSCU8j8JmIyk4=; b=eqbnZL/+GSZuI1he90YtQ7MemWq5cW4VVsQIHFJfD3hTYWlIMewPaUDcOHqBh34nBLlHDX ozY0gU5n8xJNgXl3mzwBKbyZe4lk1zNFui51ZgOZu/mOPE5AcrCov8+OmEUtSY7UD6IEUT zeJin3pG9kAbTCNKRkvo5aaGaoUc6L4dihNXR+NkmKBrsLfZS81/f05CelEGTvIWcSg7rN jfrFFz6+Fw1OB2NX52ewwrvoy5BVrhddCweWHqs1DE/hg2au5VtYItwRDd/kSvxJIVYRoW XN7fJg8y1YF3oIxtlrNWn+oqRllensTuACbzmoqhN2Yr19XytV60rZPFEzUsUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730470383; 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=J3G1mwN5L2m6mt/ID/hZVZ5gfpGyNGHSCU8j8JmIyk4=; b=KWa9+LdwINeI5X8yPyHh+J5wTvvshUYtaU1HVDigyQFPPA26RuSiwf1HwklMZAfNaIcR1Z XFoZkG8IDc5wG2cWx92tKDS+fWrR3kh1c44V12fdfnBxtsBk2m0FNuBjfTxx6SvAdhCcFq KAnJSj0dOQFQYFmhPhZbYW/7mWhZQwEPojSgvf8se4af+mUbr/QoBLUDYO5RnNYXJx9E5q Do38sdMfEHK8zouRi6ElJfOJhHQT62fhRn0bFOY8Jd91hsAEkjpalXLGiQLkYdG6fpTBqs vXGdHjMFZDQQOAjyyZEM31WTaceTr28fz4ymjiYkC9lDZ871AdrhPnNs9EG6Kg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730470383; a=rsa-sha256; cv=none; b=s7/8s56vM9TuF93GkYGdUmo+DR0YXNkaSTvdtZWorVBhc74+8Bkk2/1X8O/Fu2KivHpLJF YCUIbQ6f6zMWMrtVPXORKPBlqP3GZ5SzhM87xGxpxLKr9+VQqG3qt80sGKZg1urSZsHSUj Dmid/2HaR0Q2wrS18x3MPboM4aqAKEQfq1UZooZLGuIAbDyjW84qxhn/trGoLQdW5/H+rk b4HXa1ZsiwNQQyVvgZ2NOhEilK+q0wuI9msvXWZGLIu+ES5d6+XP0RwaJow/r4MGLJl4jj V860ApeZxTsyiQecnKStW0UuqJpd0sBrGDtJKhq6jY5Z21td/x/W1HSWDJ8ZUQ== 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 4Xg2rb0zG3zNjJ; Fri, 1 Nov 2024 14:13:03 +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 4A1ED36K059381; Fri, 1 Nov 2024 14:13:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A1ED30c059378; Fri, 1 Nov 2024 14:13:03 GMT (envelope-from git) Date: Fri, 1 Nov 2024 14:13:03 GMT Message-Id: <202411011413.4A1ED30c059378@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 2ff5c8502735 - main - msk/sk: Use a bus_child_deleted method to free ivars for children 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/main X-Git-Reftype: branch X-Git-Commit: 2ff5c85027356038969d03c2beb55b98db389b41 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2ff5c85027356038969d03c2beb55b98db389b41 commit 2ff5c85027356038969d03c2beb55b98db389b41 Author: John Baldwin AuthorDate: 2024-11-01 14:09:01 +0000 Commit: John Baldwin CommitDate: 2024-11-01 14:09:01 +0000 msk/sk: Use a bus_child_deleted method to free ivars for children Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47365 --- sys/dev/msk/if_msk.c | 12 ++++++++---- sys/dev/sk/if_sk.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/sys/dev/msk/if_msk.c b/sys/dev/msk/if_msk.c index 0f41565c6b02..31c80b87511d 100644 --- a/sys/dev/msk/if_msk.c +++ b/sys/dev/msk/if_msk.c @@ -252,6 +252,7 @@ static const char *model_name[] = { static int mskc_probe(device_t); static int mskc_attach(device_t); +static void mskc_child_deleted(device_t, device_t); static int mskc_detach(device_t); static int mskc_shutdown(device_t); static int mskc_setup_rambuffer(struct msk_softc *); @@ -335,6 +336,7 @@ static device_method_t mskc_methods[] = { DEVMETHOD(device_resume, mskc_resume), DEVMETHOD(device_shutdown, mskc_shutdown), + DEVMETHOD(bus_child_deleted, mskc_child_deleted), DEVMETHOD(bus_get_dma_tag, mskc_get_dma_tag), DEVMETHOD_END @@ -2046,6 +2048,12 @@ msk_detach(device_t dev) return (0); } +static void +mskc_child_deleted(device_t dev, device_t child) +{ + free(device_get_ivars(child), M_DEVBUF); +} + static int mskc_detach(device_t dev) { @@ -2056,13 +2064,9 @@ mskc_detach(device_t dev) if (device_is_alive(dev)) { if (sc->msk_devs[MSK_PORT_A] != NULL) { - free(device_get_ivars(sc->msk_devs[MSK_PORT_A]), - M_DEVBUF); device_delete_child(dev, sc->msk_devs[MSK_PORT_A]); } if (sc->msk_devs[MSK_PORT_B] != NULL) { - free(device_get_ivars(sc->msk_devs[MSK_PORT_B]), - M_DEVBUF); device_delete_child(dev, sc->msk_devs[MSK_PORT_B]); } bus_generic_detach(dev); diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c index 4ed6fb1ad001..423c2eeff945 100644 --- a/sys/dev/sk/if_sk.c +++ b/sys/dev/sk/if_sk.c @@ -185,6 +185,7 @@ static const struct sk_type sk_devs[] = { static int skc_probe(device_t); static int skc_attach(device_t); +static void skc_child_deleted(device_t, device_t); static int skc_detach(device_t); static int skc_shutdown(device_t); static int skc_suspend(device_t); @@ -291,6 +292,7 @@ static device_method_t skc_methods[] = { DEVMETHOD(device_resume, skc_resume), DEVMETHOD(device_shutdown, skc_shutdown), + DEVMETHOD(bus_child_deleted, skc_child_deleted), DEVMETHOD(bus_get_dma_tag, skc_get_dma_tag), DEVMETHOD_END @@ -1738,6 +1740,12 @@ fail: return(error); } +static void +skc_child_deleted(device_t dev, device_t child) +{ + free(device_get_ivars(child), M_DEVBUF); +} + /* * Shutdown hardware and free up resources. This can be called any * time after the mutex has been initialized. It is called in both @@ -1796,11 +1804,9 @@ skc_detach(device_t dev) if (device_is_alive(dev)) { if (sc->sk_devs[SK_PORT_A] != NULL) { - free(device_get_ivars(sc->sk_devs[SK_PORT_A]), M_DEVBUF); device_delete_child(dev, sc->sk_devs[SK_PORT_A]); } if (sc->sk_devs[SK_PORT_B] != NULL) { - free(device_get_ivars(sc->sk_devs[SK_PORT_B]), M_DEVBUF); device_delete_child(dev, sc->sk_devs[SK_PORT_B]); } bus_generic_detach(dev);