Skip to content

Commit 51f2403

Browse files
Shuo Liugregkh
authored andcommitted
cpu/hotplug: Fix build error of using {add,remove}_cpu() with !CONFIG_SMP
279dcf6 ("virt: acrn: Introduce an interface for Service VM to control vCPU") introduced {add,remove}_cpu() usage and it hit below error with !CONFIG_SMP: ../drivers/virt/acrn/hsm.c: In function ‘remove_cpu_store’: ../drivers/virt/acrn/hsm.c:389:3: error: implicit declaration of function ‘remove_cpu’; [-Werror=implicit-function-declaration] remove_cpu(cpu); ../drivers/virt/acrn/hsm.c:402:2: error: implicit declaration of function ‘add_cpu’; [-Werror=implicit-function-declaration] add_cpu(cpu); Add add_cpu() function prototypes with !CONFIG_SMP and remove_cpu() with !CONFIG_HOTPLUG_CPU for such usage. Fixes: 279dcf6 ("virt: acrn: Introduce an interface for Service VM to control vCPU") Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Qais Yousef <qais.yousef@arm.com> Reported-by: Randy Dunlap <rdunlap@infradead.org> Reviewed-by: Qais Yousef <qais.yousef@arm.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested Signed-off-by: Shuo Liu <shuo.a.liu@intel.com> Link: https://lore.kernel.org/r/20210221134339.57851-1-shuo.a.liu@intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 15097e9 commit 51f2403

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

include/linux/cpu.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ static inline void cpu_maps_update_done(void)
108108
{
109109
}
110110

111+
static inline int add_cpu(unsigned int cpu) { return 0;}
112+
111113
#endif /* CONFIG_SMP */
112114
extern struct bus_type cpu_subsys;
113115

@@ -137,6 +139,7 @@ static inline int cpus_read_trylock(void) { return true; }
137139
static inline void lockdep_assert_cpus_held(void) { }
138140
static inline void cpu_hotplug_disable(void) { }
139141
static inline void cpu_hotplug_enable(void) { }
142+
static inline int remove_cpu(unsigned int cpu) { return -EPERM; }
140143
static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { }
141144
#endif /* !CONFIG_HOTPLUG_CPU */
142145

0 commit comments

Comments
 (0)