Merge branch 'dt/linus' into dt/next
authorRob Herring <robh@kernel.org>
Wed, 12 Jan 2022 16:14:09 +0000 (10:14 -0600)
committerRob Herring <robh@kernel.org>
Wed, 12 Jan 2022 16:14:09 +0000 (10:14 -0600)
Pick a fix which didn't make it into v5.16.

1  2 
drivers/of/fdt.c
include/linux/of_fdt.h

@@@ -1130,22 -1130,23 +1136,23 @@@ int __init early_init_dt_scan_memory(vo
        return 0;
  }
  
 -int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
 -                                   int depth, void *data)
 +int __init early_init_dt_scan_chosen(char *cmdline)
  {
 -      int l;
 +      int l, node;
        const char *p;
        const void *rng_seed;
 +      const void *fdt = initial_boot_params;
  
 -      pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
 -
 -      if (depth != 1 || !data ||
 -          (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
 -              return 0;
 +      node = fdt_path_offset(fdt, "/chosen");
 +      if (node < 0)
 +              node = fdt_path_offset(fdt, "/chosen@0");
 +      if (node < 0)
 +              return -ENOENT;
  
+       chosen_node_offset = node;
        early_init_dt_check_for_initrd(node);
        early_init_dt_check_for_elfcorehdr(node);
-       early_init_dt_check_for_usable_mem_range(node);
  
        /* Retrieve command line */
        p = of_get_flat_dt_prop(node, "bootargs", &l);
@@@ -1277,10 -1279,10 +1284,10 @@@ void __init early_init_dt_scan_nodes(vo
                pr_warn("No chosen node found, continuing without\n");
  
        /* Setup memory, calling early_init_dt_add_memory_arch */
 -      of_scan_flat_dt(early_init_dt_scan_memory, NULL);
 +      early_init_dt_scan_memory();
  
        /* Handle linux,usable-memory-range property */
-       memblock_cap_memory_range(cap_mem_addr, cap_mem_size);
+       early_init_dt_check_for_usable_mem_range();
  }
  
  bool __init early_init_dt_scan(void *params)
@@@ -58,8 -58,11 +58,9 @@@ extern int of_flat_dt_is_compatible(uns
  extern unsigned long of_get_flat_dt_root(void);
  extern uint32_t of_get_flat_dt_phandle(unsigned long node);
  
 -extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
 -                                   int depth, void *data);
 -extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
 -                                   int depth, void *data);
 +extern int early_init_dt_scan_chosen(char *cmdline);
 +extern int early_init_dt_scan_memory(void);
+ extern void early_init_dt_check_for_usable_mem_range(void);
  extern int early_init_dt_scan_chosen_stdout(void);
  extern void early_init_fdt_scan_reserved_mem(void);
  extern void early_init_fdt_reserve_self(void);