mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Evgeniy Baskov <baskov@ispras.ru>
To: Borislav Petkov <bp@alien8.de>
Cc: Evgeniy Baskov <baskov@ispras.ru>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	Alexey Khoroshilov <khoroshilov@ispras.ru>
Subject: [PATCH v7 3/5] x86/setup: Use cmdline_prepare() in setup.c
Date: Tue,  4 Oct 2022 15:48:22 +0300	[thread overview]
Message-ID: <f696bdc92c849e62af83d5dfc53ea451caa71f9d.1664886978.git.baskov@ispras.ru> (raw)
In-Reply-To: <cover.1664886978.git.baskov@ispras.ru>

Use a common helper function for command line resolving in
arch/x86/kernel/setup.c for code unification.

Signed-off-by: Evgeniy Baskov <baskov@ispras.ru>
---
 arch/x86/kernel/setup.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 216fee7144ee..1acea005cad6 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -49,6 +49,7 @@
 #include <asm/pci-direct.h>
 #include <asm/prom.h>
 #include <asm/proto.h>
+#include <asm/shared/cmdline.h>
 #include <asm/thermal.h>
 #include <asm/unwind.h>
 #include <asm/vsyscall.h>
@@ -166,10 +167,7 @@ unsigned long saved_video_mode;
 #define RAMDISK_PROMPT_FLAG		0x8000
 #define RAMDISK_LOAD_FLAG		0x4000
 
-static char __initdata command_line[COMMAND_LINE_SIZE];
-#ifdef CONFIG_CMDLINE_BOOL
-static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
-#endif
+static char command_line[COMMAND_LINE_SIZE] __initdata = COMMAND_LINE_INIT;
 
 #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
 struct edd edd;
@@ -969,20 +967,8 @@ void __init setup_arch(char **cmdline_p)
 	bss_resource.start = __pa_symbol(__bss_start);
 	bss_resource.end = __pa_symbol(__bss_stop)-1;
 
-#ifdef CONFIG_CMDLINE_BOOL
-#ifdef CONFIG_CMDLINE_OVERRIDE
-	strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
-#else
-	if (builtin_cmdline[0]) {
-		/* append boot loader cmdline to builtin */
-		strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
-		strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
-		strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
-	}
-#endif
-#endif
-
-	strscpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
+	cmdline_prepare(command_line, boot_command_line);
+	strscpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
 	*cmdline_p = command_line;
 
 	/*
-- 
2.35.1


  parent reply	other threads:[~2022-10-04 12:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-04 12:48 [PATCH v7 0/5] Parse CONFIG_CMDLINE in compressed kernel Evgeniy Baskov
2022-10-04 12:48 ` [PATCH v7 1/5] x86/boot: Add strlcat() and strscpy() to " Evgeniy Baskov
2022-10-04 12:48 ` [PATCH v7 2/5] x86: Add cmdline_prepare() helper Evgeniy Baskov
2022-11-09 22:54   ` Borislav Petkov
2022-11-10  8:59     ` Evgeniy Baskov
2022-11-10 10:02       ` Borislav Petkov
2022-10-04 12:48 ` Evgeniy Baskov [this message]
2022-10-04 12:48 ` [PATCH v7 4/5] x86/boot: Use cmdline_prapare() in compressed kernel Evgeniy Baskov
2022-10-04 12:48 ` [PATCH v7 5/5] x86/boot: Remove no longer needed includes Evgeniy Baskov

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=f696bdc92c849e62af83d5dfc53ea451caa71f9d.1664886978.git.baskov@ispras.ru \
    --to=baskov@ispras.ru \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=khoroshilov@ispras.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®