[PATCH 2/5] x86/boot: Move get_cmd_line_ptr() and COMMAND_LINE_SIZE into misc.h

Arvind Sankar
2020-10-07T19:54:03Z

Move get_cmd_line_ptr() and COMMAND_LINE_SIZE into misc.h for easier
use from multiple files.

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
---
arch/x86/boot/compressed/cmdline.c | 8 --------
arch/x86/boot/compressed/kaslr.c | 6 ------
arch/x86/boot/compressed/misc.h | 13 +++++++++++++
3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/arch/x86/boot/compressed/cmdline.c b/arch/x86/boot/compressed/cmdline.c
index f1add5d85da9..d0e1d386749d 100644
--- a/arch/x86/boot/compressed/cmdline.c
+++ b/arch/x86/boot/compressed/cmdline.c
@@ -12,14 +12,6 @@ static inline char rdfs8(addr_t addr)
return *((char *)(fs + addr));
}
#include "../cmdline.c"
-unsigned long get_cmd_line_ptr(void)
-{
- unsigned long cmd_line_ptr = boot_params->hdr.cmd_line_ptr;
-
- cmd_line_ptr |= (u64)boot_params->ext_cmd_line_ptr << 32;
-
- return cmd_line_ptr;
-}
int cmdline_find_option(const char *option, char *buffer, int bufsize)
{
return __cmdline_find_option(get_cmd_line_ptr(), option, buffer, bufsize);
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index b59547ce5b19..f3286a3bef36 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -36,12 +36,6 @@
#define STATIC
#include <linux/decompress/mm.h>

-#define _SETUP
-#include <asm/setup.h> /* For COMMAND_LINE_SIZE */
-#undef _SETUP
-
-extern unsigned long get_cmd_line_ptr(void);
-
/* Simplified build-specific string for starting entropy. */
static const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION;
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index 6d31f1b4c4d1..95aacc361f78 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -25,6 +25,10 @@
#include <asm/bootparam.h>
#include <asm/desc_defs.h>

+#define _SETUP
+#include <asm/setup.h> /* For COMMAND_LINE_SIZE */
+#undef _SETUP
+
#define BOOT_CTYPE_H
#include <linux/acpi.h>

@@ -70,6 +74,15 @@ static inline void debug_puthex(unsigned long value)
#endif

/* cmdline.c */
+static inline
+unsigned long get_cmd_line_ptr(void)
+{
+ unsigned long cmd_line_ptr = boot_params->hdr.cmd_line_ptr;
+
+ cmd_line_ptr |= (u64)boot_params->ext_cmd_line_ptr << 32;
+
+ return cmd_line_ptr;
+}
int cmdline_find_option(const char *option, char *buffer, int bufsize);
int cmdline_find_option_bool(const char *option);

--
2.26.2