Re: [PATCH] s390/time: use assign_bit() where applicable
From: Heiko Carstens
Date: Sun Sep 20 2026 - 12:22:40 EST
On Sun, Sep 20, 2026 at 10:28:00AM +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/kernel/time.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
...
> - if (rc)
> - clear_bit(CLOCK_SYNC_STPINFO_VALID, &clock_sync_flags);
> - else
> - set_bit(CLOCK_SYNC_STPINFO_VALID, &clock_sync_flags);
> + assign_bit(CLOCK_SYNC_STPINFO_VALID, &clock_sync_flags, !rc);
> return rc;
...
> mutex_lock(&stp_mutex);
> stp_online = value;
> - if (stp_online)
> - set_bit(CLOCK_SYNC_STP, &clock_sync_flags);
> - else
> - clear_bit(CLOCK_SYNC_STP, &clock_sync_flags);
> + assign_bit(CLOCK_SYNC_STP, &clock_sync_flags, stp_online);
I don't know why all those trivial helper functions which obfuscate
the code are introduced. Before it was very obvious what the code did,
now I have to look up assign_bit() just to figure out that it is a
completely trivial helper function, with close to zero benefit.