* [PATCH 1/3] MIPS: Always define builtin_cmdline
@ 2019-10-12 20:43 Paul Burton
2019-10-12 20:43 ` [PATCH 2/3] MIPS: Fix CONFIG_OF_EARLY_FLATTREE=n builds Paul Burton
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Paul Burton @ 2019-10-12 20:43 UTC (permalink / raw)
To: linux-mips; +Cc: Paul Burton, kbuild test robot, Nathan Chancellor
Commit 7784cac69735 ("MIPS: cmdline: Clean up boot_command_line
initialization") made use of builtin_cmdline conditional upon plain C if
statements rather than preprocessor #ifdef's. This caused build failures
for configurations with CONFIG_CMDLINE_BOOL=n where builtin_cmdline
wasn't defined, for example:
arch/mips/kernel/setup.c: In function 'bootcmdline_init':
>> arch/mips/kernel/setup.c:582:30: error: 'builtin_cmdline' undeclared
(first use in this function); did you mean 'builtin_driver'?
strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
^~~~~~~~~~~~~~~
builtin_driver
arch/mips/kernel/setup.c:582:30: note: each undeclared identifier is
reported only once for each function it appears in
Fix this by defining builtin_cmdline as an empty string in the affected
configurations. All of the paths that use it should be optimized out
anyway so the data itself gets optimized away too.
Signed-off-by: Paul Burton <paul.burton@mips.com>
Fixes: 7784cac69735 ("MIPS: cmdline: Clean up boot_command_line initialization")
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
---
arch/mips/kernel/setup.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 4aeba3122972..119999d31558 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -68,6 +68,8 @@ char __initdata arcs_cmdline[COMMAND_LINE_SIZE];
#ifdef CONFIG_CMDLINE_BOOL
static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
+#else
+static const char builtin_cmdline[] __initconst = "";
#endif
/*
--
2.23.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] MIPS: Fix CONFIG_OF_EARLY_FLATTREE=n builds
2019-10-12 20:43 [PATCH 1/3] MIPS: Always define builtin_cmdline Paul Burton
@ 2019-10-12 20:43 ` Paul Burton
2019-10-12 20:43 ` [PATCH 3/3] MIPS: Make builtin_cmdline const & variable length Paul Burton
2019-10-13 3:31 ` [PATCH 1/3] MIPS: Always define builtin_cmdline Paul Burton
2 siblings, 0 replies; 4+ messages in thread
From: Paul Burton @ 2019-10-12 20:43 UTC (permalink / raw)
To: linux-mips; +Cc: Paul Burton, kbuild test robot
Configurations with CONFIG_OF_EARLY_FLATTREE=n fail to build since
commit 7784cac69735 ("MIPS: cmdline: Clean up boot_command_line
initialization") because of_scan_flat_dt() & of_scan_flat_dt() are not
defined in these configurations. Fix this by #ifdef'ing the affected
code...
Signed-off-by: Paul Burton <paul.burton@mips.com>
Fixes: 7784cac69735 ("MIPS: cmdline: Clean up boot_command_line initialization")
Reported-by: kbuild test robot <lkp@intel.com>
---
arch/mips/kernel/setup.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 119999d31558..7ccc8a9e1bfe 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -551,6 +551,8 @@ static void __init bootcmdline_append(const char *s, size_t max)
strlcat(boot_command_line, s, max);
}
+#ifdef CONFIG_OF_EARLY_FLATTREE
+
static int __init bootcmdline_scan_chosen(unsigned long node, const char *uname,
int depth, void *data)
{
@@ -571,6 +573,8 @@ static int __init bootcmdline_scan_chosen(unsigned long node, const char *uname,
return 1;
}
+#endif /* CONFIG_OF_EARLY_FLATTREE */
+
static void __init bootcmdline_init(char **cmdline_p)
{
bool dt_bootargs = false;
@@ -597,12 +601,14 @@ static void __init bootcmdline_init(char **cmdline_p)
else
boot_command_line[0] = 0;
+#ifdef CONFIG_OF_EARLY_FLATTREE
/*
* If we're configured to take boot arguments from DT, look for those
* now.
*/
if (IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_DTB))
of_scan_flat_dt(bootcmdline_scan_chosen, &dt_bootargs);
+#endif
/*
* If we didn't get any arguments from DT (regardless of whether that's
--
2.23.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] MIPS: Make builtin_cmdline const & variable length
2019-10-12 20:43 [PATCH 1/3] MIPS: Always define builtin_cmdline Paul Burton
2019-10-12 20:43 ` [PATCH 2/3] MIPS: Fix CONFIG_OF_EARLY_FLATTREE=n builds Paul Burton
@ 2019-10-12 20:43 ` Paul Burton
2019-10-13 3:31 ` [PATCH 1/3] MIPS: Always define builtin_cmdline Paul Burton
2 siblings, 0 replies; 4+ messages in thread
From: Paul Burton @ 2019-10-12 20:43 UTC (permalink / raw)
To: linux-mips; +Cc: Paul Burton
We have no need for the builtin_cmdline array to be fixed at the length
of COMMAND_LINE_SIZE - we'll only copy out the string it contains up to
its NULL terminator anyway, and cap the size at COMMAND_LINE_SIZE when
copying into or concatenating with boot_command_line.
The string value is also constant, so we can declare it as such to place
it in the .init.rodata section.
Signed-off-by: Paul Burton <paul.burton@mips.com>
---
arch/mips/kernel/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 7ccc8a9e1bfe..2af05879772f 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -67,7 +67,7 @@ static char __initdata command_line[COMMAND_LINE_SIZE];
char __initdata arcs_cmdline[COMMAND_LINE_SIZE];
#ifdef CONFIG_CMDLINE_BOOL
-static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
+static const char builtin_cmdline[] __initconst = CONFIG_CMDLINE;
#else
static const char builtin_cmdline[] __initconst = "";
#endif
--
2.23.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] MIPS: Always define builtin_cmdline
2019-10-12 20:43 [PATCH 1/3] MIPS: Always define builtin_cmdline Paul Burton
2019-10-12 20:43 ` [PATCH 2/3] MIPS: Fix CONFIG_OF_EARLY_FLATTREE=n builds Paul Burton
2019-10-12 20:43 ` [PATCH 3/3] MIPS: Make builtin_cmdline const & variable length Paul Burton
@ 2019-10-13 3:31 ` Paul Burton
2 siblings, 0 replies; 4+ messages in thread
From: Paul Burton @ 2019-10-13 3:31 UTC (permalink / raw)
To: Paul Burton
Cc: linux-mips, Paul Burton, kbuild test robot, Nathan Chancellor,
linux-mips
Hello,
Paul Burton wrote:
> Commit 7784cac69735 ("MIPS: cmdline: Clean up boot_command_line
> initialization") made use of builtin_cmdline conditional upon plain C if
> statements rather than preprocessor #ifdef's. This caused build failures
> for configurations with CONFIG_CMDLINE_BOOL=n where builtin_cmdline
> wasn't defined, for example:
>
> arch/mips/kernel/setup.c: In function 'bootcmdline_init':
> >> arch/mips/kernel/setup.c:582:30: error: 'builtin_cmdline' undeclared
> (first use in this function); did you mean 'builtin_driver'?
> strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
> ^~~~~~~~~~~~~~~
> builtin_driver
> arch/mips/kernel/setup.c:582:30: note: each undeclared identifier is
> reported only once for each function it appears in
>
> Fix this by defining builtin_cmdline as an empty string in the affected
> configurations. All of the paths that use it should be optimized out
> anyway so the data itself gets optimized away too.
Series applied to mips-next.
> MIPS: Always define builtin_cmdline
> commit b7340422cc16
> https://git.kernel.org/mips/c/b7340422cc16
>
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Fixes: 7784cac69735 ("MIPS: cmdline: Clean up boot_command_line initialization")
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Nathan Chancellor <natechancellor@gmail.com>
>
> MIPS: Fix CONFIG_OF_EARLY_FLATTREE=n builds
> commit 972727766ee4
> https://git.kernel.org/mips/c/972727766ee4
>
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Fixes: 7784cac69735 ("MIPS: cmdline: Clean up boot_command_line initialization")
> Reported-by: kbuild test robot <lkp@intel.com>
>
> MIPS: Make builtin_cmdline const & variable length
> commit 9dd422f69777
> https://git.kernel.org/mips/c/9dd422f69777
>
> Signed-off-by: Paul Burton <paul.burton@mips.com>
Thanks,
Paul
[ This message was auto-generated; if you believe anything is incorrect
then please email paul.burton@mips.com to report it. ]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-13 3:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-12 20:43 [PATCH 1/3] MIPS: Always define builtin_cmdline Paul Burton
2019-10-12 20:43 ` [PATCH 2/3] MIPS: Fix CONFIG_OF_EARLY_FLATTREE=n builds Paul Burton
2019-10-12 20:43 ` [PATCH 3/3] MIPS: Make builtin_cmdline const & variable length Paul Burton
2019-10-13 3:31 ` [PATCH 1/3] MIPS: Always define builtin_cmdline Paul Burton
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).