From nobody Fri Nov 01 14:13:12 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 4Xg2rm58jcz5bpsl; Fri, 01 Nov 2024 14:13:12 +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 4Xg2rm2y7Lz4bVJ; Fri, 1 Nov 2024 14:13:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730470392; 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=9vtHx0bW4nkPtVoyzJPrliudfHm+g39K5AZIxA/+clk=; b=mQOrkBL720ViAV4pEf5A8IzYyJsWDjMYllOWvQaVzLEN6Tn7xWfGUoBYHzV8MPID2+cD3X PnhpOaJtH+xG6+YOF45/w8X6db7Cli7Sa3bP17GXMv/WUyAqx0Cc2ynOlDcGo31OmWakeJ OZaGkMDqFCr9ftjFbA0Ex6HvngGUv8TinilyFPeP74/uunUyJElvbKuSzNOrOwzbZ56MSH r8e4iTKx/knnYM5K6jYMxWNFDHtbbdewtFwd/HJ3wc0EqBFb859qzx7cwmkp2Yr0Y7Op78 cPwKw5Vw7xKSLy08o+hzA7bZvzZOrNHQcgXwM5chdU5DTUnTh/36iRdbbxC7sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730470392; 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=9vtHx0bW4nkPtVoyzJPrliudfHm+g39K5AZIxA/+clk=; b=GBvbCbOTHRLPz+fwsaYantRS3p6esh2w8cP4//oCJVh4YPz18GM66DT+wnbXQzzUP6APdb yJFjQX3sjAKXDRgBVdkZjlZ36WTBswhxrAtmg3jFOgraNjJ5uibT9xIF8qO9ML9Lcyy7Kx FGw0Skqa7bdEa7f5PJAnDoygDjLv6ZEDm64EWFCpcfV9NLFKUWw/8yHdQG62iaCsrWXxYT 4TvNdfQBDDaCIQdJDI7Yy9Ai3zA8Z1oVR9t6YeqJf65zu9gHFOMD7PRZ/kB+Cxld8rcO33 YCgUmGJYLM+iWVyzjeB2gJ5bZ7INPXOtbjO4HrxxHwp1M6aBez3kCjyb8+RQ9A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730470392; a=rsa-sha256; cv=none; b=KcPMXQvHpD8bUqea21iba7PHp3dFjh7ZjogA2TI7+ym63ufBNiZWImiLKfcTE/JlJuQpO1 O8RDrwApKOLP2BFyNYha5XIsp90Fbq6V1HNCuUrj76Rff6BD2DXDc3e+YKrymRX9nhFce1 8l8rMZEOE9qjKaDc1Lt5d0TCQ2/BaBxGLuzwt6+GR/rNrFu/rO77AE07kutUybStjuorW/ CVzslRx/qTSFJEpdin8X2zcqNc0TT6ALuncFu9+7sHqin8GH8c9v/iieOElmWvhQqvIGfM x0VGSZ+IYeN/84amXTaiFh9/xFx/j+oMUJdE+cV5WKW+4XD+rB9bbWdp2cC7Bw== 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 4Xg2rm2XpZzNjL; Fri, 1 Nov 2024 14:13:12 +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 4A1EDCtP059878; Fri, 1 Nov 2024 14:13:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A1EDCI3059875; Fri, 1 Nov 2024 14:13:12 GMT (envelope-from git) Date: Fri, 1 Nov 2024 14:13:12 GMT Message-Id: <202411011413.4A1EDCI3059875@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: 84553ccd0c8b - main - spibus: 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: 84553ccd0c8b1fa5b3f0b5b70a42a244f26cea75 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=84553ccd0c8b1fa5b3f0b5b70a42a244f26cea75 commit 84553ccd0c8b1fa5b3f0b5b70a42a244f26cea75 Author: John Baldwin AuthorDate: 2024-11-01 14:10:19 +0000 Commit: John Baldwin CommitDate: 2024-11-01 14:10:19 +0000 spibus: Use a bus_child_deleted method to free ivars for children Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47373 --- sys/dev/spibus/acpi_spibus.c | 1 + sys/dev/spibus/ofw_spibus.c | 7 +++++++ sys/dev/spibus/spibus.c | 13 +++++++++++++ sys/dev/spibus/spibusvar.h | 1 + 4 files changed, 22 insertions(+) diff --git a/sys/dev/spibus/acpi_spibus.c b/sys/dev/spibus/acpi_spibus.c index 7241ad15bdab..9bce45b93dba 100644 --- a/sys/dev/spibus/acpi_spibus.c +++ b/sys/dev/spibus/acpi_spibus.c @@ -561,6 +561,7 @@ static device_method_t acpi_spibus_methods[] = { DEVMETHOD(bus_alloc_resource, acpi_spibus_alloc_resource), #endif DEVMETHOD(bus_add_child, acpi_spibus_add_child), + DEVMETHOD(bus_child_deleted, spibus_child_deleted), DEVMETHOD(bus_probe_nomatch, acpi_spibus_probe_nomatch), DEVMETHOD(bus_driver_added, acpi_spibus_driver_added), DEVMETHOD(bus_child_deleted, acpi_spibus_child_deleted), diff --git a/sys/dev/spibus/ofw_spibus.c b/sys/dev/spibus/ofw_spibus.c index 7fbff2f0c567..57a5f562c9b3 100644 --- a/sys/dev/spibus/ofw_spibus.c +++ b/sys/dev/spibus/ofw_spibus.c @@ -190,6 +190,12 @@ ofw_spibus_add_child(device_t dev, u_int order, const char *name, int unit) return (child); } +static void +ofw_spibus_child_deleted(device_t dev, device_t child) +{ + free(device_get_ivars(child), M_DEVBUF); +} + static const struct ofw_bus_devinfo * ofw_spibus_get_devinfo(device_t bus, device_t dev) { @@ -216,6 +222,7 @@ static device_method_t ofw_spibus_methods[] = { /* Bus interface */ DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo), DEVMETHOD(bus_add_child, ofw_spibus_add_child), + DEVMETHOD(bus_child_deleted, ofw_spibus_child_deleted), DEVMETHOD(bus_get_resource_list, ofw_spibus_get_resource_list), /* ofw_bus interface */ diff --git a/sys/dev/spibus/spibus.c b/sys/dev/spibus/spibus.c index 3db3c58b4ef1..03083cfafc04 100644 --- a/sys/dev/spibus/spibus.c +++ b/sys/dev/spibus/spibus.c @@ -198,6 +198,18 @@ spibus_add_child_common(device_t dev, u_int order, const char *name, int unit, return (child); } +void +spibus_child_deleted(device_t dev, device_t child) +{ + struct spibus_ivar *devi; + + devi = device_get_ivars(child); + if (devi == NULL) + return; + resource_list_free(&devi->rl); + free(devi, M_DEVBUF); +} + static device_t spibus_add_child(device_t dev, u_int order, const char *name, int unit) { @@ -262,6 +274,7 @@ static device_method_t spibus_methods[] = { DEVMETHOD(bus_get_resource_list, spibus_get_resource_list), DEVMETHOD(bus_add_child, spibus_add_child), + DEVMETHOD(bus_child_deleted, spibus_child_deleted), DEVMETHOD(bus_print_child, spibus_print_child), DEVMETHOD(bus_probe_nomatch, spibus_probe_nomatch), DEVMETHOD(bus_read_ivar, spibus_read_ivar), diff --git a/sys/dev/spibus/spibusvar.h b/sys/dev/spibus/spibusvar.h index 338bacd82dcf..6a74f9b1053d 100644 --- a/sys/dev/spibus/spibusvar.h +++ b/sys/dev/spibus/spibusvar.h @@ -79,6 +79,7 @@ extern driver_t ofw_spibus_driver; int spibus_attach(device_t); int spibus_detach(device_t); device_t spibus_add_child_common(device_t, u_int, const char *, int, size_t); +void spibus_child_deleted(device_t, device_t); void spibus_probe_nomatch(device_t, device_t); int spibus_child_location(device_t, device_t, struct sbuf *); int spibus_read_ivar(device_t, device_t, int, uintptr_t *);