From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752391AbbIBGfQ (ORCPT ); Wed, 2 Sep 2015 02:35:16 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:33669 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750806AbbIBGfO (ORCPT ); Wed, 2 Sep 2015 02:35:14 -0400 From: Mike Rapoport To: "K. Y. Srinivasan" Cc: Haiyang Zhang , linux-kernel@vger.kernel.org, Mike Rapoport Subject: [PATCH] x86/hyperv: fix build error when CONFIG_KEXEC_CORE is not defined Date: Wed, 2 Sep 2015 09:35:06 +0300 Message-Id: <1441175706-3219-1-git-send-email-mike.rapoport@gmail.com> X-Mailer: git-send-email 2.1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When CONFIG_KEXEC_CORE is not enabled, linkage fails with the following error: LINK vmlinux LD vmlinux.o MODPOST vmlinux.o GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o LD init/built-in.o arch/x86/built-in.o: In function `hv_machine_crash_shutdown': mshyperv.c:(.text+0x10fbb): undefined reference to `native_machine_crash_shutdown' make[1]: *** [vmlinux] Error 1 Surrounding crash handling related code in #ifdef CONFIG_KEXEC_CORE resolves the issue --- arch/x86/include/asm/mshyperv.h | 5 +++++ arch/x86/kernel/cpu/mshyperv.c | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index aaf59b7..359e7ea 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -23,6 +23,11 @@ void hv_remove_vmbus_irq(void); void hv_setup_kexec_handler(void (*handler)(void)); void hv_remove_kexec_handler(void); +#ifdef CONFIG_KEXEC_CORE void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs)); void hv_remove_crash_handler(void); +#else +static inline void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs)) {} +static inline void hv_remove_crash_handler(void) {} +#endif #endif diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index 7a2ff7b..a8d1f18 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -35,7 +35,9 @@ struct ms_hyperv_info ms_hyperv; EXPORT_SYMBOL_GPL(ms_hyperv); static void (*hv_kexec_handler)(void); +#ifdef CONFIG_KEXEC_CORE static void (*hv_crash_handler)(struct pt_regs *regs); +#endif #if IS_ENABLED(CONFIG_HYPERV) static void (*vmbus_handler)(void); @@ -85,6 +87,7 @@ void hv_remove_kexec_handler(void) } EXPORT_SYMBOL_GPL(hv_remove_kexec_handler); +#ifdef CONFIG_KEXEC_CORE void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs)) { hv_crash_handler = handler; @@ -96,7 +99,8 @@ void hv_remove_crash_handler(void) hv_crash_handler = NULL; } EXPORT_SYMBOL_GPL(hv_remove_crash_handler); -#endif +#endif /* CONFIG_KEXEC_CORE */ +#endif /* IS_ENABLED(CONFIG_HYPERV) */ static void hv_machine_shutdown(void) { @@ -105,13 +109,14 @@ static void hv_machine_shutdown(void) native_machine_shutdown(); } +#ifdef CONFIG_KEXEC_CORE static void hv_machine_crash_shutdown(struct pt_regs *regs) { if (hv_crash_handler) hv_crash_handler(regs); native_machine_crash_shutdown(regs); } - +#endif static uint32_t __init ms_hyperv_platform(void) { @@ -189,7 +194,9 @@ static void __init ms_hyperv_init_platform(void) mark_tsc_unstable("running on Hyper-V"); machine_ops.shutdown = hv_machine_shutdown; +#ifdef CONFIG_KEXEC_CORE machine_ops.crash_shutdown = hv_machine_crash_shutdown; +#endif } const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { -- 1.8.3.1