aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/cpumask.h13
-rw-r--r--lib/cpumask.c12
2 files changed, 15 insertions, 10 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index f770039344c..99e6115d8e5 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -398,22 +398,15 @@ extern cpumask_t cpu_present_map;
#ifdef CONFIG_SMP
int highest_possible_processor_id(void);
+#define any_online_cpu(mask) __any_online_cpu(&(mask))
+int __any_online_cpu(const cpumask_t *mask);
#else
#define highest_possible_processor_id() 0
+#define any_online_cpu(mask) 0
#endif
-#define any_online_cpu(mask) \
-({ \
- int cpu; \
- for_each_cpu_mask(cpu, (mask)) \
- if (cpu_online(cpu)) \
- break; \
- cpu; \
-})
-
#define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
#define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map)
#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map)
-
#endif /* __LINUX_CPUMASK_H */
diff --git a/lib/cpumask.c b/lib/cpumask.c
index ea25a034276..3a67dc5ada7 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -31,3 +31,15 @@ int highest_possible_processor_id(void)
return highest;
}
EXPORT_SYMBOL(highest_possible_processor_id);
+
+int __any_online_cpu(const cpumask_t *mask)
+{
+ int cpu;
+
+ for_each_cpu_mask(cpu, *mask) {
+ if (cpu_online(cpu))
+ break;
+ }
+ return cpu;
+}
+EXPORT_SYMBOL(__any_online_cpu);