Skip to content

Commit

Permalink
stand/kshim: Implement bus_detach_children
Browse files Browse the repository at this point in the history
While here, update bus_generic_detach to delete devices as in the
kernel.

Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D48410
  • Loading branch information
bsdjhb committed Jan 11, 2025
1 parent ee15875 commit 8e4535e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion stand/kshim/bsd_kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions stand/kshim/bsd_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down

0 comments on commit 8e4535e

Please sign in to comment.