aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/cpumask.h11
-rw-r--r--lib/cpumask.c5
2 files changed, 9 insertions, 7 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 9b702fd24a72..4b29e508a0b6 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -215,16 +215,13 @@ static inline void __cpus_shift_left(cpumask_t *dstp,
215#ifdef CONFIG_SMP 215#ifdef CONFIG_SMP
216int __first_cpu(const cpumask_t *srcp); 216int __first_cpu(const cpumask_t *srcp);
217#define first_cpu(src) __first_cpu(&(src)) 217#define first_cpu(src) __first_cpu(&(src))
218int __next_cpu(int n, const cpumask_t *srcp);
219#define next_cpu(n, src) __next_cpu((n), &(src))
218#else 220#else
219#define first_cpu(src) 0 221#define first_cpu(src) 0
222#define next_cpu(n, src) 1
220#endif 223#endif
221 224
222#define next_cpu(n, src) __next_cpu((n), &(src), NR_CPUS)
223static inline int __next_cpu(int n, const cpumask_t *srcp, int nbits)
224{
225 return min_t(int, nbits, find_next_bit(srcp->bits, nbits, n+1));
226}
227
228#define cpumask_of_cpu(cpu) \ 225#define cpumask_of_cpu(cpu) \
229({ \ 226({ \
230 typeof(_unused_cpumask_arg_) m; \ 227 typeof(_unused_cpumask_arg_) m; \
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 1560d97390dd..ba2f8543052c 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -9,3 +9,8 @@ int __first_cpu(const cpumask_t *srcp)
9} 9}
10EXPORT_SYMBOL(__first_cpu); 10EXPORT_SYMBOL(__first_cpu);
11 11
12int __next_cpu(int n, const cpumask_t *srcp)
13{
14 return min_t(int, NR_CPUS, find_next_bit(srcp->bits, NR_CPUS, n+1));
15}
16EXPORT_SYMBOL(__next_cpu);