aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2011-04-29 02:18:16 -0400
committerGrant Likely <grant.likely@secretlab.ca>2011-05-11 08:53:18 -0400
commit85f60ae4ee817174b0f78928bc7066f28c3551ab (patch)
tree826dac347531b88a8c7de2a1168626393eaceea1
parent693d92a1bbc9e42681c42ed190bd42b636ca876f (diff)
dt/flattree: explicitly pass command line pointer to early_init_dt_scan_chosen
This patch drops the reference to a global 'cmd_line' variable from early_init_dt_scan_chosen, and instead passes the pointer to the command line string via the *data argument. Each architecture does something slightly different with the initial command line, so it makes sense for the architecture to be able to specify the variable name. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r--arch/microblaze/kernel/prom.c2
-rw-r--r--arch/mips/include/asm/prom.h3
-rw-r--r--arch/mips/kernel/prom.c3
-rw-r--r--arch/powerpc/kernel/prom.c2
-rw-r--r--drivers/of/fdt.c8
5 files changed, 8 insertions, 10 deletions
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 00ee90f08343..b15cc219b1d9 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -130,7 +130,7 @@ void __init early_init_devtree(void *params)
130 * device-tree, including the platform type, initrd location and 130 * device-tree, including the platform type, initrd location and
131 * size, TCE reserve, and more ... 131 * size, TCE reserve, and more ...
132 */ 132 */
133 of_scan_flat_dt(early_init_dt_scan_chosen, NULL); 133 of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line);
134 134
135 /* Scan memory nodes and rebuild MEMBLOCKs */ 135 /* Scan memory nodes and rebuild MEMBLOCKs */
136 memblock_init(); 136 memblock_init();
diff --git a/arch/mips/include/asm/prom.h b/arch/mips/include/asm/prom.h
index f29b862d9db3..857d9b7858ad 100644
--- a/arch/mips/include/asm/prom.h
+++ b/arch/mips/include/asm/prom.h
@@ -14,9 +14,6 @@
14#ifdef CONFIG_OF 14#ifdef CONFIG_OF
15#include <asm/bootinfo.h> 15#include <asm/bootinfo.h>
16 16
17/* which is compatible with the flattened device tree (FDT) */
18#define cmd_line arcs_cmdline
19
20extern int early_init_dt_scan_memory_arch(unsigned long node, 17extern int early_init_dt_scan_memory_arch(unsigned long node,
21 const char *uname, int depth, void *data); 18 const char *uname, int depth, void *data);
22 19
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
index a19811e98a41..5b7eade41fa3 100644
--- a/arch/mips/kernel/prom.c
+++ b/arch/mips/kernel/prom.c
@@ -83,7 +83,8 @@ void __init early_init_devtree(void *params)
83 * device-tree, including the platform type, initrd location and 83 * device-tree, including the platform type, initrd location and
84 * size, and more ... 84 * size, and more ...
85 */ 85 */
86 of_scan_flat_dt(early_init_dt_scan_chosen, NULL); 86 of_scan_flat_dt(early_init_dt_scan_chosen, arcs_cmdline);
87
87 88
88 /* Scan memory nodes */ 89 /* Scan memory nodes */
89 of_scan_flat_dt(early_init_dt_scan_root, NULL); 90 of_scan_flat_dt(early_init_dt_scan_root, NULL);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index e74fa12afc82..c173bee09cee 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -691,7 +691,7 @@ void __init early_init_devtree(void *params)
691 * device-tree, including the platform type, initrd location and 691 * device-tree, including the platform type, initrd location and
692 * size, TCE reserve, and more ... 692 * size, TCE reserve, and more ...
693 */ 693 */
694 of_scan_flat_dt(early_init_dt_scan_chosen_ppc, NULL); 694 of_scan_flat_dt(early_init_dt_scan_chosen_ppc, cmd_line);
695 695
696 /* Scan memory nodes and rebuild MEMBLOCKs */ 696 /* Scan memory nodes and rebuild MEMBLOCKs */
697 memblock_init(); 697 memblock_init();
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 8b63a691a9ed..65200af29c52 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -670,7 +670,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
670 670
671 pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname); 671 pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
672 672
673 if (depth != 1 || 673 if (depth != 1 || !data ||
674 (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) 674 (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
675 return 0; 675 return 0;
676 676
@@ -679,16 +679,16 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
679 /* Retrieve command line */ 679 /* Retrieve command line */
680 p = of_get_flat_dt_prop(node, "bootargs", &l); 680 p = of_get_flat_dt_prop(node, "bootargs", &l);
681 if (p != NULL && l > 0) 681 if (p != NULL && l > 0)
682 strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE)); 682 strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
683 683
684#ifdef CONFIG_CMDLINE 684#ifdef CONFIG_CMDLINE
685#ifndef CONFIG_CMDLINE_FORCE 685#ifndef CONFIG_CMDLINE_FORCE
686 if (p == NULL || l == 0 || (l == 1 && (*p) == 0)) 686 if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
687#endif 687#endif
688 strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); 688 strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
689#endif /* CONFIG_CMDLINE */ 689#endif /* CONFIG_CMDLINE */
690 690
691 pr_debug("Command line is: %s\n", cmd_line); 691 pr_debug("Command line is: %s\n", (char*)data);
692 692
693 /* break now */ 693 /* break now */
694 return 1; 694 return 1;