Received: by 10.213.65.68 with SMTP id h4csp4069899imn; Tue, 10 Apr 2018 08:48:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/U0SB+8iJwsEunZkxjpKV6tVbiynzdrQCFzzxNwUpqir6WPxTCHdg60IJfG0TyTB8+UTCx X-Received: by 2002:a17:902:8d84:: with SMTP id v4-v6mr964837plo.215.1523375284796; Tue, 10 Apr 2018 08:48:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523375284; cv=none; d=google.com; s=arc-20160816; b=Cm4qYEr3BoIUZmhlrcfsPL3O8yGeaKI6qiVPPBGCYkKfCuGkLuhvfA48LiCJDSm0aw zkmJAhlAYK8+NyNkOMSI3FTe1ogMS01eLzmYfjaojOSjW+Si0DZ4HmruYZvnOcsVomZs z84gFUGeS3stPJHISmt1+MSYyq+0N54wQTCTeD7vLiEi2wB3OoNWx5l8OxCJaKj6jZA+ lquNxJjYrJ8095nLJcGvszZo8O1ZcVnZhIAOi7+b0Cb+OqfYu3URZczmEUSDwtsmZnap qU93K2Ea0jX7LKxluc2crDHhEWmEmsnf34pxLdTbwdCyqbvr8DFf7k8Oia03AVCkufRj Uy8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=FVktRMNbJ680Z6RrFeEbJlMvqJ0mPFTpUIb1iRAr7dA=; b=LSLcD6oSue1oMcWYrIaFLCWa87wKHZ2z4tMJk1F8WhdUE9+glEX7lbsAlGf4BbwkcK XaXcDoNPJuQswaw7r9BXb1AQms6uhrSKzTuBWi6EZ2J7WFzudxFrKGQfKgukzewwSpnT PfCGNYtBxpfv+tPNpsaZul385+J0Rif6okIQPE16POZCiReUVZkME36QDVj8NKbwG0Be aacYC834+Oxr+8YszI5HZ/yjALO7T7IosqMsvkhuRRTUlzTX6UzqcY7erMByuvQlzWva nFAP7tCRfalj32nSaQXdCO93w8q7m0q1ilrpvcnujvrbooTdRiJTVYlIGzvITRG0WAiQ +0+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4-v6si2758603plb.741.2018.04.10.08.47.25; Tue, 10 Apr 2018 08:48:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752100AbeDJPlN (ORCPT + 99 others); Tue, 10 Apr 2018 11:41:13 -0400 Received: from smtprelay0128.hostedemail.com ([216.40.44.128]:43749 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751604AbeDJPlL (ORCPT ); Tue, 10 Apr 2018 11:41:11 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id 6A9EA180A8439; Tue, 10 Apr 2018 15:41:09 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::,RULES_HIT:41:355:379:541:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1540:1593:1594:1711:1714:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3351:3865:3870:3871:4321:5007:10004:10400:10848:11658:11914:12043:12048:12555:12760:12895:12986:13069:13311:13357:13439:14181:14394:14659:14721:21080:21627:30054:30060:30070,0,RBL:error,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:20,LUA_SUMMARY:none X-HE-Tag: pest08_7e34442566f4e X-Filterd-Recvd-Size: 2214 Received: from XPS-9350.home (unknown [47.151.150.235]) (Authenticated sender: joe@perches.com) by omf04.hostedemail.com (Postfix) with ESMTPA; Tue, 10 Apr 2018 15:41:07 +0000 (UTC) Message-ID: Subject: [PATCH] checkpatch: whinge about bool bitfields From: Joe Perches To: Peter Zijlstra , "Rafael J. Wysocki" , Andrew Morton , Andy Whitcroft Cc: yuankuiz@codeaurora.org, Linux PM , "Rafael J. Wysocki" , Frederic Weisbecker , Thomas Gleixner , paulmck@linux.vnet.ibm.com, Ingo Molnar , Len Brown , Linux Kernel Mailing List Date: Tue, 10 Apr 2018 08:41:05 -0700 In-Reply-To: <20180410123305.GF4082@hirez.programming.kicks-ass.net> References: <891d4f632fbff5052e11f2d0b6fac35d@codeaurora.org> <20180410123305.GF4082@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.0-4 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using bool in a bitfield isn't a good idea as the alignment behavior is arch implementation defined. Suggest using unsigned int or u<8|16|32> instead. Signed-off-by: Joe Perches Suggested-by: Peter Zijlstra --- scripts/checkpatch.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index eb534d48140e..e16d6713f236 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -6251,6 +6251,12 @@ sub process { } } +# check for bool bitfields + if ($sline =~ /^.\s+bool\s*$Ident\s*:\s*\d+\s*;/) { + WARN("BOOL_BITFIELD", + "Avoid using bool as bitfield. Prefer bool bitfields as unsigned int or u<8|16|32>\n" . $herecurr); + } + # check for semaphores initialized locked if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { WARN("CONSIDER_COMPLETION",