aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-09-19 14:50:15 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-09-20 02:09:34 -0400
commit78b782cb788cadbda151ecb61753c109602a250c (patch)
tree4d4e4f435674ab5aaea1a0fa175b9e39b5601272 /drivers/of
parent55190f88789ab62a42c3ee050090406b0bcefff8 (diff)
of: Change logic to overwrite cmd_line with CONFIG_CMDLINE
We used to overwrite with CONFIG_CMDLINE if we found a chosen node but failed to get bootargs out of it or they were empty, unless CONFIG_CMDLINE_FORCE is set. Instead change that to overwrite if "data" is non empty after the bootargs check. It allows arch code to have other mechanisms to retrieve the command line prior to parsing the device-tree. Note: CONFIG_CMDLINE_FORCE case should ideally be handled elsewhere as it won't work as it-is if the device-tree has no /chosen node Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: devicetree-discuss@lists-ozlabs.org CC: Grant Likely <grant.likely@secretlab.ca> Acked-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/fdt.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 65200af29c52..4af69a3564cc 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -681,9 +681,14 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
681 if (p != NULL && l > 0) 681 if (p != NULL && l > 0)
682 strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); 682 strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
683 683
684 /*
685 * CONFIG_CMDLINE is meant to be a default in case nothing else
686 * managed to set the command line, unless CONFIG_CMDLINE_FORCE
687 * is set in which case we override whatever was found earlier.
688 */
684#ifdef CONFIG_CMDLINE 689#ifdef CONFIG_CMDLINE
685#ifndef CONFIG_CMDLINE_FORCE 690#ifndef CONFIG_CMDLINE_FORCE
686 if (p == NULL || l == 0 || (l == 1 && (*p) == 0)) 691 if (!((char *)data)[0])
687#endif 692#endif
688 strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); 693 strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
689#endif /* CONFIG_CMDLINE */ 694#endif /* CONFIG_CMDLINE */