aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-12-22 19:30:26 -0700
committerSimon Glass <sjg@chromium.org>2021-01-05 12:24:40 -0700
commit806473933adf52740864ab6cdab8c90a84c0b1f3 (patch)
tree8a4207534e0155a21c06de4ea5bc04fbcd8b0c9a /include
parentc238eeebc91f60e0240f9ab7dff245a4621c5d7a (diff)
downloadu-boot-806473933adf52740864ab6cdab8c90a84c0b1f3.zip
u-boot-806473933adf52740864ab6cdab8c90a84c0b1f3.tar.gz
u-boot-806473933adf52740864ab6cdab8c90a84c0b1f3.tar.bz2
dm: core: Add function to access uclass priv
Add functions so this information is not accessed directly. This will be needed for of-platdata which stores it in a different place. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/dm/uclass-internal.h14
-rw-r--r--include/dm/uclass.h8
2 files changed, 22 insertions, 0 deletions
diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h
index 3e052f9..c5a464b 100644
--- a/include/dm/uclass-internal.h
+++ b/include/dm/uclass-internal.h
@@ -12,6 +12,20 @@
#include <dm/ofnode.h>
/**
+ * uclass_set_priv() - Set the private data for a uclass
+ *
+ * This is normally handled by driver model, which automatically allocates
+ * private data when an 'auto' size if provided by the uclass driver.
+ *
+ * Use this function to override normal operation for special situations, such
+ * as needing to allocate a variable amount of data.
+ *
+ * @uc Uclass to update
+ * @priv New private-data pointer
+ */
+void uclass_set_priv(struct uclass *uc, void *priv);
+
+/**
* uclass_find_next_free_seq() - Get the next free sequence number
*
* This returns the next free sequence number. This is useful only if
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index fde08fe..20d4b9e 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -115,6 +115,14 @@ struct uclass_driver {
ll_entry_declare(struct uclass_driver, __name, uclass_driver)
/**
+ * uclass_get_priv() - Get the private data for a uclass
+ *
+ * @uc Uclass to check
+ * @return private data, or NULL if none
+ */
+void *uclass_get_priv(const struct uclass *uc);
+
+/**
* uclass_get() - Get a uclass based on an ID, creating it if needed
*
* Every uclass is identified by an ID, a number from 0 to n-1 where n is