summaryrefslogtreecommitdiff
path: root/include/dm
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-10-24 02:26:09 +0300
committerSimon Glass <sjg@chromium.org>2021-11-29 02:51:51 +0300
commit29fe555dec4c18096ab1ddd51398317160359ba1 (patch)
tree071caf2042aaadff4ebe4fb698a2aba4ba4d3b76 /include/dm
parent4b030177b6608bc6f2508e023089112e8adb2f4b (diff)
downloadu-boot-29fe555dec4c18096ab1ddd51398317160359ba1.tar.xz
dm: core: Add a way to count the devices in a uclass
Add a function that returns the number of devices in a uclass. This can be helpful in sizing an array that needs to hold a list of them. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm')
-rw-r--r--include/dm/uclass.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index aea2f34fce..f1fd2ba246 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -426,6 +426,14 @@ int uclass_first_device_drvdata(enum uclass_id id, ulong driver_data,
int uclass_probe_all(enum uclass_id id);
/**
+ * uclass_id_count() - Count the number of devices in a uclass
+ *
+ * @id: uclass ID to look up
+ * @return number of devices in that uclass (0 if none)
+ */
+int uclass_id_count(enum uclass_id id);
+
+/**
* uclass_id_foreach_dev() - Helper function to iteration through devices
*
* This creates a for() loop which works through the available devices in