All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86, efi: remove duplicate code in setup_arch() by using, efi_is_native()
@ 2013-02-14  0:07 Satoru Takeuchi
       [not found] ` <511C2AC7.1080105-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Satoru Takeuchi @ 2013-02-14  0:07 UTC (permalink / raw)
  To: linux x86 ml, Thomas Gleixner, H. Peter Anvin, Ingo Molnar,
	Matt Fleming, linux EFI ml

From: Satoru Takeuchi <takeuchi_satoru-+CUm20s59erQFUHtdCDX3A@public.gmane.org>

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 <takeuchi_satoru-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
Cc: Matt Fleming <matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Cc: Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: "H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
---
 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(-)

diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 28677c5..60c89f3 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -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.
  */
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 8b24289..1abb796 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -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();
 	}
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 928bf83..eb9faeb 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -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 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86, efi: remove duplicate code in setup_arch() by using, efi_is_native()
       [not found] ` <511C2AC7.1080105-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
@ 2013-02-14 10:36   ` Matt Fleming
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Fleming @ 2013-02-14 10:36 UTC (permalink / raw)
  To: Satoru Takeuchi
  Cc: linux x86 ml, Thomas Gleixner, H. Peter Anvin, Ingo Molnar, linux EFI ml

On Thu, 2013-02-14 at 09:07 +0900, Satoru Takeuchi wrote:
> From: Satoru Takeuchi <takeuchi_satoru-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
> 
> 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 <takeuchi_satoru-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
> Cc: Matt Fleming <matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
> Cc: Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Cc: "H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
> ---
>  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!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-14 10:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-14  0:07 [PATCH] x86, efi: remove duplicate code in setup_arch() by using, efi_is_native() Satoru Takeuchi
     [not found] ` <511C2AC7.1080105-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2013-02-14 10:36   ` Matt Fleming

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.