diff options
Diffstat (limited to 'sys/kern/subr_bus.c')
| -rw-r--r-- | sys/kern/subr_bus.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index bf5bda7e058d..755d7d41899f 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -1858,6 +1858,10 @@ device_get_children(device_t dev, device_t **devlistp, int *devcountp) TAILQ_FOREACH(child, &dev->children, link) { count++; } + if (devlistp == NULL) { + *devcountp = count; + return (0); + } if (count == 0) { *devlistp = NULL; *devcountp = 0; @@ -1881,6 +1885,20 @@ device_get_children(device_t dev, device_t **devlistp, int *devcountp) } /** + * @brief Check if a device has children + * + * @param dev the device to examine + * + * @rerval true the device has at least one child + * @retval false the device has no children + */ +bool +device_has_children(device_t dev) +{ + return (!TAILQ_EMPTY(&dev->children)); +} + +/** * @brief Return the current driver for the device or @c NULL if there * is no driver currently attached */ @@ -4633,7 +4651,7 @@ bus_release_resources(device_t dev, const struct resource_spec *rs, * parent of @p dev. */ struct resource * -bus_alloc_resource(device_t dev, int type, int *rid, rman_res_t start, +(bus_alloc_resource)(device_t dev, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *res; |
