Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935223AbeAITVn (ORCPT + 1 other); Tue, 9 Jan 2018 14:21:43 -0500 Received: from smtprelay0147.hostedemail.com ([216.40.44.147]:44213 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933847AbeAITVm (ORCPT ); Tue, 9 Jan 2018 14:21:42 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: sign90_65cf0e113073d X-Filterd-Recvd-Size: 3161 Message-ID: <1515525697.9619.100.camel@perches.com> Subject: Re: [PATCH] staging: pi433: remove unnecessary parentheses From: Joe Perches To: Greg Kroah-Hartman , Valentin Vidic , David Miller Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Marcin Ciupak , Marcus Wolf , Simon =?ISO-8859-1?Q?Sandstr=F6m?= Date: Tue, 09 Jan 2018 11:21:37 -0800 In-Reply-To: <20180109143148.GB608@kroah.com> References: <20180108173855.19366-1-Valentin.Vidic@CARNet.hr> <20180109143148.GB608@kroah.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Tue, 2018-01-09 at 15:31 +0100, Greg Kroah-Hartman wrote: > On Mon, Jan 08, 2018 at 06:38:55PM +0100, Valentin Vidic wrote: > > Fixes checkpatch warnings: > > CHECK: Unnecessary parentheses around 'mantisse != mantisse16' > > CHECK: Unnecessary parentheses around 'mantisse != mantisse20' > > CHECK: Unnecessary parentheses around 'mantisse != mantisse24' [] > > diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c [] > > @@ -391,9 +391,9 @@ static int rf69_set_bandwidth_intern(struct spi_device *spi, u8 reg, > > return -EINVAL; > > } > > > > - if ((mantisse != mantisse16) && > > - (mantisse != mantisse20) && > > - (mantisse != mantisse24)) { > > + if (mantisse != mantisse16 && > > + mantisse != mantisse20 && > > + mantisse != mantisse24) { > > I'm getting really tired of seeing this checkpatch warning, when it's a > major pain. Your idea of major pain and mine differ a bit. > Joe, can you please turn these off. Patches like this will force people > to have to remember that != is higher precidence than &&. As it's not just 1 precedence level but 4 and 5, it really shouldn't be that hard to remember. > The original code here was just fine. And I don't really disagree with you. David Miller has a preference for the parenthesis free style. I believe he mentioned it sometime in August 2017 but I can't find it right now. Anyway, perhaps --- scripts/checkpatch.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d2464058ab5d..3a7499de2c2d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4526,7 +4526,9 @@ sub process { } # check for unnecessary parentheses around comparisons in if uses - if ($^V && $^V ge 5.10.0 && defined($stat) && +# when !drivers/staging or the command-line uses --strict + if (($realfile !~ m@^(?:drivers/staging/)@ || $check_orig) && + $^V && $^V ge 5.10.0 && defined($stat) && $stat =~ /(^.\s*if\s*($balanced_parens))/) { my $if_stat = $1; my $test = substr($2, 1, -1);