Return-path: Received: from perches-mx.perches.com ([206.117.179.246]:33045 "EHLO labridge.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758014Ab2BIXIk (ORCPT ); Thu, 9 Feb 2012 18:08:40 -0500 Message-ID: <1328828918.29329.21.camel@joe2Laptop> (sfid-20120210_000845_270016_2BC46301) Subject: RE: [PATCH net-next] drivers/net: Remove boolean comparisons to true/false From: Joe Perches To: "Allan, Bruce W" , Julia Lawall Cc: "Kirsher, Jeffrey T" , David Miller , "David.Laight@ACULAB.COM" , "netdev@vger.kernel.org" , linux-wireless Date: Thu, 09 Feb 2012 15:08:38 -0800 In-Reply-To: <804857E1F29AAC47BF68C404FC60A1842709C1@ORSMSX102.amr.corp.intel.com> References: <1328783282-17760-5-git-send-email-jeffrey.t.kirsher@intel.com> <20120209.133413.349832435589531136.davem@davemloft.net> <1328822243.29329.11.camel@joe2Laptop> <1328822935.2242.1.camel@jtkirshe-mobl> <804857E1F29AAC47BF68C404FC60A1842709C1@ORSMSX102.amr.corp.intel.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org List-ID: On Thu, 2012-02-09 at 22:36 +0000, Allan, Bruce W wrote: > > On Thu, 2012-02-09 at 13:17 -0800, Joe Perches wrote: > > > Booleans should not be compared to true or false > > > but be directly tested or tested with !. > > > > > > Done via cocci script: > > > > > > @@ > > > bool t; > > > @@ > > > - t == true > > > + t > > > @@ > > > bool t; > > > @@ > > > - t != true > > > + !t > > > @@ > > > bool t; > > > @@ > > > - t == false > > > + !t > > > @@ > > > bool t; > > > @@ > > > - t != false > > > + t > Has the cocci script been (or will it be) added to ./scripts/coccinelle? These are pretty trivial scripts. You're welcome to add it or combine it with the one Rusty did to convert bool foo = 1 to bool foo = true https://lkml.org/lkml/2011/12/19/15