Re: [PATCH 2/5] CMDLINE: drivers: of: ifdef out cmdline section
From: Rob Herring <robh@kernel.org>
Date: 2021-03-04 14:34:28
Also in:
linux-devicetree, linux-mips, lkml
On Wed, Mar 3, 2021 at 10:48 PM Daniel Walker [off-list ref] wrote:
quoted hunk ↗ jump to hunk
It looks like there's some seepage of cmdline stuff into the generic device tree code. This conflicts with the generic cmdline implementation so I remove it in the case when that's enabled. Cc: xe-linux-external@cisco.com Signed-off-by: Ruslan Ruslichenko <redacted> Signed-off-by: Daniel Walker <redacted> --- drivers/of/fdt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index feb0f2d67fc5..cfe4f8d3c9f5 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c@@ -25,6 +25,7 @@ #include <linux/serial_core.h> #include <linux/sysfs.h> #include <linux/random.h> +#include <linux/cmdline.h> #include <asm/setup.h> /* for COMMAND_LINE_SIZE */ #include <asm/page.h>@@ -1048,8 +1049,18 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, early_init_dt_check_for_initrd(node); +#ifdef CONFIG_GENERIC_CMDLINE
What I like about Christophe's version is it removes the old DT implementation. Who's going to convert the rest of the DT based arches? That's arm, arm64, hexagon, microblaze, nios2, openrisc, riscv, sh, and xtensa. Either separate the common code from the config like Christophe's version or these all need converting. Though it's fine to hash out patch 1 with a couple of arches first.
/* Retrieve command line */
p = of_get_flat_dt_prop(node, "bootargs", &l);This needs to be outside the ifdef.
quoted hunk ↗ jump to hunk
+ + /* + * The builtin command line will be added here, or it can override + * with the DT bootargs. + */ + cmdline_add_builtin(data, + ((p != NULL && l > 0) ? p : NULL), /* This is sanity checking */ + COMMAND_LINE_SIZE); +#else if (p != NULL && l > 0) strlcpy(data, p, min(l, COMMAND_LINE_SIZE));@@ -1070,6 +1081,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); #endif #endif /* CONFIG_CMDLINE */ +#endif /* CONFIG_GENERIC_CMDLINE */ pr_debug("Command line is: %s\n", (char *)data); --2.25.1