From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B01EC47078 for ; Fri, 21 May 2021 14:47:15 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 859EB60720 for ; Fri, 21 May 2021 14:47:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 859EB60720 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Date:Cc:To:From: Subject:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NMSfCxf0Ad6nU/d2U+yNEKDMgE7uA2ulKXrh4paHi5U=; b=RB+7xJ81LoPHdTUHfhbqs6egsx UP81Cl4R1L7Za4GsZTiu8svlIqJ05VW9vbttTJWCxiApGhRe6TTWgxckhLVaEtAKAIx9ClSFJm0tv RZO59MR8Ix4Qh92fr8isq66YHbSKKJGf0mG8rFg2YTNApvHd/lZ95Uv2PkVqwyycArSPYaRY0P733 5+oa1yktZWGFyHV7eMr+/6cWld5/ImjinRcwETXxeUsf4xkw8rtVCtL14IagnoUpmGbbefkVk0DLu d+ma5EFrLobyPjYv/fxXxgTTHlxxHbNul8qPNfhQ8T9XdjRdW4tfx4ElfihQatz7vs45SM/tx+t1d JUKKs2Kg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk6PM-005oC8-JP; Fri, 21 May 2021 14:45:48 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk6PJ-005oAh-EB for linux-arm-kernel@desiato.infradead.org; Fri, 21 May 2021 14:45:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=Se9UoClVFqKZKcFRcttJrMF4e3WdLsgwZ+f+7u7mSFc=; b=VR322nZxpfRZ5VXNCfquDIEPr3 Xic9EIF+WbiDIDmt1RQZHqMPRyRkN0s2mtbWE9hIPnTnkaPIZLM+pI2JbViroelbh3Uv8XizBAeqR SJ2WGDUCwdeV494HPIpXbk3YP0KQY7dl7CHEzTp3ugnxYKvMGISRDRTB0ZkaBHOjWwpbqAsmdCwN5 kCkpOAn5m88AwXp79cGVe90wpSGkA90hXN31p+HEoVNL1KXL8yvGOM3INYMDnLiFj7MHFrh5OPBSm ZOx2opv/2FH+dRwVV9Mhlkzi1WUFfV9CsAE6rsiyEq+q2V+HavrEMTNB9I5PiGSKFmZ1Ys77+Dbtd c3s7M12g==; Received: from smtprelay0042.hostedemail.com ([216.40.44.42] helo=smtprelay.hostedemail.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lk6PG-00HCaV-Il for linux-arm-kernel@lists.infradead.org; Fri, 21 May 2021 14:45:43 +0000 Received: from omf03.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id BE128D218; Fri, 21 May 2021 14:45:37 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf03.hostedemail.com (Postfix) with ESMTPA id 74ED713D95; Fri, 21 May 2021 14:45:25 +0000 (UTC) Message-ID: <9d8659fc8bc0729dd255c20234fb1a4210847ce9.camel@perches.com> Subject: Re: [PATCH v2 7/7] checkpatch: suggest _BITULL() and _BITUL() for UAPI headers From: Joe Perches To: Joe Richey , trivial@kernel.org, Andrew Morton Cc: Joe Richey , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Paolo Bonzini , Mark Rutland , Lorenzo Pieralisi , Mauro Carvalho Chehab , Zhangfei Gao , Zhou Wang , Andy Whitcroft , Dwaipayan Ray , Lukas Bulwahn , Sasha Levin , "Chang S. Bae" , Andi Kleen , Peter Xu , Lei Cao , Ulf Hansson , Daniel Lezcano , "Rafael J. Wysocki" , Jean-Philippe Brucker , Zaibo Xu , Greg Kroah-Hartman , Hans Verkuil , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-accelerators@lists.ozlabs.org Date: Fri, 21 May 2021 07:45:23 -0700 In-Reply-To: <20210521085849.37676-8-joerichey94@gmail.com> References: <20210520104343.317119-1-joerichey94@gmail.com> <20210521085849.37676-1-joerichey94@gmail.com> <20210521085849.37676-8-joerichey94@gmail.com> User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 X-Stat-Signature: qn5g8k3jtqoj4kuui4tsua91y1s1o8zk X-Rspamd-Server: rspamout04 X-Rspamd-Queue-Id: 74ED713D95 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1/+/DrG8NEx+1xztaZeFya67FR2cEwvbqU= X-HE-Tag: 1621608325-902736 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210521_074542_690615_FF7306B9 X-CRM114-Status: GOOD ( 17.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 2021-05-21 at 01:58 -0700, Joe Richey wrote: > From: Joe Richey > = > Instead of just ignoring UAPI headers, reccomend the UAPI compatible > macros if a user adds something that looks like (1 << n). Normal kernel > code will continue to get BIT_ULL() and BIT() reccomended. > = > This change also modifies the $realfile regex to match headers that have > "include/uapi" anywhere in their path so paths like: > =A0=A0=A0=A0tools/include/uapi/linux/kvm.h > =A0=A0=A0=A0arch/x86/include/uapi/asm/hwcap2.h > get recognized as UAPI headers. [] > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -7020,15 +7020,17 @@ sub process { > =A0 } > =A0 } > =A0 > = > -# check for #defines like: 1 << that could be BIT(digit), it is = not exported to uapi > - if ($realfile !~ m@^include/uapi/@ && > - $line =3D~ /#\s*define\s+\w+\s+\(?\s*1\s*([ulUL]*)\s*\<\<\s*(?:\d+= |$Ident)\s*\)?/) { > - my $ull =3D ""; > - $ull =3D "_ULL" if (defined($1) && $1 =3D~ /ll/i); > +# check for #defines like: 1 << that could be BIT(digit) or simi= lar > + if ($line =3D~ /#\s*define\s+\w+\s+\(?\s*1\s*([ulUL]*)\s*\<\<\s*(?:\d+= |$Ident)\s*\)?/) { > + my $ull =3D (defined($1) && $1 =3D~ /ll/i); > + my $macroname =3D $ull ? "BIT_ULL" : "BIT"; > + if ($realfile =3D~ m@include/uapi/@) { Likely better with \b if ($realfile =3D~ m@\binclude/uapi/@) { > + $macroname =3D $ull ? "_BITULL" : "_BITUL"; > + } > =A0 if (CHK("BIT_MACRO", > - "Prefer using the BIT$ull macro\n" . $herecurr) && > + "Prefer using the $macroname macro\n" . $herecurr) && > =A0 $fix) { > - $fixed[$fixlinenr] =3D~ s/\(?\s*1\s*[ulUL]*\s*<<\s*(\d+|$Ident)\s*\)= ?/BIT${ull}($1)/; > + $fixed[$fixlinenr] =3D~ s/\(?\s*1\s*[ulUL]*\s*<<\s*(\d+|$Ident)\s*\)= ?/${macroname}($1)/; Doesn't need braces $fixed[$fixlinenr] =3D~ s/\(?\s*1\s*[ulUL]*\s*<<\s*(\d+|$Ident)\s*\)?/$= macroname($1)/; Otherwise, fine by me. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel