* [PATCH v6] LoongArch: Fix CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER on non-FDT systems
@ 2023-07-20 11:43 Dong Zhihong
2023-07-21 10:37 ` Markus Elfring
0 siblings, 1 reply; 2+ messages in thread
From: Dong Zhihong @ 2023-07-20 11:43 UTC (permalink / raw)
To: chenhuacai, kernel
Cc: ardb, tangyouling, zhoubinbin, yangtiezhu, donmor3000, tglx,
loongarch, linux-kernel
On FDT systems these command line processing are already taken care of
by early_init_dt_scan_chosen(). Add similar handling to the non-FDT
code path to allow these config options to work for non-FDT boxes too.
Signed-off-by: Dong Zhihong <donmor3000@hotmail.com>
---
v5 -> v6: Update commit message (Xuerui)
v4 -> v5: Update commit message and adjust the code logic (Huacai)
v3 -> v4: Make CONFIG_CMDLINE appended to the end of command line (Huacai);
Removed unnecessary #ifdef since CONFIG_CMDLINE is always a string on
LoongArch
Reworded comments
Reworded the subject of commit message (Huacai)
v2 -> v3: Reworded the commit message again to make it imperative (Ruoyao)
v1 -> v2: Reworded the commit message so it's more imperative (Markus);
Added `goto out` to FDT part (Huacai)
arch/loongarch/kernel/setup.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
index 78a00359bde3..49cb8e06f9e5 100644
--- a/arch/loongarch/kernel/setup.c
+++ b/arch/loongarch/kernel/setup.c
@@ -332,9 +332,25 @@ static void __init bootcmdline_init(char **cmdline_p)
strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
strlcat(boot_command_line, init_command_line, COMMAND_LINE_SIZE);
+ goto out;
}
#endif
+ /*
+ * Append built-in command to the retrieved one if
+ * CONFIG_CMDLINE_EXTEND is enabled.
+ */
+ if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) && CONFIG_CMDLINE[0]) {
+ strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
+ strlcat(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+ }
+
+ /*
+ * Use built-in command line if nothing is retrieved from boot loader.
+ */
+ if (IS_ENABLED(CONFIG_CMDLINE_BOOTLOADER) && !boot_command_line[0])
+ strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+
out:
*cmdline_p = boot_command_line;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v6] LoongArch: Fix CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER on non-FDT systems
2023-07-20 11:43 [PATCH v6] LoongArch: Fix CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER on non-FDT systems Dong Zhihong
@ 2023-07-21 10:37 ` Markus Elfring
0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2023-07-21 10:37 UTC (permalink / raw)
To: Dong Zhihong, loongarch, kernel-janitors, Ard Biesheuvel,
Binbin Zhou, Huacai Chen, Thomas Gleixner, Tiezhu Yang,
Wang Xuerui, Youling Tang
Cc: LKML
> On FDT systems these command line processing are already taken care of
…
Does this description approach contain still another wording weakness?
Regards,
Markus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-21 10:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-20 11:43 [PATCH v6] LoongArch: Fix CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER on non-FDT systems Dong Zhihong
2023-07-21 10:37 ` Markus Elfring
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.