From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932133AbcKRQqp (ORCPT ); Fri, 18 Nov 2016 11:46:45 -0500 Received: from casper.infradead.org ([85.118.1.10]:49068 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752526AbcKRQqn (ORCPT ); Fri, 18 Nov 2016 11:46:43 -0500 Date: Fri, 18 Nov 2016 16:46:40 +0000 (GMT) From: James Simmons To: Dan Carpenter cc: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin , Linux Kernel Mailing List , Lustre Development List Subject: Re: [PATCH 12/19] staging: lustre: libcfs: remove == 0 testing In-Reply-To: <20161118105235.GB6266@mwanda> Message-ID: References: <1479411357-28979-1-git-send-email-jsimmons@infradead.org> <1479411357-28979-13-git-send-email-jsimmons@infradead.org> <20161118105235.GB6266@mwanda> User-Agent: Alpine 2.20 (LFD 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161118_164640_861554_231A2254 X-CRM114-Status: GOOD ( 15.58 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 NO_RELAYS Informational: message was not relayed via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Thu, Nov 17, 2016 at 02:35:50PM -0500, James Simmons wrote: > > Testing == 0 is not kernel style so remove this > > type of testing from libcfs. > > > > That's not true. Checkpatch.pl won't complain. > It got lumped in with the checkpatch fixes. Also the __uXX problem is not reported by checkpatch so this patch series covers checkpatch + style issues. > Not everyone has thought about it or agrees with me but there are time > when == 0 is idiomatic. For example, if you are talking about the > *number* zero then it should probably be == 0. If it's like "rc == 0" > then "rc" doesn't mean the number it means success/fail so it should be > "if (!rc) ". But it's intuitive to say "if (len == 0) ". > > The other place is strcmp() and friends where it's much more intuitive: > > strcmp(a, b) == 0 means a == b > strcmp(a, b) < 0 means a < b > strcmp(a, b) != 0 means a != b Oh this I didn't know. I will keep this in mind for the future.