Thread (22 messages) 22 messages, 4 authors, 2021-04-09

Re: [PATCH 2/8] CMDLINE: drivers: of: ifdef out cmdline section

From: Rob Herring <robh@kernel.org>
Date: 2021-03-30 19:50:30
Also in: linux-devicetree, linuxppc-dev, lkml

On Tue, Mar 30, 2021 at 12:57 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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index dcc1dd96911a..d8805cd9717a 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>
@@ -1050,6 +1051,18 @@ 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 defined(CONFIG_GENERIC_CMDLINE) && defined(CONFIG_GENERIC_CMDLINE_OF)
Moving in the wrong direction... This code already has too many
#ifdef's. I like Christophe's version as it gets rid of all the code
here.
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,
+                           (l > 0 ? p : NULL), /* This is sanity checking */
+                           COMMAND_LINE_SIZE);
+#elif defined(CONFIG_GENERIC_CMDLINE)
+       strlcpy(data, p, COMMAND_LINE_SIZE);
+#else
        if (p != NULL && l > 0)
                strlcpy(data, p, min(l, COMMAND_LINE_SIZE));
@@ -1070,6 +1083,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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help