mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Leon Romanovsky <leon@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH net-next][resend v1 1/1] netlink: Don't use int as bool in netlink_update_socket_mc()
Date: Tue, 11 Jul 2023 12:21:12 +0200	[thread overview]
Message-ID: <2a2d55f167a06782eb9dfa6988ec96c2eedb7fba.camel@redhat.com> (raw)
In-Reply-To: <20230711063348.GB41919@unreal>

On Tue, 2023-07-11 at 09:33 +0300, Leon Romanovsky wrote:
> On Mon, Jul 10, 2023 at 01:06:24PM +0300, Andy Shevchenko wrote:
> > The bit operations take boolean parameter and return also boolean
> > (in test_bit()-like cases). Don't threat booleans as integers when
> > it's not needed.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  net/netlink/af_netlink.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
> > index 383631873748..d81e7a43944c 100644
> > --- a/net/netlink/af_netlink.c
> > +++ b/net/netlink/af_netlink.c
> > @@ -1623,9 +1623,10 @@ EXPORT_SYMBOL(netlink_set_err);
> >  /* must be called with netlink table grabbed */
> >  static void netlink_update_socket_mc(struct netlink_sock *nlk,
> >  				     unsigned int group,
> > -				     int is_new)
> > +				     bool new)
> >  {
> > -	int old, new = !!is_new, subscriptions;
> > +	int subscriptions;
> > +	bool old;
> >  
> >  	old = test_bit(group - 1, nlk->groups);
> >  	subscriptions = nlk->subscriptions - old + new;
> 
> So what is the outcome of "int - bool + bool" in the line above?

FTR, I agree with Leon, the old code is more readable to me/I don't see
a practical gain with this change.

Cheers,

Paolo


  reply	other threads:[~2023-07-11 10:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 10:06 Andy Shevchenko
2023-07-11  6:33 ` Leon Romanovsky
2023-07-11 10:21   ` Paolo Abeni [this message]
2023-07-11 10:54     ` Andy Shevchenko
2023-07-11 12:20       ` Leon Romanovsky
2023-07-11 12:45         ` Andy Shevchenko
2023-07-11 13:32           ` Leon Romanovsky
2023-07-11 13:44             ` Andy Shevchenko
2023-07-11 17:10               ` Leon Romanovsky
2023-07-11 17:19                 ` Andy Shevchenko
2023-07-12  0:43 ` Jakub Kicinski

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=2a2d55f167a06782eb9dfa6988ec96c2eedb7fba.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 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®