* [PATCH] s390/time: use assign_bit() where applicable
@ 2026-09-20 2:28 Peng Fan (OSS)
2026-09-20 16:22 ` Heiko Carstens
0 siblings, 1 reply; 3+ messages in thread
From: Peng Fan (OSS) @ 2026-09-20 2:28 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
Christian Borntraeger, Sven Schnelle, Thomas Richter,
Jakub Kicinski, Peng Fan
Cc: linux-kernel, linux-s390
From: Peng Fan <peng.fan@nxp.com>
Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/s390/kernel/time.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 2b989bebd220..3225a66abfce 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -501,10 +501,7 @@ static int __store_stpinfo(void)
{
int rc = chsc_sstpi(stp_page, &stp_info, sizeof(struct stp_sstpi));
- 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;
}
@@ -795,10 +792,7 @@ static ssize_t online_store(struct device *dev,
return -EOPNOTSUPP;
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);
queue_work(time_sync_wq, &stp_work);
mutex_unlock(&stp_mutex);
return count;
--
2.51.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] s390/time: use assign_bit() where applicable
2026-09-20 2:28 [PATCH] s390/time: use assign_bit() where applicable Peng Fan (OSS)
@ 2026-09-20 16:22 ` Heiko Carstens
2026-09-21 0:45 ` Peng Fan
0 siblings, 1 reply; 3+ messages in thread
From: Heiko Carstens @ 2026-09-20 16:22 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
Sven Schnelle, Thomas Richter, Jakub Kicinski, Peng Fan,
linux-kernel, linux-s390
On Sun, Sep 20, 2026 at 10:28:00AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] s390/time: use assign_bit() where applicable
2026-09-20 16:22 ` Heiko Carstens
@ 2026-09-21 0:45 ` Peng Fan
0 siblings, 0 replies; 3+ messages in thread
From: Peng Fan @ 2026-09-21 0:45 UTC (permalink / raw)
To: Heiko Carstens
Cc: Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
Sven Schnelle, Thomas Richter, Jakub Kicinski, Peng Fan,
linux-kernel, linux-s390
On Sun, Sep 20, 2026 at 06:22:16PM +0200, Heiko Carstens wrote:
>On Sun, Sep 20, 2026 at 10:28:00AM +0800, Peng Fan (OSS) wrote:
>> From: Peng Fan <peng.fan@nxp.com>
>>
>> Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
>>
>> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> ---
>> 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.
This API was introduced by
9a8ac3ae682e ("dm mpath: cleanup QUEUE_IF_NO_PATH bit manipulation by introducing assign_bit()")
And moved to include/linux/bitops.h for broader usage.
I think it would be good for us to save lines.
Drop this patch since you disable it.
Thanks,
Peng
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-21 0:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-20 2:28 [PATCH] s390/time: use assign_bit() where applicable Peng Fan (OSS)
2026-09-20 16:22 ` Heiko Carstens
2026-09-21 0:45 ` Peng Fan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®