diff mbox series

[v4,06/42] dm: core: Adjust uclass setup with of-platdata

Message ID 20210315172537.v4.6.I30dc7335f97a218b7a30b5ffa6a4d254e7266238@changeid
State Accepted
Commit 3fa9f553c0c0418b9abf93c2f33a44c98380beaf
Delegated to: Simon Glass
Headers show
Series dm: Implement OF_PLATDATA_INST in driver model (part E) | expand

Commit Message

Simon Glass March 15, 2021, 4:25 a.m. UTC
When OF_PLATDATA_INST is enabled we don't need to create the uclass list.
Instead we just need to point to the existing list. Update the code
accordingly.

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

(no changes since v1)

 drivers/core/root.c | 8 ++++++--
 include/dm/root.h   | 3 +++
 2 files changed, 9 insertions(+), 2 deletions(-)

Comments

Simon Glass March 17, 2021, 1:28 a.m. UTC | #1
When OF_PLATDATA_INST is enabled we don't need to create the uclass list.
Instead we just need to point to the existing list. Update the code
accordingly.

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

(no changes since v1)

 drivers/core/root.c | 8 ++++++--
 include/dm/root.h   | 3 +++
 2 files changed, 9 insertions(+), 2 deletions(-)

Applied to u-boot-dm/next, thanks!
diff mbox series

Patch

diff --git a/drivers/core/root.c b/drivers/core/root.c
index 9bc682cffea..3feadb77b56 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -140,8 +140,12 @@  int dm_init(bool of_live)
 		dm_warn("Virtual root driver already exists!\n");
 		return -EINVAL;
 	}
-	gd->uclass_root = &DM_UCLASS_ROOT_S_NON_CONST;
-	INIT_LIST_HEAD(DM_UCLASS_ROOT_NON_CONST);
+	if (CONFIG_IS_ENABLED(OF_PLATDATA_INST)) {
+		gd->uclass_root = &uclass_head;
+	} else {
+		gd->uclass_root = &DM_UCLASS_ROOT_S_NON_CONST;
+		INIT_LIST_HEAD(DM_UCLASS_ROOT_NON_CONST);
+	}
 
 	if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) {
 		fix_drivers();
diff --git a/include/dm/root.h b/include/dm/root.h
index 89afbee6196..42510b106ab 100644
--- a/include/dm/root.h
+++ b/include/dm/root.h
@@ -11,6 +11,9 @@ 
 
 struct udevice;
 
+/* Head of the uclass list if CONFIG_OF_PLATDATA_INST is enabled */
+extern struct list_head uclass_head;
+
 /**
  * dm_root() - Return pointer to the top of the driver tree
  *