From: Anton Blanchard This gets ppc64 compiling again. I couldnt resist making some gratuitous changes along the way. arch/ppc64/kernel/smp.c | 2 +- include/asm-ppc64/bitops.h | 1 + include/asm-ppc64/smp.h | 17 ++++++++--------- 3 files changed, 10 insertions(+), 10 deletions(-) diff -puN arch/ppc64/kernel/smp.c~ppc64-fixes-2 arch/ppc64/kernel/smp.c --- 25/arch/ppc64/kernel/smp.c~ppc64-fixes-2 2003-06-15 12:02:23.000000000 -0700 +++ 25-akpm/arch/ppc64/kernel/smp.c 2003-06-15 12:02:23.000000000 -0700 @@ -57,7 +57,7 @@ unsigned long cpu_online_map = 0; static struct smp_ops_t *smp_ops; -volatile unsigned int cpu_callin_map[NR_CPUS]; +static volatile unsigned int cpu_callin_map[NR_CPUS]; extern unsigned char stab_array[]; diff -puN include/asm-ppc64/bitops.h~ppc64-fixes-2 include/asm-ppc64/bitops.h --- 25/include/asm-ppc64/bitops.h~ppc64-fixes-2 2003-06-15 12:02:23.000000000 -0700 +++ 25-akpm/include/asm-ppc64/bitops.h 2003-06-15 12:02:23.000000000 -0700 @@ -269,6 +269,7 @@ static __inline__ int ffs(int x) * hweightN: returns the hamming weight (i.e. the number * of bits set) of a N-bit word */ +#define hweight64(x) generic_hweight64(x) #define hweight32(x) generic_hweight32(x) #define hweight16(x) generic_hweight16(x) #define hweight8(x) generic_hweight8(x) diff -puN include/asm-ppc64/smp.h~ppc64-fixes-2 include/asm-ppc64/smp.h --- 25/include/asm-ppc64/smp.h~ppc64-fixes-2 2003-06-15 12:02:23.000000000 -0700 +++ 25-akpm/include/asm-ppc64/smp.h 2003-06-15 12:02:23.000000000 -0700 @@ -35,24 +35,23 @@ extern void smp_send_xmon_break(int cpu) struct pt_regs; extern void smp_message_recv(int, struct pt_regs *); -#define NO_PROC_ID 0xFF /* No processor magic marker */ - #define cpu_online(cpu) test_bit((cpu), &cpu_online_map) #define cpu_possible(cpu) paca[cpu].active -static inline int num_online_cpus(void) +static inline unsigned int num_online_cpus(void) { - int i, nr = 0; + return hweight64(cpu_online_map); +} - for (i = 0; i < NR_CPUS; i++) - nr += test_bit(i, &cpu_online_map); +static inline int any_online_cpu(unsigned int mask) +{ + if (mask & cpu_online_map) + return __ffs(mask & cpu_online_map); - return nr; + return -1; } -extern volatile unsigned int cpu_callin_map[NR_CPUS]; - #define smp_processor_id() (get_paca()->xPacaIndex) /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers. _