All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@oss.nxp.com>
To: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Thomas Richter <tmricht@linux.ibm.com>,
	Jakub Kicinski <kuba@kernel.org>, Peng Fan <peng.fan@nxp.com>,
	linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: Re: [PATCH] s390/time: use assign_bit() where applicable
Date: Mon, 21 Sep 2026 08:45:04 +0800	[thread overview]
Message-ID: <arB+EAGRKQ6OTakM@shlinux89> (raw)
In-Reply-To: <20260920162216.18515C2c-hca@linux.ibm.com>

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
>
>

      reply	other threads:[~2026-09-21  0:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20  2:28 [PATCH] s390/time: use assign_bit() where applicable Peng Fan (OSS)
2026-09-20  2:33 ` sashiko-bot
2026-09-20 16:22 ` Heiko Carstens
2026-09-21  0:45   ` Peng Fan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=arB+EAGRKQ6OTakM@shlinux89 \
    --to=peng.fan@oss.nxp.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=svens@linux.ibm.com \
    --cc=tmricht@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.