Return-Path: Received: from numascale.com ([213.162.240.84]:51226 "EHLO numascale.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751715AbaJSBrB (ORCPT ); Sat, 18 Oct 2014 21:47:01 -0400 From: Daniel J Blueman To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Bjorn Helgaas Cc: Daniel J Blueman , x86@kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Steffen Persvold Subject: [PATCH v2 3/5] Numachip: Add safe is-present function Date: Sun, 19 Oct 2014 09:45:50 +0800 Message-Id: <1413683152-31302-3-git-send-email-daniel@numascale.com> In-Reply-To: <1413683152-31302-1-git-send-email-daniel@numascale.com> References: <1413683152-31302-1-git-send-email-daniel@numascale.com> Sender: linux-pci-owner@vger.kernel.org List-ID: Add safe function to check if Numachip is detected, to be used elsewhere. Signed-off-by: Daniel J Blueman --- arch/x86/include/asm/numachip/numachip.h | 9 +++++++++ arch/x86/kernel/apic/apic_numachip.c | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/numachip/numachip.h b/arch/x86/include/asm/numachip/numachip.h index 1c6f7f6..3e1f4f9 100644 --- a/arch/x86/include/asm/numachip/numachip.h +++ b/arch/x86/include/asm/numachip/numachip.h @@ -16,4 +16,13 @@ extern int __init pci_numachip_init(void); +#ifdef CONFIG_X86_NUMACHIP +extern bool is_numachip_system(void); +#else +static inline bool is_numachip_system(void) +{ + return 0; +} +#endif + #endif /* _ASM_X86_NUMACHIP_NUMACHIP_H */ diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c index bd083c0..c965b69 100644 --- a/arch/x86/kernel/apic/apic_numachip.c +++ b/arch/x86/kernel/apic/apic_numachip.c @@ -30,7 +30,7 @@ #include #include -static int numachip_system __read_mostly; +static bool numachip_system __read_mostly; static const struct apic apic_numachip __refconst; @@ -173,11 +173,16 @@ static void fixup_cpu_id(struct cpuinfo_x86 *c, int node) } } +bool is_numachip_system(void) +{ + return numachip_system; +} + static int __init numachip_system_init(void) { unsigned int val; - if (!numachip_system) + if (!is_numachip_system()) return 0; x86_cpuinit.fixup_cpu_id = fixup_cpu_id; -- 1.9.1