Skip to content

Commit 5671d81

Browse files
Sebastian Andrzej SiewiorKAGA-KOKO
authored andcommitted
smp: Use smp_cond_func_t as type for the conditional function
Use a typdef for the conditional function instead defining it each time in the function prototype. Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent def9d27 commit 5671d81

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

include/linux/smp.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/llist.h>
1616

1717
typedef void (*smp_call_func_t)(void *info);
18+
typedef bool (*smp_cond_func_t)(int cpu, void *info);
1819
struct __call_single_data {
1920
struct llist_node llist;
2021
smp_call_func_t func;
@@ -49,13 +50,12 @@ void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func,
4950
* cond_func returns a positive value. This may include the local
5051
* processor.
5152
*/
52-
void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
53-
smp_call_func_t func, void *info, bool wait,
54-
gfp_t gfp_flags);
53+
void on_each_cpu_cond(smp_cond_func_t cond_func, smp_call_func_t func,
54+
void *info, bool wait, gfp_t gfp_flags);
5555

56-
void on_each_cpu_cond_mask(bool (*cond_func)(int cpu, void *info),
57-
smp_call_func_t func, void *info, bool wait,
58-
gfp_t gfp_flags, const struct cpumask *mask);
56+
void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func,
57+
void *info, bool wait, gfp_t gfp_flags,
58+
const struct cpumask *mask);
5959

6060
int smp_call_function_single_async(int cpu, call_single_data_t *csd);
6161

kernel/smp.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,9 @@ EXPORT_SYMBOL(on_each_cpu_mask);
680680
* You must not call this function with disabled interrupts or
681681
* from a hardware interrupt handler or from a bottom half handler.
682682
*/
683-
void on_each_cpu_cond_mask(bool (*cond_func)(int cpu, void *info),
684-
smp_call_func_t func, void *info, bool wait,
685-
gfp_t gfp_flags, const struct cpumask *mask)
683+
void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func,
684+
void *info, bool wait, gfp_t gfp_flags,
685+
const struct cpumask *mask)
686686
{
687687
cpumask_var_t cpus;
688688
int cpu, ret;
@@ -714,9 +714,8 @@ void on_each_cpu_cond_mask(bool (*cond_func)(int cpu, void *info),
714714
}
715715
EXPORT_SYMBOL(on_each_cpu_cond_mask);
716716

717-
void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
718-
smp_call_func_t func, void *info, bool wait,
719-
gfp_t gfp_flags)
717+
void on_each_cpu_cond(smp_cond_func_t cond_func, smp_call_func_t func,
718+
void *info, bool wait, gfp_t gfp_flags)
720719
{
721720
on_each_cpu_cond_mask(cond_func, func, info, wait, gfp_flags,
722721
cpu_online_mask);

kernel/up.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ EXPORT_SYMBOL(on_each_cpu_mask);
6868
* Preemption is disabled here to make sure the cond_func is called under the
6969
* same condtions in UP and SMP.
7070
*/
71-
void on_each_cpu_cond_mask(bool (*cond_func)(int cpu, void *info),
72-
smp_call_func_t func, void *info, bool wait,
73-
gfp_t gfp_flags, const struct cpumask *mask)
71+
void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func,
72+
void *info, bool wait, gfp_t gfp_flags,
73+
const struct cpumask *mask)
7474
{
7575
unsigned long flags;
7676

@@ -84,9 +84,8 @@ void on_each_cpu_cond_mask(bool (*cond_func)(int cpu, void *info),
8484
}
8585
EXPORT_SYMBOL(on_each_cpu_cond_mask);
8686

87-
void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
88-
smp_call_func_t func, void *info, bool wait,
89-
gfp_t gfp_flags)
87+
void on_each_cpu_cond(smp_cond_func_t cond_func, smp_call_func_t func,
88+
void *info, bool wait, gfp_t gfp_flags)
9089
{
9190
on_each_cpu_cond_mask(cond_func, func, info, wait, gfp_flags, NULL);
9291
}

0 commit comments

Comments
 (0)