From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933403AbcE3Od7 (ORCPT ); Mon, 30 May 2016 10:33:59 -0400 Received: from smtprelay0075.hostedemail.com ([216.40.44.75]:33131 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933360AbcE3Od5 (ORCPT ); Mon, 30 May 2016 10:33:57 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2693:2828:3138:3139:3140:3141:3142:3150:3353:3622:3865:3866:3867:3868:3870:3871:3872:4321:5007:10004:10400:10848:11026:11232:11658:11914:12296:12438:12517:12519:12740:13069:13161:13229:13255:13311:13357:13439:13894:14181:14659:14721:21080:21324:21433:21434:30012:30054:30064:30074:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: card78_794bdb34fea5b X-Filterd-Recvd-Size: 2283 Message-ID: <1464618832.14627.23.camel@perches.com> Subject: Re: [PATCH trivial] include/linux/memblock.h: Clean up code for several trivial details From: Joe Perches To: Chen Gang , akpm@linux-foundation.org, trivial@kernel.org Cc: kuleshovmail@gmail.com, tony.luck@intel.com, tangchen@cn.fujitsu.com, will.deacon@arm.com, holt@sgi.com, ard.biesheuvel@linaro.org, kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org, Chen Gang Date: Mon, 30 May 2016 07:33:52 -0700 In-Reply-To: <574C4C4F.8080609@emindsoft.com.cn> References: <1464532567-6353-1-git-send-email-chengang@emindsoft.com.cn> <1464534527.14627.9.camel@perches.com> <574C4C4F.8080609@emindsoft.com.cn> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2016-05-30 at 22:21 +0800, Chen Gang wrote: > On 5/29/16 23:08, Joe Perches wrote: > > On Sun, 2016-05-29 at 22:36 +0800, chengang@emindsoft.com.cn wrote: > > > Use "!!" to let the boolean function return boolean value directly. > > [] > > > diff --git a/include/linux/memblock.h b/include/linux/memblock.h > > [] > > > @@ -191,12 +190,12 @@ static inline bool movable_node_is_enabled(void) > > >  static inline bool memblock_is_mirror(struct memblock_region *m) > > >  { > > > - return m->flags & MEMBLOCK_MIRROR; > > > + return !!(m->flags & MEMBLOCK_MIRROR); > > These !! uses are't necessary. > > The compiler makes the bool return 0 or 1. > No, they are not necessary. But for me, it will be more clearer, since > in our kernel (at least in include/linux/), almost all Boolean functions > use Boolean value or expression for return (and "!!" are often used). Opinions vary. There seem to be fewer than 20 !! uses in bool return functions in include/linux/ Finding the quantity of bool conversions in include/linux from something other than 0, 1, true, or false to 0 or 1 is not trivial, but it is non-zero and seems rather more than 20.