x86, efi: remove duplicate code in setup_arch() by using, efi_is_native()
PATCH 1/1 x86, efi: remove duplicate code in setup_arch() by using, efi_is_native()
From: Satoru Takeuchi <[email protected]>
The check, "IS_ENABLED(CONFIG_X86_64) != efi_enabled(EFI_64BIT)", in setup_arch() can be replaced by efi_is_enabled(). This change remove duplicate code and improve readability.
Signed-off-by Satoru Takeuchi <[email protected]>
Cc Matt Fleming <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
--- arch/x86/include/asm/efi.h | 9 ++++++++- arch/x86/kernel/setup.c | 3 +-- arch/x86/platform/efi/efi.c | 5 ----- 3 files changed, 9 insertions(+), 8 deletions(-)
arch/x86/include/asm/efi.h +8 -1
@@ -102,7 +102,14 @@ extern void efi_call_phys_epilog(void);extern void efi_unmap_memmap (void );extern void efi_memory_uc (u64 addr,unsigned long size); -#ifndef CONFIG_EFI +#ifdef CONFIG_EFI + +static inline bool efi_is_native (void ) +{ +return IS_ENABLED (CONFIG_X86_64 ) ==efi_enabled (EFI_64BIT ); +} + +#else /* * IF EFI is not configured, have the EFI calls return -ENOSYS. */
arch/x86/kernel/setup.c +1 -2
@@ -1135,8 +1135,7 @@ void __init setup_arch(char **cmdline_p)* mismatched firmware/kernel archtectures since there is no * support for runtime services. */ -if (efi_enabled (EFI_BOOT ) && -IS_ENABLED (CONFIG_X86_64 ) !=efi_enabled (EFI_64BIT )) { +if (efi_enabled (EFI_BOOT ) && !efi_is_native ()) {pr_info ("efi: Setup done, disabling due to 32/64-bit mismatch\n" );efi_unmap_memmap (); }
arch/x86/platform/efi/efi.c +0 -5
@@ -69,11 +69,6 @@ struct efi_memory_map memmap;static struct efi efi_phys__initdata ;static efi_system_table_t efi_systab__initdata ; -static inline bool efi_is_native (void ) -{ -return IS_ENABLED (CONFIG_X86_64 ) ==efi_enabled (EFI_64BIT ); -} -unsigned long x86_efi_facility;/*
-- 1.7.10.4
Matt Fleming
AppliedQuoted 11 lines · Satoru Takeuchi
From: Satoru Takeuchi <[email protected]>
The check, "
IS_ENABLED(CONFIG_X86_64)!=efi_enabled(EFI_64BIT)", insetup_arch()can be replaced byefi_is_enabled(). This change remove duplicate code and improve readability.Signed-off-by Satoru Takeuchi <[email protected]>Cc Matt Fleming <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc "H. Peter Anvin" <[email protected]>
Quoted 5 lines
--- arch/x86/include/asm/efi.h | 9 ++++++++- arch/x86/kernel/setup.c | 3 +-- arch/x86/platform/efi/efi.c | 5 ----- 3 files changed, 9 insertions(+), 8 deletions(-)
Applied, thanks!