diff options
-rw-r--r-- | include/linux/cpumask.h | 13 | ||||
-rw-r--r-- | lib/cpumask.c | 12 |
2 files changed, 15 insertions, 10 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index f770039344c5..99e6115d8e52 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -398,22 +398,15 @@ extern cpumask_t cpu_present_map; | |||
398 | 398 | ||
399 | #ifdef CONFIG_SMP | 399 | #ifdef CONFIG_SMP |
400 | int highest_possible_processor_id(void); | 400 | int highest_possible_processor_id(void); |
401 | #define any_online_cpu(mask) __any_online_cpu(&(mask)) | ||
402 | int __any_online_cpu(const cpumask_t *mask); | ||
401 | #else | 403 | #else |
402 | #define highest_possible_processor_id() 0 | 404 | #define highest_possible_processor_id() 0 |
405 | #define any_online_cpu(mask) 0 | ||
403 | #endif | 406 | #endif |
404 | 407 | ||
405 | #define any_online_cpu(mask) \ | ||
406 | ({ \ | ||
407 | int cpu; \ | ||
408 | for_each_cpu_mask(cpu, (mask)) \ | ||
409 | if (cpu_online(cpu)) \ | ||
410 | break; \ | ||
411 | cpu; \ | ||
412 | }) | ||
413 | |||
414 | #define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) | 408 | #define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) |
415 | #define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) | 409 | #define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) |
416 | #define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) | 410 | #define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) |
417 | 411 | ||
418 | |||
419 | #endif /* __LINUX_CPUMASK_H */ | 412 | #endif /* __LINUX_CPUMASK_H */ |
diff --git a/lib/cpumask.c b/lib/cpumask.c index ea25a034276c..3a67dc5ada7d 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c | |||
@@ -31,3 +31,15 @@ int highest_possible_processor_id(void) | |||
31 | return highest; | 31 | return highest; |
32 | } | 32 | } |
33 | EXPORT_SYMBOL(highest_possible_processor_id); | 33 | EXPORT_SYMBOL(highest_possible_processor_id); |
34 | |||
35 | int __any_online_cpu(const cpumask_t *mask) | ||
36 | { | ||
37 | int cpu; | ||
38 | |||
39 | for_each_cpu_mask(cpu, *mask) { | ||
40 | if (cpu_online(cpu)) | ||
41 | break; | ||
42 | } | ||
43 | return cpu; | ||
44 | } | ||
45 | EXPORT_SYMBOL(__any_online_cpu); | ||