[PATCH v3 5/6] arm64: kvm: Convert the opencoded field modify
Luo Jie
quic_luoj at quicinc.com
Thu Apr 17 03:47:12 PDT 2025
Replaced below code with the wrapper FIELD_MODIFY(MASK, ®, val)
- reg &= ~MASK;
- reg |= FIELD_PREP(MASK, val);
The semantic patch that makes this change is available
in scripts/coccinelle/misc/field_modify.cocci.
More information about semantic patching is available at
https://coccinelle.gitlabpages.inria.fr/website
Signed-off-by: Luo Jie <quic_luoj at quicinc.com>
---
arch/arm64/kvm/vgic/vgic-mmio-v3.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/kvm/vgic/vgic-mmio-v3.c b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
index ae4c0593d114..946db5b3500f 100644
--- a/arch/arm64/kvm/vgic/vgic-mmio-v3.c
+++ b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
@@ -123,10 +123,8 @@ static void vgic_mmio_write_v3_misc(struct kvm_vcpu *vcpu,
val &= ~GICD_CTLR_nASSGIreq;
/* Dist stays enabled? nASSGIreq is RO */
- if (was_enabled && dist->enabled) {
- val &= ~GICD_CTLR_nASSGIreq;
- val |= FIELD_PREP(GICD_CTLR_nASSGIreq, is_hwsgi);
- }
+ if (was_enabled && dist->enabled)
+ FIELD_MODIFY(GICD_CTLR_nASSGIreq, &val, is_hwsgi);
/* Switching HW SGIs? */
dist->nassgireq = val & GICD_CTLR_nASSGIreq;
--
2.34.1
More information about the linux-arm-kernel
mailing list