Skip to content

Commit

Permalink
dt/flattree: explicitly pass command line pointer to early_init_dt_sc…
Browse files Browse the repository at this point in the history
…an_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 <[email protected]>
  • Loading branch information
glikely committed May 11, 2011
1 parent 693d92a commit 85f60ae
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion arch/microblaze/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void __init early_init_devtree(void *params)
* device-tree, including the platform type, initrd location and
* size, TCE reserve, and more ...
*/
of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line);

/* Scan memory nodes and rebuild MEMBLOCKs */
memblock_init();
Expand Down
3 changes: 0 additions & 3 deletions arch/mips/include/asm/prom.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
#ifdef CONFIG_OF
#include <asm/bootinfo.h>

/* which is compatible with the flattened device tree (FDT) */
#define cmd_line arcs_cmdline

extern int early_init_dt_scan_memory_arch(unsigned long node,
const char *uname, int depth, void *data);

Expand Down
3 changes: 2 additions & 1 deletion arch/mips/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ void __init early_init_devtree(void *params)
* device-tree, including the platform type, initrd location and
* size, and more ...
*/
of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
of_scan_flat_dt(early_init_dt_scan_chosen, arcs_cmdline);


/* Scan memory nodes */
of_scan_flat_dt(early_init_dt_scan_root, NULL);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ void __init early_init_devtree(void *params)
* device-tree, including the platform type, initrd location and
* size, TCE reserve, and more ...
*/
of_scan_flat_dt(early_init_dt_scan_chosen_ppc, NULL);
of_scan_flat_dt(early_init_dt_scan_chosen_ppc, cmd_line);

/* Scan memory nodes and rebuild MEMBLOCKs */
memblock_init();
Expand Down
8 changes: 4 additions & 4 deletions drivers/of/fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,

pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);

if (depth != 1 ||
if (depth != 1 || !data ||
(strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
return 0;

Expand All @@ -679,16 +679,16 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
/* Retrieve command line */
p = of_get_flat_dt_prop(node, "bootargs", &l);
if (p != NULL && l > 0)
strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));

#ifdef CONFIG_CMDLINE
#ifndef CONFIG_CMDLINE_FORCE
if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
#endif
strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
#endif /* CONFIG_CMDLINE */

pr_debug("Command line is: %s\n", cmd_line);
pr_debug("Command line is: %s\n", (char*)data);

/* break now */
return 1;
Expand Down

0 comments on commit 85f60ae

Please sign in to comment.