From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Daniel Walker <danielwa@cisco.com>, Will Deacon <will@kernel.org>,
ob Herring <robh@kernel.org>,
Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>,
Andrew Morton <akpm@linux-foundation.org>,
x86@kernel.org, linux-mips@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, Rob Herring <robh+dt@kernel.org>,
Frank Rowand <frowand.list@gmail.com>
Cc: devicetree@vger.kernel.org,
Ruslan Ruslichenko <rruslich@cisco.com>,
linux-kernel@vger.kernel.org, xe-linux-external@cisco.com
Subject: Re: [PATCH 2/8] CMDLINE: drivers: of: ifdef out cmdline section
Date: Fri, 2 Apr 2021 19:32:08 +0200 [thread overview]
Message-ID: <6d50809a-eb6b-b8bb-bb8b-88f66c52c0fa@csgroup.eu> (raw)
In-Reply-To: <0c4b839f023f87c451c8aa3c4f7a8d92729c2f02.1617126961.git.danielwa@cisco.com>
Le 30/03/2021 à 19:56, Daniel Walker a écrit :
> 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 <rruslich@cisco.com>
> Signed-off-by: Daniel Walker <danielwa@cisco.com>
> ---
> 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)
> + /*
> + * 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
Ugly.
Linux codying style recommend to limit the use of #ifdefs to headers as much as possible.
Why do we need so many alternatives ? Allthough they are temporary, can we order the changes in
another way to reduce that ?
> 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);
>
>
next prev parent reply other threads:[~2021-04-02 17:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-30 17:56 [PATCH 1/8] CMDLINE: add generic builtin command line Daniel Walker
2021-03-30 17:56 ` [PATCH 2/8] CMDLINE: drivers: of: ifdef out cmdline section Daniel Walker
2021-03-30 19:49 ` Rob Herring
2021-03-30 23:17 ` Daniel Walker
2021-04-07 22:59 ` Rob Herring
2021-04-09 1:26 ` Daniel Walker
2021-04-02 17:32 ` Christophe Leroy [this message]
2021-04-06 16:35 ` Daniel Walker
2021-03-30 17:56 ` [PATCH 3/8] powerpc: convert strcpy to strlcpy in prom_init Daniel Walker
2021-04-02 17:32 ` Christophe Leroy
2021-03-30 17:56 ` [PATCH 4/8] CMDLINE: powerpc: convert to generic builtin command line Daniel Walker
2021-04-02 17:34 ` Christophe Leroy
2021-04-06 16:38 ` Daniel Walker
2021-03-30 17:57 ` [PATCH 5/8] CMDLINE: mips: " Daniel Walker
2021-03-30 17:57 ` [PATCH 6/8] drivers: firmware: efi: libstub: enable generic commandline Daniel Walker
2021-03-31 16:10 ` Ard Biesheuvel
2021-03-31 18:21 ` Daniel Walker
2021-04-02 17:36 ` Christophe Leroy
2021-04-06 16:42 ` Daniel Walker
2021-03-30 17:57 ` [PATCH 7/8] CMDLINE: x86: convert to generic builtin command line Daniel Walker
2021-03-30 17:57 ` [PATCH 8/8] CMDLINE: arm64: " Daniel Walker
2021-04-02 17:28 ` [PATCH 1/8] CMDLINE: add " Christophe Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6d50809a-eb6b-b8bb-bb8b-88f66c52c0fa@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=akpm@linux-foundation.org \
--cc=daniel@gimpelevich.san-francisco.ca.us \
--cc=danielwa@cisco.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=robh+dt@kernel.org \
--cc=robh@kernel.org \
--cc=rruslich@cisco.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
--cc=xe-linux-external@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).