any_online_cpus returns NR_CPUS on failure.
PATCH 1/1 any_online_cpus returns NR_CPUS on failure.
Linus, please apply.
I prefer any_online_cpus() to return NR_CPUS if no CPUs in the mask are online, which matches find_first_bit/find_next_bit(), rather than -1.
Noone uses the return value at the moment, so the change is still trivial.
Thanks,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: any_online_cpu to return NR_CPUS
Author: Rusty Russell
Status: Trivial
D: Matt Fleming points out that returning int from any_online_cpu
D: where cpu numbers are passed as unsigned ints elsewhere is awkward
D: and a little dangerous.
D:
D: Make any_online_cpu() match find_first_bit(), by returning NR_CPUS
D: when no cpu is found, rather than -1. This also simplifies the
D: future case where NR_CPUS > BITS_PER_LONG.
include/asm-i386/smp.h +2 -2
@@ -78,12 +78,12 @@ static inline int num_booting_cpus(void)extern void map_cpu_to_logical_apicid (void );extern void unmap_cpu_to_logical_apicid (int cpu); -extern inline int any_online_cpu (unsigned int mask) +extern inline unsigned int any_online_cpu (unsigned int mask) {if (mask & cpu_online_map)return __ffs (mask & cpu_online_map); -return -1 ; +return NR_CPUS ; }#ifdef CONFIG_X86_LOCAL_APIC
include/asm-ia64/smp.h +2 -2
@@ -56,12 +56,12 @@ num_online_cpus (void)return hweight64 (cpu_online_map); } -static inline int +static inline unsigned int any_online_cpu (unsigned int mask) {if (mask & cpu_online_map)return __ffs (mask & cpu_online_map); -return -1 ; +return NR_CPUS ; }/*
include/asm-parisc/smp.h +2 -2
@@ -60,12 +60,12 @@ extern inline unsigned int num_online_cp return hweight32(cpu_online_map); } -extern inline int any_online_cpu (unsigned int mask) +extern inline unsigned int any_online_cpu (unsigned int mask) {if (mask & cpu_online_map)return __ffs (mask & cpu_online_map); -return -1 ; +return NR_CPUS ; }#endif /* CONFIG_SMP */
include/asm-ppc/smp.h +2 -2
@@ -53,12 +53,12 @@ extern inline unsigned int num_online_cpreturn hweight32 (cpu_online_map); } -extern inline int any_online_cpu (unsigned int mask) +extern inline unsigned int any_online_cpu (unsigned int mask) {if (mask & cpu_online_map)return __ffs (mask & cpu_online_map); -return -1 ; +return NR_CPUS ; }extern int __cpu_up (unsigned int cpu);
include/asm-s390/smp.h +2 -2
@@ -59,12 +59,12 @@ extern inline unsigned int num_online_cp#endif /* __s390x__ */ } -extern inline int any_online_cpu (unsigned int mask) +extern inline unsigned int any_online_cpu (unsigned int mask) {if (mask & cpu_online_map)return __ffs (mask & cpu_online_map); -return -1 ; +return NR_CPUS ; }extern __inline____u16 hard_smp_processor_id (void )
include/asm-sparc64/smp.h +2 -2
@@ -80,11 +80,11 @@ extern atomic_t sparc64_num_cpus_online;extern atomic_t sparc64_num_cpus_possible;#define num_possible_cpus () (atomic_read(&sparc64_num_cpus_possible)) -static inline int any_online_cpu (unsigned long mask) +static inline unsigned int any_online_cpu (unsigned long mask) {if ((mask &= cpu_online_map) !=0UL )return __ffs (mask); -return -1 ; +return NR_CPUS ; }/*
include/asm-x86_64/smp.h +2 -2
@@ -66,12 +66,12 @@ extern volatile unsigned long cpu_callou cpu =__ffs (mask), mask !=0 ; \ mask &= ~(1UL<<cpu)) -extern inline int any_online_cpu (unsigned int mask) +extern inline unsigned int any_online_cpu (unsigned int mask) {if (mask & cpu_online_map)return __ffs (mask & cpu_online_map); -return -1 ; +return NR_CPUS ; }extern inline unsigned int num_online_cpus (void )