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>
This commit is contained in:
Simon Glass
2021-12-16 20:59:32 -07:00
committed by Tom Rini
parent 9855034397
commit 6476c4d981
7 changed files with 97 additions and 1 deletions

View File

@@ -26,6 +26,7 @@
#include <dm/read.h>
#include <dm/root.h>
#include <dm/uclass.h>
#include <dm/uclass-internal.h>
#include <dm/util.h>
#include <linux/list.h>
@@ -407,6 +408,12 @@ int dm_init_and_scan(bool pre_reloc_only)
return 0;
}
void dm_get_stats(int *device_countp, int *uclass_countp)
{
*device_countp = device_get_decendent_count(gd->dm_root);
*uclass_countp = uclass_get_count();
}
#ifdef CONFIG_ACPIGEN
static int root_acpi_get_name(const struct udevice *dev, char *out_name)
{