]> git.baikalelectronics.ru Git - kernel.git/commitdiff
smp: Use smp_cond_func_t as type for the conditional function
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Fri, 17 Jan 2020 09:01:35 +0000 (10:01 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 24 Jan 2020 19:40:08 +0000 (20:40 +0100)
Use a typdef for the conditional function instead defining it each time in
the function prototype.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20200117090137.1205765-2-bigeasy@linutronix.de
include/linux/smp.h
kernel/smp.c
kernel/up.c

index 6fc856c9eda581fb4db0001cf2072db47bf31b1d..4734416855aada79049aea6e41241281359d2241 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/llist.h>
 
 typedef void (*smp_call_func_t)(void *info);
+typedef bool (*smp_cond_func_t)(int cpu, void *info);
 struct __call_single_data {
        struct llist_node llist;
        smp_call_func_t func;
@@ -49,13 +50,12 @@ void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func,
  * cond_func returns a positive value. This may include the local
  * processor.
  */
-void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
-               smp_call_func_t func, void *info, bool wait,
-               gfp_t gfp_flags);
+void on_each_cpu_cond(smp_cond_func_t cond_func, smp_call_func_t func,
+                     void *info, bool wait, gfp_t gfp_flags);
 
-void on_each_cpu_cond_mask(bool (*cond_func)(int cpu, void *info),
-               smp_call_func_t func, void *info, bool wait,
-               gfp_t gfp_flags, const struct cpumask *mask);
+void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func,
+                          void *info, bool wait, gfp_t gfp_flags,
+                          const struct cpumask *mask);
 
 int smp_call_function_single_async(int cpu, call_single_data_t *csd);
 
index 7dbcb402c2fc0af441d75d13eeaef7a642f4fd57..c64044d68bc620288df4f9390523ef81c8f29210 100644 (file)
@@ -680,9 +680,9 @@ EXPORT_SYMBOL(on_each_cpu_mask);
  * You must not call this function with disabled interrupts or
  * from a hardware interrupt handler or from a bottom half handler.
  */
-void on_each_cpu_cond_mask(bool (*cond_func)(int cpu, void *info),
-                       smp_call_func_t func, void *info, bool wait,
-                       gfp_t gfp_flags, const struct cpumask *mask)
+void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func,
+                          void *info, bool wait, gfp_t gfp_flags,
+                          const struct cpumask *mask)
 {
        cpumask_var_t cpus;
        int cpu, ret;
@@ -714,9 +714,8 @@ void on_each_cpu_cond_mask(bool (*cond_func)(int cpu, void *info),
 }
 EXPORT_SYMBOL(on_each_cpu_cond_mask);
 
-void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
-                       smp_call_func_t func, void *info, bool wait,
-                       gfp_t gfp_flags)
+void on_each_cpu_cond(smp_cond_func_t cond_func, smp_call_func_t func,
+                     void *info, bool wait, gfp_t gfp_flags)
 {
        on_each_cpu_cond_mask(cond_func, func, info, wait, gfp_flags,
                                cpu_online_mask);
index 862b460ab97a8e954c3ac292be94d88670a6fb0c..5c0d4f2bece22f1d9105da98beb906b217bc22f6 100644 (file)
@@ -68,9 +68,9 @@ EXPORT_SYMBOL(on_each_cpu_mask);
  * Preemption is disabled here to make sure the cond_func is called under the
  * same condtions in UP and SMP.
  */
-void on_each_cpu_cond_mask(bool (*cond_func)(int cpu, void *info),
-                          smp_call_func_t func, void *info, bool wait,
-                          gfp_t gfp_flags, const struct cpumask *mask)
+void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func,
+                          void *info, bool wait, gfp_t gfp_flags,
+                          const struct cpumask *mask)
 {
        unsigned long flags;
 
@@ -84,9 +84,8 @@ void on_each_cpu_cond_mask(bool (*cond_func)(int cpu, void *info),
 }
 EXPORT_SYMBOL(on_each_cpu_cond_mask);
 
-void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
-                     smp_call_func_t func, void *info, bool wait,
-                     gfp_t gfp_flags)
+void on_each_cpu_cond(smp_cond_func_t cond_func, smp_call_func_t func,
+                     void *info, bool wait, gfp_t gfp_flags)
 {
        on_each_cpu_cond_mask(cond_func, func, info, wait, gfp_flags, NULL);
 }