Skip to contentSkip to conversation

x86/smp: fix non-SMP broken build due to redefinition of apic_id_is_primary_thread

PATCH Applied Vlastimil Babka 2 participants 2 messages Aug 14, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/smp: fix non-SMP broken build due to redefinition of apic_id_is_primary_thread

The function has an inline "return false;" definition with CONFIG_SMP=n but the "real" definition is also visible leading to "redefinition of ‘apic_id_is_primary_thread’" compiler error. Guard it with #ifdef CONFIG_SMP

Fixes 6a4d2657e048 ("x86/smp: Provide topology_is_primary_thread()")
---
 arch/x86/kernel/apic/apic.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/apic/apic.c +2 -0
index 87ff6235bbfe..84132eddb5a8 100644
@@ -2193,6 +2193,7 @@ static int cpuid_to_apicid[] = {
 	[0 ... NR_CPUS - 1] = -1,
 };
 
+#ifdef CONFIG_SMP
 /**
  * apic_id_is_primary_thread - Check whether APIC ID belongs to a primary thread
  * @id:	APIC ID to check
@@ -2207,6 +2208,7 @@ bool apic_id_is_primary_thread(unsigned int apicid)
 	mask = (1U << (fls(smp_num_siblings) - 1)) - 1;
 	return !(apicid & mask);
 }
+#endif
 
 /*
  * Should use this API to allocate logical CPU IDs to keep nr_logical_cpuids
Signature · 1 line
2.18.0
#1 lore raw
Quoted 4 lines · Vlastimil Babka

The function has an inline "return false;" definition with CONFIG_SMP=n but the "real" definition is also visible leading to "redefinition of ‘apic_id_is_primary_thread’" compiler error. Guard it with #ifdef CONFIG_SMP

Applied.

Linus