No point in having try_to_enable_x2apic() outside of the
CONFIG_X86_X2APIC section and having inline functions and more ifdefs
to deal with it. Move the code into the existing ifdef section and
remove the inline cruft.

Signed-off-by: Thomas Gleixner <t...@linutronix.de>
---
 arch/x86/include/asm/apic.h |   20 ++-----------
 arch/x86/kernel/apic/apic.c |   65 +++++++++++++++++++++-----------------------
 2 files changed, 35 insertions(+), 50 deletions(-)

Index: tip/arch/x86/include/asm/apic.h
===================================================================
--- tip.orig/arch/x86/include/asm/apic.h
+++ tip/arch/x86/include/asm/apic.h
@@ -184,24 +184,10 @@ static inline int x2apic_enabled(void)
 }
 
 #define x2apic_supported()     (cpu_has_x2apic)
-static inline void x2apic_force_phys(void)
-{
-       x2apic_phys = 1;
-}
 #else
-static inline void disable_x2apic(void)
-{
-}
-static inline void enable_x2apic(void)
-{
-}
-static inline int x2apic_enabled(void)
-{
-       return 0;
-}
-static inline void x2apic_force_phys(void)
-{
-}
+static inline void disable_x2apic(void) { }
+static inline void enable_x2apic(void) { }
+static inline int x2apic_enabled(void) { return 0; }
 
 #define x2apic_mode            (0)
 #define        x2apic_supported()      (0)
Index: tip/arch/x86/kernel/apic/apic.c
===================================================================
--- tip.orig/arch/x86/kernel/apic/apic.c
+++ tip/arch/x86/kernel/apic/apic.c
@@ -1561,40 +1561,8 @@ void enable_x2apic(void)
        }
 }
 
-void __init check_x2apic(void)
-{
-       if (x2apic_enabled()) {
-               pr_info("x2apic enabled by BIOS, switching to x2apic ops\n");
-               x2apic_mode = 1;
-       }
-}
-#else /* CONFIG_X86_X2APIC */
-void __init check_x2apic(void)
-{
-       if (!cpu_has_apic || !apic_is_x2apic_enabled())
-               return;
-       /*
-        * Checkme: Can we simply turn off x2apic here instead of panic?
-        */
-       panic("BIOS has enabled x2apic but kernel doesn't support x2apic, 
please disable x2apic in BIOS.\n");
-}
-#endif /* !CONFIG_X86_X2APIC */
-
-static int __init try_to_enable_IR(void)
-{
-#ifdef CONFIG_X86_IO_APIC
-       if (!x2apic_enabled() && skip_ioapic_setup) {
-               pr_info("Skipped enabling intr-remap because of skipping "
-                       "io-apic setup\n");
-               return -1;
-       }
-#endif
-       return irq_remapping_enable();
-}
-
 static __init void try_to_enable_x2apic(int ir_stat)
 {
-#ifdef CONFIG_X86_X2APIC
        if (!x2apic_supported())
                return;
 
@@ -1614,7 +1582,7 @@ static __init void try_to_enable_x2apic(
                 * without IR all CPUs can be addressed by IOAPIC/MSI
                 * only in physical mode
                 */
-               x2apic_force_phys();
+               x2apic_phys = 1;
        }
 
        if (!x2apic_mode) {
@@ -1622,7 +1590,38 @@ static __init void try_to_enable_x2apic(
                enable_x2apic();
                pr_info("Enabled x2apic\n");
        }
+}
+
+void __init check_x2apic(void)
+{
+       if (x2apic_enabled()) {
+               pr_info("x2apic: enabled by BIOS, switching to x2apic ops\n");
+               x2apic_mode = 1;
+       }
+}
+#else /* CONFIG_X86_X2APIC */
+void __init check_x2apic(void)
+{
+       if (!cpu_has_apic || !apic_is_x2apic_enabled())
+               return;
+       /*
+        * CHECKME: Can we simply turn off x2apic here instead of panic?
+        */
+       panic("BIOS has enabled x2apic but kernel doesn't support x2apic, 
please disable x2apic in BIOS.\n");
+}
+static inline void try_to_enable_x2apic(int ir_stat) { }
+#endif /* !CONFIG_X86_X2APIC */
+
+static int __init try_to_enable_IR(void)
+{
+#ifdef CONFIG_X86_IO_APIC
+       if (!x2apic_enabled() && skip_ioapic_setup) {
+               pr_info("Skipped enabling intr-remap because of skipping "
+                       "io-apic setup\n");
+               return -1;
+       }
 #endif
+       return irq_remapping_enable();
 }
 
 void __init enable_IR_x2apic(void)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to