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>
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 2aa2143..336ea8d 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -643,6 +643,19 @@
 	return device_probe(*devp);
 }
 
+int uclass_get_count(void)
+{
+	const struct uclass *uc;
+	int count = 0;
+
+	if (gd->dm_root) {
+		list_for_each_entry(uc, gd->uclass_root, sibling_node)
+			count++;
+	}
+
+	return count;
+}
+
 int uclass_first_device_drvdata(enum uclass_id id, ulong driver_data,
 				struct udevice **devp)
 {