diff options
author | Simon Glass <sjg@chromium.org> | 2021-12-17 06:59:32 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-12-23 18:24:40 +0300 |
commit | 6476c4d9818beac88610f18ff3c3cb05c7a1f33b (patch) | |
tree | 90bbf1c2bbaa910806e695a472bc52000056721d /include | |
parent | 985503439762c3168aeb80f529bb9bbcd773dd2c (diff) | |
download | u-boot-6476c4d9818beac88610f18ff3c3cb05c7a1f33b.tar.xz |
dm: core: Allow getting some basic stats
Add a function that returns some basic stats about driver model. For now
we only have two.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/dm/device.h | 11 | ||||
-rw-r--r-- | include/dm/root.h | 8 | ||||
-rw-r--r-- | include/dm/uclass-internal.h | 7 |
3 files changed, 25 insertions, 1 deletions
diff --git a/include/dm/device.h b/include/dm/device.h index 544734ecb3..cf785f7ae2 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -593,7 +593,7 @@ int device_get_child(const struct udevice *parent, int index, struct udevice **devp); /** - * device_get_child_count() - Get the available child count of a device + * device_get_child_count() - Get the child count of a device * * Returns the number of children to a device. * @@ -602,6 +602,15 @@ int device_get_child(const struct udevice *parent, int index, int device_get_child_count(const struct udevice *parent); /** + * device_get_decendent_count() - Get the total number of decendents of a device + * + * Returns the total number of decendents, including all children + * + * @parent: Parent device to check + */ +int device_get_decendent_count(const struct udevice *parent); + +/** * device_find_child_by_seq() - Find a child device based on a sequence * * This searches for a device with the given seq. diff --git a/include/dm/root.h b/include/dm/root.h index 42510b106a..780f269db6 100644 --- a/include/dm/root.h +++ b/include/dm/root.h @@ -131,4 +131,12 @@ int dm_remove_devices_flags(uint flags); static inline int dm_remove_devices_flags(uint flags) { return 0; } #endif +/** + * dm_get_stats() - Get some stats for driver mode + * + * @device_countp: Returns total number of devices that are bound + * @uclass_countp: Returns total number of uclasses in use + */ +void dm_get_stats(int *device_countp, int *uclass_countp); + #endif diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h index 49808c5c85..fb0edcc296 100644 --- a/include/dm/uclass-internal.h +++ b/include/dm/uclass-internal.h @@ -307,6 +307,13 @@ static inline int uclass_pre_remove_device(struct udevice *dev) { return 0; } #endif /** + * uclass_get_count() - Get the number of uclasses + * + * Returns the number of uclasses instantiated in driver model + */ +int uclass_get_count(void); + +/** * uclass_find() - Find uclass by its id * * @id: Id to serach for |