[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b3c93506-7dc8-a5fe-6cfc-938fc88b9f07@wanadoo.fr>
Date: Mon, 15 Nov 2021 19:35:48 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Dan Carpenter <dan.carpenter@...cle.com>
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()'
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.
>
> regards,
> dan carpenter
>
>
>
Hi Dan,
- checkpatch prefers the style without {}
- Usually, greg k-h and Joe Perches give feed-back that extra {} should
be removed.
- 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."
My own preference is to have {}. It is the standard used on another
project I work on (i.e. httpd) and it helps when you add some code (it
avoids unexpected behavior if you forget to add some missing {})
My understanding is that on the HUGE code base of Linux, emphasis is put
on saving some lines of code, reducing the length of lines and avoiding
the need to read some extra char.
I'm also fine with it.
CJ
Powered by blists - more mailing lists