Re: [PATCH] KVM: s390: gmap: use assign_bit() where applicable
From: Peng Fan
Date: Mon Sep 21 2026 - 03:18:38 EST
On Mon, Sep 21, 2026 at 09:06:26AM +0200, Christian Borntraeger wrote:
>
>
>Am 20.09.26 um 18:18 schrieb Heiko Carstens:
>> On Sun, Sep 20, 2026 at 10:26:25AM +0800, Peng Fan (OSS) wrote:
>> > 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(-)
>> ...
>> > - 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));
>>
>> This turns something which was easily readable into an unreadable mess.
>
>I agree, this is not a good use for the assign_bit helper.
No problem. Let's drop the patch.
Thanks,
Peng
>
>