From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2C81C433EF for ; Tue, 16 Nov 2021 01:39:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D0D5561A7C for ; Tue, 16 Nov 2021 01:39:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357725AbhKPBmE (ORCPT ); Mon, 15 Nov 2021 20:42:04 -0500 Received: from smtp08.smtpout.orange.fr ([80.12.242.130]:55991 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242575AbhKOSis (ORCPT ); Mon, 15 Nov 2021 13:38:48 -0500 Received: from [192.168.1.18] ([86.243.171.122]) by smtp.orange.fr with ESMTPA id mgpYmlwNfHQrlmgpYml2nB; Mon, 15 Nov 2021 19:35:50 +0100 X-ME-Helo: [192.168.1.18] X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Mon, 15 Nov 2021 19:35:50 +0100 X-ME-IP: 86.243.171.122 Subject: Re: [PATCH] net: bridge: Slightly optimize 'find_portno()' To: Dan Carpenter 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 References: <00c39d09c8df7ad0673bf2043f6566d6ef08b789.1636916479.git.christophe.jaillet@wanadoo.fr> <20211115123534.GD26989@kadam> From: Christophe JAILLET Message-ID: Date: Mon, 15 Nov 2021 19:35:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20211115123534.GD26989@kadam> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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