CMDLINE: drivers: of: ifdef out cmdline section
Subsystems (2)
PATCH 2/5 CMDLINE: drivers: of: ifdef out cmdline section
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.
--- drivers/of/fdt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/of/fdt.c +12 -0
@@ -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 /* Retrieve command line */ p =of_get_flat_dt_prop (node,"bootargs" , &l); + +/* +* 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);
Signature · 1 line
2.25.1
Le 04/03/2021 à 05:47, Daniel Walker a écrit :
Quoted 28 lines
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.
Signed-off-by Ruslan Ruslichenko <[email protected]>Signed-off-by Daniel Walker <[email protected]>--- drivers/of/fdt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/of/fdt.c +1
-0@@ -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);
drivers/of/fdt.c int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, · line 1061
Quoted 10 lines
drivers/of/fdt.c +8
-0+#ifdef CONFIG_GENERIC_CMDLINE /* Retrieve command line */ p =of_get_flat_dt_prop (node,"bootargs" , &l); + +/* +* 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 */
Can we do more simple ? If p is NULL, p is already NULL, so (l > 0 ? p : NULL) should be enough.
drivers/of/fdt.c int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, · line 1063
Quoted 2 lines
drivers/of/fdt.c +2
-0+ COMMAND_LINE_SIZE); +#else
What does p contains now that "p = of_get_flat_dt_prop(node, "bootargs", &l);" is only called when CONFIG_GENERIC_CMDLINE is defined ?
Quoted 12 lines
drivers/of/fdt.c +1
-0if (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);
Quoted 32 lines · Christophe Leroy
Le 04/03/2021 à 05:47, Daniel Walker a écrit :
Quoted 29 lines
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.
Signed-off-by Ruslan Ruslichenko <[email protected]>Signed-off-by Daniel Walker <[email protected]>--- drivers/of/fdt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/of/fdt.c +3
-0@@ -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 /* Retrieve command line */ p =of_get_flat_dt_prop (node,"bootargs" , &l); +
Quoted 8 lines
drivers/of/fdt.c int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, · line 1061
Quoted 6 lines
drivers/of/fdt.c +6
-0+/* +* 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 */Can we do more simple ? If p is NULL, p is already NULL, so (l > 0 ? p : NULL) should be enough.
I believe Rob gave me this line. Maybe he can comment on it.
Daniel
Rob Herring
maintainerQuoted 44 lines · Daniel Walker
Quoted 32 lines · Christophe Leroy
Quoted 29 lines · Daniel Walker
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.
Signed-off-by Ruslan Ruslichenko <[email protected]>Signed-off-by Daniel Walker <[email protected]>--- drivers/of/fdt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/of/fdt.c +3
-0@@ -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 /* Retrieve command line */ p =of_get_flat_dt_prop (node,"bootargs" , &l); +Quoted 8 lines
drivers/of/fdt.c int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, · line 1061
Quoted 6 lines
drivers/of/fdt.c +6
-0+/* +* 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 */Can we do more simple ? If p is NULL, p is already NULL, so (l > 0 ? p : NULL) should be enough.
Quoted 1 line
I believe Rob gave me this line. Maybe he can comment on it.
It's an obvious improvement and LGTM.
Rob Herring
maintainerQuoted 26 lines · Daniel Walker
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.
Signed-off-by Ruslan Ruslichenko <[email protected]>Signed-off-by Daniel Walker <[email protected]>--- drivers/of/fdt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/of/fdt.c +1
-0@@ -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>
drivers/of/fdt.c int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, · line 1052
Quoted 4 lines
drivers/of/fdt.c +1
-0@@ -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.
drivers/of/fdt.c int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, · line 1054
Quoted 2 lines
drivers/of/fdt.c +0
-0/* Retrieve command line */ p =of_get_flat_dt_prop (node,"bootargs" , &l);
This needs to be outside the ifdef.
Quoted 23 lines
drivers/of/fdt.c +10
-1+ +/* +* 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
Quoted 30 lines · Rob Herring
Quoted 29 lines · Daniel Walker
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.
Signed-off-by Ruslan Ruslichenko <[email protected]>Signed-off-by Daniel Walker <[email protected]>--- drivers/of/fdt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/of/fdt.c +1
-0@@ -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);
Quoted 8 lines
drivers/of/fdt.c int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, · line 1052
Quoted 1 line
drivers/of/fdt.c +1
-0+#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.
I'm limited in what I can test, so I can't know for sure that I have something which works on those architectures. Even powerpc 64 is part of this series but I can't really test it at this time. Also Cisco's needs out strip the implementation of extend or override.
I have un-tested conversions for arm32, arm64, c6x, microblaze, nios2, and openrisc. These could go into -next and we can see who complains. The implementation on these architectures isn't all uniform.
Quoted 4 lines
drivers/of/fdt.c int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, · line 1054
Quoted 2 lines
drivers/of/fdt.c +0
-0/* Retrieve command line */ p =of_get_flat_dt_prop (node,"bootargs" , &l);This needs to be outside the ifdef.
Ok ..
Daniel