[PATCH] KVM: s390: gmap: use assign_bit() where applicable

From: Peng Fan (OSS)

Date: Sat Sep 19 2026 - 22:29:51 EST


From: Peng Fan <peng.fan@xxxxxxx>

Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
---
arch/s390/kvm/gmap/gmap.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/arch/s390/kvm/gmap/gmap.c b/arch/s390/kvm/gmap/gmap.c
index 3f3fa864cc36..89a5ed4ac440 100644
--- a/arch/s390/kvm/gmap/gmap.c
+++ b/arch/s390/kvm/gmap/gmap.c
@@ -90,20 +90,13 @@ static void gmap_add_child(struct gmap *parent, struct gmap *child)

child->parent = parent;

- if (is_ucontrol(parent))
- set_bit(GMAP_FLAG_IS_UCONTROL, &child->flags);
- else
- clear_bit(GMAP_FLAG_IS_UCONTROL, &child->flags);
+ assign_bit(GMAP_FLAG_IS_UCONTROL, &child->flags, is_ucontrol(parent));

- if (test_bit(GMAP_FLAG_ALLOW_HPAGE_1M, &parent->flags))
- set_bit(GMAP_FLAG_ALLOW_HPAGE_1M, &child->flags);
- else
- clear_bit(GMAP_FLAG_ALLOW_HPAGE_1M, &child->flags);
+ assign_bit(GMAP_FLAG_ALLOW_HPAGE_1M, &child->flags,
+ test_bit(GMAP_FLAG_ALLOW_HPAGE_1M, &parent->flags));

- if (test_bit(GMAP_FLAG_ALLOW_HPAGE_2G, &parent->flags))
- set_bit(GMAP_FLAG_ALLOW_HPAGE_2G, &child->flags);
- else
- clear_bit(GMAP_FLAG_ALLOW_HPAGE_2G, &child->flags);
+ assign_bit(GMAP_FLAG_ALLOW_HPAGE_2G, &child->flags,
+ test_bit(GMAP_FLAG_ALLOW_HPAGE_2G, &parent->flags));

if (kvm_is_ucontrol(parent->kvm))
clear_bit(GMAP_FLAG_OWNS_PAGETABLES, &child->flags);
--
2.51.0