blob: 1ea2c184315d12bb8c5c46674c28a53ab16815a1 [file] [log] [blame]
Andrew Mortonccb46002006-03-25 03:08:08 -08001#include <linux/kernel.h>
2#include <linux/bitops.h>
3#include <linux/cpumask.h>
4#include <linux/module.h>
5
6int __first_cpu(const cpumask_t *srcp)
7{
8 return min_t(int, NR_CPUS, find_first_bit(srcp->bits, NR_CPUS));
9}
10EXPORT_SYMBOL(__first_cpu);
11
Andrew Morton3d18bd72006-03-25 03:08:09 -080012int __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);
Andrew Morton86302822006-03-25 03:08:09 -080017
Christoph Lameter53b8a312007-02-20 13:57:51 -080018int nr_cpu_ids;
19EXPORT_SYMBOL(nr_cpu_ids);
Andrew Morton96a9b4d2006-03-25 03:08:10 -080020
21int __any_online_cpu(const cpumask_t *mask)
22{
23 int cpu;
24
25 for_each_cpu_mask(cpu, *mask) {
26 if (cpu_online(cpu))
27 break;
28 }
29 return cpu;
30}
31EXPORT_SYMBOL(__any_online_cpu);