Skip to content

Commit 4972a74

Browse files
labbottglikely
authored andcommitted
of: Split early_init_dt_scan into two parts
Currently, early_init_dt_scan validates the header, sets the boot params, and scans for chosen/memory all in one function. Split this up into two separate functions (validation/setting boot params in one, scanning in another) to allow for additional setup between boot params and scanning the memory. Signed-off-by: Laura Abbott <[email protected]> Tested-by: Andreas Färber <[email protected]> [glikely: s/early_init_dt_scan_all/early_init_dt_scan_nodes/] Signed-off-by: Grant Likely <[email protected]>
1 parent 64aa90f commit 4972a74

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

drivers/of/fdt.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base,
937937
}
938938
#endif
939939

940-
bool __init early_init_dt_scan(void *params)
940+
bool __init early_init_dt_verify(void *params)
941941
{
942942
if (!params)
943943
return false;
@@ -951,6 +951,12 @@ bool __init early_init_dt_scan(void *params)
951951
return false;
952952
}
953953

954+
return true;
955+
}
956+
957+
958+
void __init early_init_dt_scan_nodes(void)
959+
{
954960
/* Retrieve various information from the /chosen node */
955961
of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
956962

@@ -959,7 +965,17 @@ bool __init early_init_dt_scan(void *params)
959965

960966
/* Setup memory, calling early_init_dt_add_memory_arch */
961967
of_scan_flat_dt(early_init_dt_scan_memory, NULL);
968+
}
969+
970+
bool __init early_init_dt_scan(void *params)
971+
{
972+
bool status;
973+
974+
status = early_init_dt_verify(params);
975+
if (!status)
976+
return false;
962977

978+
early_init_dt_scan_nodes();
963979
return true;
964980
}
965981

include/linux/of_fdt.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname,
7373
int depth, void *data);
7474

7575
extern bool early_init_dt_scan(void *params);
76+
extern bool early_init_dt_verify(void *params);
77+
extern void early_init_dt_scan_nodes(void);
7678

7779
extern const char *of_flat_dt_get_machine_name(void);
7880
extern const void *of_flat_dt_match_machine(const void *default_match,

0 commit comments

Comments
 (0)