All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	nikolay@nvidia.com, roopa@nvidia.com, kuba@kernel.org,
	davem@davemloft.net
Subject: Re: [Bridge] [PATCH] net: bridge: Slightly optimize 'find_portno()'
Date: Tue, 16 Nov 2021 11:32:37 +0300	[thread overview]
Message-ID: <20211116083237.GH26989@kadam> (raw)
In-Reply-To: <b3c93506-7dc8-a5fe-6cfc-938fc88b9f07@wanadoo.fr>

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


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: roopa@nvidia.com, nikolay@nvidia.com, davem@davemloft.net,
	kuba@kernel.org, bridge@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] net: bridge: Slightly optimize 'find_portno()'
Date: Tue, 16 Nov 2021 11:32:37 +0300	[thread overview]
Message-ID: <20211116083237.GH26989@kadam> (raw)
In-Reply-To: <b3c93506-7dc8-a5fe-6cfc-938fc88b9f07@wanadoo.fr>

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


  reply	other threads:[~2021-11-16  8:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-14 19:02 [Bridge] [PATCH] net: bridge: Slightly optimize 'find_portno()' Christophe JAILLET
2021-11-14 19:02 ` Christophe JAILLET
2021-11-15 12:35 ` [Bridge] " Dan Carpenter
2021-11-15 12:35   ` Dan Carpenter
2021-11-15 18:35   ` [Bridge] " Christophe JAILLET
2021-11-15 18:35     ` Christophe JAILLET
2021-11-16  8:32     ` Dan Carpenter [this message]
2021-11-16  8:32       ` Dan Carpenter
2021-11-15 12:57 ` [Bridge] " Nikolay Aleksandrov
2021-11-15 12:57   ` Nikolay Aleksandrov
2021-11-15 14:10 ` [Bridge] " patchwork-bot+netdevbpf
2021-11-15 14:10   ` patchwork-bot+netdevbpf

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=20211116083237.GH26989@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=davem@davemloft.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@nvidia.com \
    --cc=roopa@nvidia.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.