Skip to content

Commit

Permalink
x86/boot/acpi: Move get_cmdline_acpi_rsdp() under #ifdef guard
Browse files Browse the repository at this point in the history
When building with "EXTRA_CFLAGS=-Wall" gcc warns:

arch/x86/boot/compressed/acpi.c:29:30: warning: get_cmdline_acpi_rsdp defined but not used [-Wunused-function]

get_cmdline_acpi_rsdp() is only used when CONFIG_RANDOMIZE_BASE and
CONFIG_MEMORY_HOTREMOVE are both enabled, so any build where one of these
config options is disabled has this issue.

Move the function under the same ifdef guard as the call site.

[ tglx: Add context to the changelog so it becomes useful ]

Fixes: 41fa1ee ("acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/1569719633-32164-1-git-send-email-zhenzhong.duan@oracle.com
  • Loading branch information
Zhenzhong Duan authored and Thomas Gleixner committed Oct 18, 2019
1 parent f7c0f50 commit 228d120
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions arch/x86/boot/compressed/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,6 @@
*/
struct mem_vector immovable_mem[MAX_NUMNODES*2];

/*
* Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex
* digits, and '\0' for termination.
*/
#define MAX_ADDR_LEN 19

static acpi_physical_address get_cmdline_acpi_rsdp(void)
{
acpi_physical_address addr = 0;

#ifdef CONFIG_KEXEC
char val[MAX_ADDR_LEN] = { };
int ret;

ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN);
if (ret < 0)
return 0;

if (kstrtoull(val, 16, &addr))
return 0;
#endif
return addr;
}

/*
* Search EFI system tables for RSDP. If both ACPI_20_TABLE_GUID and
* ACPI_TABLE_GUID are found, take the former, which has more features.
Expand Down Expand Up @@ -298,6 +274,30 @@ acpi_physical_address get_rsdp_addr(void)
}

#if defined(CONFIG_RANDOMIZE_BASE) && defined(CONFIG_MEMORY_HOTREMOVE)
/*
* Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex
* digits, and '\0' for termination.
*/
#define MAX_ADDR_LEN 19

static acpi_physical_address get_cmdline_acpi_rsdp(void)
{
acpi_physical_address addr = 0;

#ifdef CONFIG_KEXEC
char val[MAX_ADDR_LEN] = { };
int ret;

ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN);
if (ret < 0)
return 0;

if (kstrtoull(val, 16, &addr))
return 0;
#endif
return addr;
}

/* Compute SRAT address from RSDP. */
static unsigned long get_acpi_srat_table(void)
{
Expand Down

0 comments on commit 228d120

Please sign in to comment.