diff mbox series

global_data.h: drop write-only field dm_root_f

Message ID 20240527200417.2108290-1-rasmus.villemoes@prevas.dk
State Accepted
Commit a8729a260b53b9a2fce2607ac90744a47f96daef
Delegated to: Simon Glass
Headers show
Series global_data.h: drop write-only field dm_root_f | expand

Commit Message

Rasmus Villemoes May 27, 2024, 8:04 p.m. UTC
The dm_root_f field seems to be entirely write-only and hence
redundant, unless 'git grep' fails to find some access generated via
preprocessor token concatenation or similar.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
 common/board_r.c                  | 3 +--
 include/asm-generic/global_data.h | 4 ----
 test/dm/core.c                    | 1 -
 3 files changed, 1 insertion(+), 7 deletions(-)

Comments

Simon Glass May 29, 2024, 4:29 p.m. UTC | #1
On Mon, 27 May 2024 at 14:04, Rasmus Villemoes
<rasmus.villemoes@prevas.dk> wrote:
>
> The dm_root_f field seems to be entirely write-only and hence
> redundant, unless 'git grep' fails to find some access generated via
> preprocessor token concatenation or similar.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> ---
>  common/board_r.c                  | 3 +--
>  include/asm-generic/global_data.h | 4 ----
>  test/dm/core.c                    | 1 -
>  3 files changed, 1 insertion(+), 7 deletions(-)
>

It is used for accessing the pre-relocation devices in case that is
useful / possible. But it seems that we haven't had many use cases, so
I am OK with dropping this and adding it back later if needed.

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

Regards,
Simon
Simon Glass July 15, 2024, 1:31 p.m. UTC | #2
On Mon, 27 May 2024 at 14:04, Rasmus Villemoes
<rasmus.villemoes@prevas.dk> wrote:
>
> The dm_root_f field seems to be entirely write-only and hence
> redundant, unless 'git grep' fails to find some access generated via
> preprocessor token concatenation or similar.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> ---
>  common/board_r.c                  | 3 +--
>  include/asm-generic/global_data.h | 4 ----
>  test/dm/core.c                    | 1 -
>  3 files changed, 1 insertion(+), 7 deletions(-)
>

It is used for accessing the pre-relocation devices in case that is
useful / possible. But it seems that we haven't had many use cases, so
I am OK with dropping this and adding it back later if needed.

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

Regards,
Simon

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

Patch

diff --git a/common/board_r.c b/common/board_r.c
index da0b80f24ff..fd263f4a0a8 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -230,8 +230,7 @@  static int initr_dm(void)
 
 	oftree_reset();
 
-	/* Save the pre-reloc driver model and start a new one */
-	gd->dm_root_f = gd->dm_root;
+	/* Drop the pre-reloc driver model and start a new one */
 	gd->dm_root = NULL;
 #ifdef CONFIG_TIMER
 	gd->timer = NULL;
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index fcc3c6e14ca..aa336d63e3a 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -195,10 +195,6 @@  struct global_data {
 	 * @dm_root: root instance for Driver Model
 	 */
 	struct udevice *dm_root;
-	/**
-	 * @dm_root_f: pre-relocation root instance
-	 */
-	struct udevice *dm_root_f;
 	/**
 	 * @uclass_root_s:
 	 * head of core tree when uclasses are not in read-only memory.
diff --git a/test/dm/core.c b/test/dm/core.c
index 7f3f8d183bc..34e5c163b98 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -1007,7 +1007,6 @@  static int dm_test_uclass_before_ready(struct unit_test_state *uts)
 	ut_assertok(uclass_get(UCLASS_TEST, &uc));
 
 	gd->dm_root = NULL;
-	gd->dm_root_f = NULL;
 	memset(&gd->uclass_root, '\0', sizeof(gd->uclass_root));
 
 	ut_asserteq_ptr(NULL, uclass_find(UCLASS_TEST));