Skip to content

Commit 7dae5f0

Browse files
mrutland-armctmarinas
authored andcommitted
arm64: cpufeature: fold cpus_set_cap() into update_cpu_capabilities()
We only use cpus_set_cap() in update_cpu_capabilities(), where we open-code an analgous update to boot_cpucaps. Due to the way the cpucap_ptrs[] array is initialized, we know that the capability number cannot be greater than or equal to ARM64_NCAPS, so the warning is superfluous. Fold cpus_set_cap() into update_cpu_capabilities(), matching what we do for the boot_cpucaps, and making the relationship between the two a bit clearer. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <[email protected]> Reviewed-by: Suzuki K Poulose <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Mark Brown <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 1c8ae42 commit 7dae5f0

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

arch/arm64/include/asm/cpufeature.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -504,16 +504,6 @@ static __always_inline bool cpus_have_const_cap(int num)
504504
return cpus_have_cap(num);
505505
}
506506

507-
static inline void cpus_set_cap(unsigned int num)
508-
{
509-
if (num >= ARM64_NCAPS) {
510-
pr_warn("Attempt to set an illegal CPU capability (%d >= %d)\n",
511-
num, ARM64_NCAPS);
512-
} else {
513-
__set_bit(num, system_cpucaps);
514-
}
515-
}
516-
517507
static inline int __attribute_const__
518508
cpuid_feature_extract_signed_field_width(u64 features, int field, int width)
519509
{

arch/arm64/kernel/cpufeature.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2903,7 +2903,8 @@ static void update_cpu_capabilities(u16 scope_mask)
29032903

29042904
if (caps->desc)
29052905
pr_info("detected: %s\n", caps->desc);
2906-
cpus_set_cap(caps->capability);
2906+
2907+
__set_bit(caps->capability, system_cpucaps);
29072908

29082909
if ((scope_mask & SCOPE_BOOT_CPU) && (caps->type & SCOPE_BOOT_CPU))
29092910
set_bit(caps->capability, boot_cpucaps);

0 commit comments

Comments
 (0)