mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* make smp_prepare_cpu to a weak function
@ 2005-05-06  0:07 Ashok Raj
  2005-05-06  0:40 ` Arjan van de Ven
  0 siblings, 1 reply; 3+ messages in thread
From: Ashok Raj @ 2005-05-06  0:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, zwane, shaohua.li

Hi Andrew

This is just a cleanup, the existing code seems to trigger
compile errors since smp_prepar_cpu() is defined with ARCH_HAS...
and its not easy to either introduce a arch call, or ideally remove it
finally. This is against 2.6.12-rc3-mm3

Cheers,
ashok
----

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 <ashok.raj@intel.com>

Index: linux-2.6.12-rc3-mm3/include/asm-i386/smp.h
===================================================================
--- linux-2.6.12-rc3-mm3.orig/include/asm-i386/smp.h	2005-05-05 09:56:47.000000000 -0700
+++ linux-2.6.12-rc3-mm3/include/asm-i386/smp.h	2005-05-05 16:20:59.544474384 -0700
@@ -51,9 +51,6 @@
 #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
 
 /*
Index: linux-2.6.12-rc3-mm3/drivers/base/cpu.c
===================================================================
--- linux-2.6.12-rc3-mm3.orig/drivers/base/cpu.c	2005-05-05 09:56:45.000000000 -0700
+++ linux-2.6.12-rc3-mm3/drivers/base/cpu.c	2005-05-05 17:01:26.533515968 -0700
@@ -16,9 +16,10 @@
 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 @@
 		break;
 	case '1':
 		ret = smp_prepare_cpu(cpu->sysdev.id);
-		if (ret == 0)
+		if (!ret)
 			ret = cpu_up(cpu->sysdev.id);
 		if (!ret)
 			kobject_hotplug(&dev->kobj, KOBJ_ONLINE);
Index: linux-2.6.12-rc3-mm3/include/linux/cpu.h
===================================================================
--- linux-2.6.12-rc3-mm3.orig/include/linux/cpu.h	2005-04-20 17:03:16.000000000 -0700
+++ linux-2.6.12-rc3-mm3/include/linux/cpu.h	2005-05-05 16:43:18.048990768 -0700
@@ -69,6 +69,7 @@
 	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)
-- 
Cheers,
Ashok Raj
- Open Source Technology Center

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-05-06  0:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-06  0:07 make smp_prepare_cpu to a weak function Ashok Raj
2005-05-06  0:40 ` Arjan van de Ven
2005-05-06  0:51   ` Ashok Raj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®