From: Ashok Raj I really wish smp_prepare_cpu() would disappear eventually. In the interim this is ideally a weak function, so we dont end up changing several places to define this dummy in headers. Today since the dummy declaration is done only in drivers/base/cpu.c but the function is called in kernel/power/smp.c i get undefined reference in my cpu hotplug code for x86_64 under development. Signed-off-by: Ashok Raj Signed-off-by: Andrew Morton --- drivers/base/cpu.c | 9 +++++---- include/asm-i386/smp.h | 3 --- include/linux/cpu.h | 1 + 3 files changed, 6 insertions(+), 7 deletions(-) diff -puN drivers/base/cpu.c~physical-cpu-hot-add-fix drivers/base/cpu.c --- 25/drivers/base/cpu.c~physical-cpu-hot-add-fix 2005-05-09 20:09:24.000000000 -0700 +++ 25-akpm/drivers/base/cpu.c 2005-05-09 20:09:24.000000000 -0700 @@ -16,9 +16,10 @@ struct sysdev_class cpu_sysdev_class = { EXPORT_SYMBOL(cpu_sysdev_class); #ifdef CONFIG_HOTPLUG_CPU -#ifndef __HAVE_ARCH_SMP_PREPARE_CPU -#define smp_prepare_cpu(cpu) (0) -#endif +int __attribute__((weak)) smp_prepare_cpu (int cpu) +{ + return 0; +} static ssize_t show_online(struct sys_device *dev, char *buf) { @@ -41,7 +42,7 @@ static ssize_t store_online(struct sys_d break; case '1': ret = smp_prepare_cpu(cpu->sysdev.id); - if (ret == 0) + if (!ret) ret = cpu_up(cpu->sysdev.id); break; default: diff -puN include/asm-i386/smp.h~physical-cpu-hot-add-fix include/asm-i386/smp.h --- 25/include/asm-i386/smp.h~physical-cpu-hot-add-fix 2005-05-09 20:09:24.000000000 -0700 +++ 25-akpm/include/asm-i386/smp.h 2005-05-09 20:09:24.000000000 -0700 @@ -49,9 +49,6 @@ extern u8 x86_cpu_to_apicid[]; #ifdef CONFIG_HOTPLUG_CPU extern void cpu_exit_clear(void); extern void cpu_uninit(void); - -#define __HAVE_ARCH_SMP_PREPARE_CPU -extern int smp_prepare_cpu(int cpu); #endif /* diff -puN include/linux/cpu.h~physical-cpu-hot-add-fix include/linux/cpu.h --- 25/include/linux/cpu.h~physical-cpu-hot-add-fix 2005-05-09 20:09:24.000000000 -0700 +++ 25-akpm/include/linux/cpu.h 2005-05-09 20:09:24.000000000 -0700 @@ -69,6 +69,7 @@ extern struct semaphore cpucontrol; register_cpu_notifier(&fn##_nb); \ } int cpu_down(unsigned int cpu); +extern int __attribute__((weak)) smp_prepare_cpu(int cpu); #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) #else #define lock_cpu_hotplug() do { } while (0) _