From: William Lee Irwin III (a) cpus_shift_left() was incorrectly identical to cpus_shift_right() (b) cpus_weight() had lingering remnants of using u64 on 32-bit code (c) any_online_cpu() was utter garbage (d) remove #ifdef rendered pointless by cpumask_up.h include/asm-generic/cpumask_arith.h | 20 +++----------------- 1 files changed, 3 insertions(+), 17 deletions(-) diff -puN include/asm-generic/cpumask_arith.h~cpumask_t-random-fixes include/asm-generic/cpumask_arith.h --- 25/include/asm-generic/cpumask_arith.h~cpumask_t-random-fixes 2003-08-04 23:34:14.000000000 -0700 +++ 25-akpm/include/asm-generic/cpumask_arith.h 2003-08-04 23:34:14.000000000 -0700 @@ -22,24 +22,15 @@ #define cpus_empty(map) ((map) == 0) #if BITS_PER_LONG == 32 -#if NR_CPUS <= 32 #define cpus_weight(map) hweight32(map) -#else -#define cpus_weight(map) \ -({ \ - u32 *__map = (u32 *)(&(map)); \ - hweight32(__map[0]) + hweight32(__map[1]); \ -}) -#endif #elif BITS_PER_LONG == 64 #define cpus_weight(map) hweight64(map) #endif #define cpus_shift_right(dst, src, n) do { dst = (src) >> (n); } while (0) -#define cpus_shift_left(dst, src, n) do { dst = (src) >> (n); } while (0) - -#define any_online_cpu(map) (!cpus_empty(map)) +#define cpus_shift_left(dst, src, n) do { dst = (src) << (n); } while (0) +#define any_online_cpu(map) ({ (map) ? first_cpu(map) : NR_CPUS; }) #define CPU_MASK_ALL (~((cpumask_t)0) >> (8*sizeof(cpumask_t) - NR_CPUS)) #define CPU_MASK_NONE ((cpumask_t)0) @@ -49,13 +40,8 @@ #define cpus_promote(map) ({ map; }) #define cpumask_of_cpu(cpu) ({ ((cpumask_t)1) << (cpu); }) -#ifdef CONFIG_SMP #define first_cpu(map) __ffs(map) #define next_cpu(cpu, map) \ - __ffs((map) & ~(((cpumask_t)1 << (cpu)) - 1)) -#else -#define first_cpu(map) 0 -#define next_cpu(cpu, map) 1 -#endif /* CONFIG_SMP */ + __ffs((map) & ~(((cpumask_t)1 << ((cpu) + 1)) - 1)) #endif /* __ASM_GENERIC_CPUMASK_ARITH_H */ _