git: 8e4535ee5870 - main - stand/kshim: Implement bus_detach_children
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 11 Jan 2025 04:03:51 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8e4535ee5870b76f97f6d33a05e9979dcb75c185 commit 8e4535ee5870b76f97f6d33a05e9979dcb75c185 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2025-01-11 04:02:27 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2025-01-11 04:03:32 +0000 stand/kshim: Implement bus_detach_children While here, update bus_generic_detach to delete devices as in the kernel. Reviewed by: imp, markj Differential Revision: https://reviews.freebsd.org/D48410 --- stand/kshim/bsd_kernel.c | 13 ++++++++++++- stand/kshim/bsd_kernel.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/stand/kshim/bsd_kernel.c b/stand/kshim/bsd_kernel.c index 78b6f9e0b4d4..371aaa6e96bf 100644 --- a/stand/kshim/bsd_kernel.c +++ b/stand/kshim/bsd_kernel.c @@ -664,7 +664,7 @@ device_get_unit(device_t dev) } int -bus_generic_detach(device_t dev) +bus_detach_children(device_t dev) { device_t child; int error; @@ -679,6 +679,17 @@ bus_generic_detach(device_t dev) return (0); } +int +bus_generic_detach(device_t dev) +{ + int error; + + error = bus_detach_children(dev); + if (error == 0) + error = device_delete_children(dev); + return (error); +} + const char * device_get_nameunit(device_t dev) { diff --git a/stand/kshim/bsd_kernel.h b/stand/kshim/bsd_kernel.h index 8600bd1f31dc..25a779d5ea0c 100644 --- a/stand/kshim/bsd_kernel.h +++ b/stand/kshim/bsd_kernel.h @@ -650,6 +650,7 @@ void bus_release_resources(device_t, const struct resource_spec *, struct resource **); struct resource *bus_alloc_resource_any(device_t, int, int *, unsigned int); void bus_attach_children(device_t); +int bus_detach_children(device_t); bus_space_tag_t rman_get_bustag(struct resource *); bus_space_handle_t rman_get_bushandle(struct resource *); u_long rman_get_size(struct resource *);