dm: core: Allow the uclass list to move

At present the uclass list head is in global_data. This is convenient
but with the new of-platdata we need the list head to be declared by
the generated code.

Change this over to be a pointer. Provide a 'static' version in
global_data to retain the current behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2020-12-19 10:40:17 -07:00
parent 49bbe6eab5
commit 8a715530bb
6 changed files with 19 additions and 11 deletions

View File

@@ -45,8 +45,8 @@ void dm_fixup_for_gd_move(struct global_data *new_gd)
{
/* The sentinel node has moved, so update things that point to it */
if (gd->dm_root) {
new_gd->uclass_root.next->prev = &new_gd->uclass_root;
new_gd->uclass_root.prev->next = &new_gd->uclass_root;
new_gd->uclass_root->next->prev = new_gd->uclass_root;
new_gd->uclass_root->prev->next = new_gd->uclass_root;
}
}
@@ -136,7 +136,8 @@ int dm_init(bool of_live)
dm_warn("Virtual root driver already exists!\n");
return -EINVAL;
}
INIT_LIST_HEAD(&DM_UCLASS_ROOT_NON_CONST);
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();