Skip to content

Commit decde1f

Browse files
charlie-rivospalmer-dabbelt
authored andcommitted
cpumask: Add assign cpu
Standardize an assign_cpu function for cpumasks. Signed-off-by: Charlie Jenkins <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 6a08e47 commit decde1f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

arch/riscv/mm/cacheflush.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static void set_icache_stale_mask(void)
170170
stale_cpu = cpumask_test_cpu(smp_processor_id(), mask);
171171

172172
cpumask_setall(mask);
173-
assign_bit(cpumask_check(smp_processor_id()), cpumask_bits(mask), stale_cpu);
173+
cpumask_assign_cpu(smp_processor_id(), mask, stale_cpu);
174174
}
175175
#endif
176176

include/linux/cpumask.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,22 @@ static __always_inline void __cpumask_clear_cpu(int cpu, struct cpumask *dstp)
492492
__clear_bit(cpumask_check(cpu), cpumask_bits(dstp));
493493
}
494494

495+
/**
496+
* cpumask_assign_cpu - assign a cpu in a cpumask
497+
* @cpu: cpu number (< nr_cpu_ids)
498+
* @dstp: the cpumask pointer
499+
* @bool: the value to assign
500+
*/
501+
static __always_inline void cpumask_assign_cpu(int cpu, struct cpumask *dstp, bool value)
502+
{
503+
assign_bit(cpumask_check(cpu), cpumask_bits(dstp), value);
504+
}
505+
506+
static __always_inline void __cpumask_assign_cpu(int cpu, struct cpumask *dstp, bool value)
507+
{
508+
__assign_bit(cpumask_check(cpu), cpumask_bits(dstp), value);
509+
}
510+
495511
/**
496512
* cpumask_test_cpu - test for a cpu in a cpumask
497513
* @cpu: cpu number (< nr_cpu_ids)

0 commit comments

Comments
 (0)