Skip to content

Commit 188a569

Browse files
author
Ingo Molnar
committed
genirq/affinity: Only build SMP-only helper functions on SMP kernels
allnoconfig grew these new build warnings in lib/group_cpus.c: lib/group_cpus.c:247:12: warning: ‘__group_cpus_evenly’ defined but not used [-Wunused-function] lib/group_cpus.c:75:13: warning: ‘build_node_to_cpumask’ defined but not used [-Wunused-function] lib/group_cpus.c:66:13: warning: ‘free_node_to_cpumask’ defined but not used [-Wunused-function] lib/group_cpus.c:43:23: warning: ‘alloc_node_to_cpumask’ defined but not used [-Wunused-function] Widen the #ifdef CONFIG_SMP block to not expose unused helpers on non-SMP builds. Also annotate the preprocessor branches for better readability. Fixes: f7b3ea8 ("genirq/affinity: Move group_cpus_evenly() into lib/") Cc: Ming Lei <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 6a6dcae commit 188a569

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/group_cpus.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <linux/sort.h>
1010
#include <linux/group_cpus.h>
1111

12+
#ifdef CONFIG_SMP
13+
1214
static void grp_spread_init_one(struct cpumask *irqmsk, struct cpumask *nmsk,
1315
unsigned int cpus_per_grp)
1416
{
@@ -327,7 +329,6 @@ static int __group_cpus_evenly(unsigned int startgrp, unsigned int numgrps,
327329
return done;
328330
}
329331

330-
#ifdef CONFIG_SMP
331332
/**
332333
* group_cpus_evenly - Group all CPUs evenly per NUMA/CPU locality
333334
* @numgrps: number of groups
@@ -412,7 +413,7 @@ struct cpumask *group_cpus_evenly(unsigned int numgrps)
412413
}
413414
return masks;
414415
}
415-
#else
416+
#else /* CONFIG_SMP */
416417
struct cpumask *group_cpus_evenly(unsigned int numgrps)
417418
{
418419
struct cpumask *masks = kcalloc(numgrps, sizeof(*masks), GFP_KERNEL);
@@ -424,4 +425,4 @@ struct cpumask *group_cpus_evenly(unsigned int numgrps)
424425
cpumask_copy(&masks[0], cpu_possible_mask);
425426
return masks;
426427
}
427-
#endif
428+
#endif /* CONFIG_SMP */

0 commit comments

Comments
 (0)