[PATCH v2 02/11] arm64: Add a helper setting a feature field to its safe value
Marc Zyngier
maz at kernel.org
Mon Mar 2 03:56:43 PST 2026
In order to make the code more readable, add a simple helper
setting a given field to its safe value, and update the only
user so far. More will be added later.
Suggested-by: Suzuki K Poulose <suzuki.poulose at arm.com>
Signed-off-by: Marc Zyngier <maz at kernel.org>
---
arch/arm64/kernel/cpufeature.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 28fc77443ccd3..102c5bac4d502 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -926,6 +926,11 @@ static u64 arm64_ftr_set_value(const struct arm64_ftr_bits *ftrp, s64 reg,
return reg;
}
+static u64 arm64_ftr_set_safe_value(const struct arm64_ftr_bits *ftrp, s64 reg)
+{
+ return arm64_ftr_set_value(ftrp, reg, ftrp->safe_val);
+}
+
s64 arm64_ftr_safe_value(const struct arm64_ftr_bits *ftrp, s64 new,
s64 cur)
{
@@ -1066,9 +1071,8 @@ static void init_cpu_ftr_reg(u32 sys_reg, u64 new)
if (ftrp->visible)
user_mask |= ftr_mask;
else
- reg->user_val = arm64_ftr_set_value(ftrp,
- reg->user_val,
- ftrp->safe_val);
+ reg->user_val = arm64_ftr_set_safe_value(ftrp,
+ reg->user_val);
}
val &= valid_mask;
--
2.47.3
More information about the linux-arm-kernel
mailing list