[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20211116083237.GH26989@kadam>
Date: Tue, 16 Nov 2021 11:32:37 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: roopa@...dia.com, nikolay@...dia.com, davem@...emloft.net,
kuba@...nel.org, bridge@...ts.linux-foundation.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] net: bridge: Slightly optimize 'find_portno()'
On Mon, Nov 15, 2021 at 07:35:48PM +0100, Christophe JAILLET wrote:
> Le 15/11/2021 à 13:35, Dan Carpenter a écrit :
> > On Sun, Nov 14, 2021 at 08:02:35PM +0100, Christophe JAILLET wrote:
> > > The 'inuse' bitmap is local to this function. So we can use the
> > > non-atomic '__set_bit()' to save a few cycles.
> > >
> > > While at it, also remove some useless {}.
> >
> > I like the {} and tend to add it in new code. There isn't a rule about
> > this one way or the other.
> >
[ heavily snipped ]
>
> - checkpatch prefers the style without {}
Not for these.
> - Usually, greg k-h and Joe Perches give feed-back that extra {} should be
> removed.
I can't find any reference to that.
> - in https://www.kernel.org/doc/html/v5.13/process/coding-style.html, after
> "Rationale: K&R":
> "Do not unnecessarily use braces where a single statement will do."
There are exceptions for readability. For example, mutiline indents
get it whether they need or not. Do while statements get braces.
Quite a lot of people don't use braces for list_for_each() unless it's
required, definitely, but I think it's allowable.
regards,
dan carpenter
Powered by blists - more mailing lists