Commit 32c97689c46b272302053778f1a6c2facb0e220c

Authored by Grant Likely
1 parent 7096d04221

of/flattree: Eliminate need to provide early_init_dt_scan_chosen_arch

This patch refactors the early init parsing of the chosen node so that
architectures aren't forced to provide an empty implementation of
early_init_dt_scan_chosen_arch.  Instead, if an architecture wants to
do something different, it can either use a wrapper function around
early_init_dt_scan_chosen(), or it can replace it altogether.

This patch was written in preparation to adding device tree support to
both x86 ad MIPS.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: David Daney <ddaney@caviumnetworks.com>

Showing 4 changed files with 11 additions and 10 deletions Side-by-side Diff

arch/microblaze/kernel/prom.c
... ... @@ -42,11 +42,6 @@
42 42 #include <asm/sections.h>
43 43 #include <asm/pci-bridge.h>
44 44  
45   -void __init early_init_dt_scan_chosen_arch(unsigned long node)
46   -{
47   - /* No Microblaze specific code here */
48   -}
49   -
50 45 void __init early_init_dt_add_memory_arch(u64 base, u64 size)
51 46 {
52 47 memblock_add(base, size);
arch/powerpc/kernel/prom.c
... ... @@ -363,10 +363,15 @@
363 363 return 0;
364 364 }
365 365  
366   -void __init early_init_dt_scan_chosen_arch(unsigned long node)
  366 +int __init early_init_dt_scan_chosen_ppc(unsigned long node, const char *uname,
  367 + int depth, void *data)
367 368 {
368 369 unsigned long *lprop;
369 370  
  371 + /* Use common scan routine to determine if this is the chosen node */
  372 + if (early_init_dt_scan_chosen(node, uname, depth, data) == 0)
  373 + return 0;
  374 +
370 375 #ifdef CONFIG_PPC64
371 376 /* check if iommu is forced on or off */
372 377 if (of_get_flat_dt_prop(node, "linux,iommu-off", NULL) != NULL)
... ... @@ -398,6 +403,9 @@
398 403 if (lprop)
399 404 crashk_res.end = crashk_res.start + *lprop - 1;
400 405 #endif
  406 +
  407 + /* break now */
  408 + return 1;
401 409 }
402 410  
403 411 #ifdef CONFIG_PPC_PSERIES
... ... @@ -679,7 +687,7 @@
679 687 * device-tree, including the platform type, initrd location and
680 688 * size, TCE reserve, and more ...
681 689 */
682   - of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
  690 + of_scan_flat_dt(early_init_dt_scan_chosen_ppc, NULL);
683 691  
684 692 /* Scan memory nodes and rebuild MEMBLOCKs */
685 693 memblock_init();
... ... @@ -533,8 +533,6 @@
533 533 strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
534 534 #endif /* CONFIG_CMDLINE */
535 535  
536   - early_init_dt_scan_chosen_arch(node);
537   -
538 536 pr_debug("Command line is: %s\n", cmd_line);
539 537  
540 538 /* break now */
include/linux/of_fdt.h
... ... @@ -72,7 +72,7 @@
72 72 unsigned long *size);
73 73 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
74 74 extern unsigned long of_get_flat_dt_root(void);
75   -extern void early_init_dt_scan_chosen_arch(unsigned long node);
  75 +
76 76 extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
77 77 int depth, void *data);
78 78 extern void early_init_dt_check_for_initrd(unsigned long node);