diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/bus_if.m | 8 | ||||
-rw-r--r-- | sys/kern/subr_bus.c | 17 |
2 files changed, 18 insertions, 7 deletions
diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m index ef0f5e9eb65a..cf6470c220ef 100644 --- a/sys/kern/bus_if.m +++ b/sys/kern/bus_if.m @@ -77,12 +77,6 @@ CODE { return (0); } - static ssize_t - null_get_property(device_t dev, device_t child, const char *propname, - void *propvalue, size_t size) - { - return (-1); - } }; /** @@ -944,7 +938,7 @@ METHOD ssize_t get_property { const char *_propname; void *_propvalue; size_t _size; -} DEFAULT null_get_property; +} DEFAULT bus_generic_get_property; /** * @brief Gets a child's full path to the device diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 5e6cfa162f4c..8a05c28c96b1 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -4126,6 +4126,23 @@ bus_generic_write_ivar(device_t dev, device_t child, int index, } /** + * @brief Helper function for implementing BUS_GET_PROPERTY(). + * + * This simply calls the BUS_GET_PROPERTY of the parent of dev, + * until a non-default implementation is found. + */ +ssize_t +bus_generic_get_property(device_t dev, device_t child, const char *propname, + void *propvalue, size_t size) +{ + if (device_get_parent(dev) != NULL) + return (BUS_GET_PROPERTY(device_get_parent(dev), child, + propname, propvalue, size)); + + return (-1); +} + +/** * @brief Stub function for implementing BUS_GET_RESOURCE_LIST(). * * @returns NULL |