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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 9DA38C2B9F8 for ; Mon, 24 May 2021 12:29:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8069C61209 for ; Mon, 24 May 2021 12:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232864AbhEXMai (ORCPT ); Mon, 24 May 2021 08:30:38 -0400 Received: from foss.arm.com ([217.140.110.172]:41710 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232476AbhEXMah (ORCPT ); Mon, 24 May 2021 08:30:37 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 02C2C113E; Mon, 24 May 2021 05:29:09 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.38.161]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D91A03F719; Mon, 24 May 2021 05:29:04 -0700 (PDT) Date: Mon, 24 May 2021 13:29:01 +0100 From: Mark Rutland To: Christoph Hellwig Cc: Joe Richey , trivial@kernel.org, Joe Richey , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Paolo Bonzini , Lorenzo Pieralisi , Mauro Carvalho Chehab , Zhangfei Gao , Zhou Wang , 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 Subject: Re: [PATCH 0/6] Don't use BIT() macro in UAPI headers Message-ID: <20210524122901.GH1040@C02TD0UTHF1T.local> References: <20210520104343.317119-1-joerichey94@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, May 24, 2021 at 12:46:26PM +0100, Christoph Hellwig wrote: > On Thu, May 20, 2021 at 03:43:37AM -0700, Joe Richey wrote: > > This patch series changes all UAPI uses of BIT() to just be open-coded. > > However, there really should be a check for this in checkpatch.pl > > Currently, the script actually _encourages_ users to use the BIT macro > > even if adding things to UAPI. > > Yes. In fact it should warn about BIT() in general. It is totally > pointless obsfucation that doesn't even save any typing at all. That's not quite true; the point is that if you use BIT() consistently, then even when you refer to bits 32 to 63 you won't accidentally introduce shifts of more than the width of int, and the definition will work equally well for assembly and C, which isn't true if you use `1UL` in the definition. With that in mind it's shorter and clearer than its functional equivalent: BIT(x) (UL(1) << (x)) So IMO it's preferable to use BIT() generally, or _BITUL() in uapi headers. Thanks, Mark.