smp_call_function_single() should be a macro on UP
authorAl Viro <viro@ftp.linux.org.uk>
Tue, 17 Jul 2007 21:29:46 +0000 (22:29 +0100)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 17 Jul 2007 21:39:19 +0000 (14:39 -0700)
... or we end up with header include order problems from hell.

E.g. on m68k this is 100% fatal - local_irq_enable() there
wants preempt_count(), which wants task_struct fields, which
we won't have when we are in smp.h pulled from sched.h.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/smp.h

index 8039daced6888e2f4f1169c88e38bd1ff4ef44f5..259a13c3bd98eda779379be1c5df5e37aae6c73e 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #include <linux/errno.h>
-#include <asm/system.h>
 
 extern void cpu_idle(void);
 
@@ -100,15 +99,14 @@ static inline int up_smp_call_function(void)
 static inline void smp_send_reschedule(int cpu) { }
 #define num_booting_cpus()                     1
 #define smp_prepare_boot_cpu()                 do {} while (0)
-static inline int smp_call_function_single(int cpuid, void (*func) (void *info),
-                                          void *info, int retry, int wait)
-{
-       WARN_ON(cpuid != 0);
-       local_irq_disable();
-       func(info);
-       local_irq_enable();
-       return 0;
-}
+#define smp_call_function_single(cpuid, func, info, retry, wait) \
+({ \
+       WARN_ON(cpuid != 0);    \
+       local_irq_disable();    \
+       (func)(info);           \
+       local_irq_enable();     \
+       0;                      \
+})
 
 #endif /* !SMP */