V4L/DVB (4648): Hauppauge Nova-T 500 support added
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / lib / cpumask.c
blob7a2a73f88d594dc73282c24e3d0304a602a10a25
1 #include <linux/kernel.h>
2 #include <linux/bitops.h>
3 #include <linux/cpumask.h>
4 #include <linux/module.h>
6 int __first_cpu(const cpumask_t *srcp)
8 return min_t(int, NR_CPUS, find_first_bit(srcp->bits, NR_CPUS));
10 EXPORT_SYMBOL(__first_cpu);
12 int __next_cpu(int n, const cpumask_t *srcp)
14 return min_t(int, NR_CPUS, find_next_bit(srcp->bits, NR_CPUS, n+1));
16 EXPORT_SYMBOL(__next_cpu);
19 * Find the highest possible smp_processor_id()
21 * Note: if we're prepared to assume that cpu_possible_map never changes
22 * (reasonable) then this function should cache its return value.
24 int highest_possible_processor_id(void)
26 unsigned int cpu;
27 unsigned highest = 0;
29 for_each_cpu_mask(cpu, cpu_possible_map)
30 highest = cpu;
31 return highest;
33 EXPORT_SYMBOL(highest_possible_processor_id);
35 int __any_online_cpu(const cpumask_t *mask)
37 int cpu;
39 for_each_cpu_mask(cpu, *mask) {
40 if (cpu_online(cpu))
41 break;
43 return cpu;
45 EXPORT_SYMBOL(__any_online_cpu);
47 #if MAX_NUMNODES > 1
49 * Find the highest possible node id.
51 int highest_possible_node_id(void)
53 unsigned int node;
54 unsigned int highest = 0;
56 for_each_node_mask(node, node_possible_map)
57 highest = node;
58 return highest;
60 EXPORT_SYMBOL(highest_possible_node_id);
61 #endif