Commit decde1fa authored by Charlie Jenkins's avatar Charlie Jenkins Committed by Palmer Dabbelt

cpumask: Add assign cpu

Standardize an assign_cpu function for cpumasks.
Signed-off-by: default avatarCharlie Jenkins <charlie@rivosinc.com>
Link: https://lore.kernel.org/r/20240312-fencei-v13-4-4b6bdc2bbf32@rivosinc.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parent 6a08e470
...@@ -170,7 +170,7 @@ static void set_icache_stale_mask(void) ...@@ -170,7 +170,7 @@ static void set_icache_stale_mask(void)
stale_cpu = cpumask_test_cpu(smp_processor_id(), mask); stale_cpu = cpumask_test_cpu(smp_processor_id(), mask);
cpumask_setall(mask); cpumask_setall(mask);
assign_bit(cpumask_check(smp_processor_id()), cpumask_bits(mask), stale_cpu); cpumask_assign_cpu(smp_processor_id(), mask, stale_cpu);
} }
#endif #endif
......
...@@ -492,6 +492,22 @@ static __always_inline void __cpumask_clear_cpu(int cpu, struct cpumask *dstp) ...@@ -492,6 +492,22 @@ static __always_inline void __cpumask_clear_cpu(int cpu, struct cpumask *dstp)
__clear_bit(cpumask_check(cpu), cpumask_bits(dstp)); __clear_bit(cpumask_check(cpu), cpumask_bits(dstp));
} }
/**
* cpumask_assign_cpu - assign a cpu in a cpumask
* @cpu: cpu number (< nr_cpu_ids)
* @dstp: the cpumask pointer
* @bool: the value to assign
*/
static __always_inline void cpumask_assign_cpu(int cpu, struct cpumask *dstp, bool value)
{
assign_bit(cpumask_check(cpu), cpumask_bits(dstp), value);
}
static __always_inline void __cpumask_assign_cpu(int cpu, struct cpumask *dstp, bool value)
{
__assign_bit(cpumask_check(cpu), cpumask_bits(dstp), value);
}
/** /**
* cpumask_test_cpu - test for a cpu in a cpumask * cpumask_test_cpu - test for a cpu in a cpumask
* @cpu: cpu number (< nr_cpu_ids) * @cpu: cpu number (< nr_cpu_ids)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment