[RFC PATCH 05/15] dm: Add struct uclass_member for uclass membership

Simon Glass sjg at chromium.org
Thu Mar 19 22:35:35 CET 2026


We want to support linking a device into a secondary uclass. Add a new
struct hold the require information.

For now this struct is not actually used.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 include/dm/device.h | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/include/dm/device.h b/include/dm/device.h
index 5302cb1f7f0..6d9528807cc 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -115,6 +115,40 @@ enum {
 	DM_REMOVE_NO_PD		= 1 << 1,
 };
 
+/**
+ * struct uclass_member - a device's membership in a uclass
+ *
+ * This holds the information needed to link a device into a uclass. Every
+ * device has one of these embedded in struct udevice for its primary uclass.
+ * When DM_UC_ADJUNCT is enabled, additional instances can be allocated to
+ * register a device in further uclasses (adjuncts).
+ *
+ * This struct should not be used outside core driver-model code and tests.
+ * Use accessor functions instead.
+ *
+ * @uc: Pointer to the uclass
+ * @uc_node: Node in the uclass's device list
+ * @uc_priv: Per-device private data owned by the uclass
+ * @uc_plat: Per-device platform data owned by the uclass
+ * @seq: Sequence number within this uclass (-1 = none)
+ * @ops: Ops provided by this device for the uclass
+ * @dev: Owning device (adjuncts only; for the primary uclass use
+ *	container_of)
+ * @adj_node: Node in the device's list of adjuncts
+ */
+struct uclass_member {
+	struct uclass *uc;
+	struct list_head uc_node;
+	void *uc_priv;
+	void *uc_plat;
+	int seq;
+	const void *ops;
+#if CONFIG_IS_ENABLED(DM_UC_ADJUNCT)
+	struct udevice *dev;
+	struct list_head adj_node;
+#endif
+};
+
 /**
  * struct udevice - An instance of a driver
  *
-- 
2.43.0



More information about the U-Boot mailing list