cpumask: de-duplicate assign_cpu() API
Subsystems (2)
Yury Norov
maintainerPATCH 1/1 cpumask: de-duplicate assign_cpu() API
We've got cpumask_assign_cpu() function and assign_cpu() macro, both doing the same thing. We need to drop one to avoid unneeded duplicatioon.
Now that underlying assign_bit() implemented as a macro, it would make sense to keep assign_cpu() which is also implemented as a macro, in sake of unification.
This patch also removes __cpumask_assign_cpu() as the function is unused.
--- arch/riscv/mm/cacheflush.c | 2 +- include/linux/cpumask.h | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-)
arch/riscv/mm/cacheflush.c +1 -1
@@ -171,7 +171,7 @@ static void set_icache_stale_mask(void) stale_cpu =cpumask_test_cpu (smp_processor_id (), mask);cpumask_setall (mask); - cpumask_assign_cpu(smp_processor_id(), mask, stale_cpu); + assign_cpu(smp_processor_id(), mask, stale_cpu); }#endif
include/linux/cpumask.h +0 -16
@@ -534,22 +534,6 @@ static __always_inline void __cpumask_clear_cpu(int cpu, struct cpumask *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 * @cpu: cpu number (< nr_cpu_ids)
Signature · 1 line
2.43.0
Quoted 42 lines · Yury Norov
We've got
cpumask_assign_cpu()function andassign_cpu()macro, both doing the same thing. We need to drop one to avoid unneeded duplicatioon.Now that underlying
assign_bit()implemented as a macro, it would make sense to keepassign_cpu()which is also implemented as a macro, in sake of unification.This patch also removes
__cpumask_assign_cpu()as the function is unused.Signed-off-by Yury Norov <[email protected]>--- arch/riscv/mm/cacheflush.c | 2 +- include/linux/cpumask.h | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-)arch/riscv/mm/cacheflush.c +1
-1@@ -171,7 +171,7 @@ static void set_icache_stale_mask(void) stale_cpu =cpumask_test_cpu (smp_processor_id (), mask);cpumask_setall (mask); - cpumask_assign_cpu(smp_processor_id(), mask, stale_cpu); + assign_cpu(smp_processor_id(), mask, stale_cpu); }#endif include/linux/cpumask.h +0
-5@@ -534,22 +534,6 @@ static __always_inline void __cpumask_clear_cpu(int cpu, struct cpumask *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
include/linux/cpumask.h static __always_inline void __cpumask_clear_cpu(int cpu, struct cpumask *dstp) · line 551
Quoted 10 lines
include/linux/cpumask.h +0
-10-*/ -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); -}
This deletion is the wrong way around. cpumask_assign_cpu already existed when assign_cpu was added. cpumask_assign_cpu uses the same naming convention as all of the other cpumask functions, so it is inconsistent with the other defines in this file to drop the "cpumask" prefix.
__cpumask_assign_cpu is not currently used but all of the other cpumask functions have a "__" alternative so that's why I added it.
- Charlie
Quoted 8 lines
include/linux/cpumask.h +0
-1-/** * cpumask_test_cpu - test for a cpu in a cpumask * @cpu: cpu number (< nr_cpu_ids) Signature · 1 line
2.43.0