Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3380187pxj; Mon, 24 May 2021 05:31:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzna8x55dlgpdx9eNjEr7TY7K6l/ZF1fd0qxS/sNii68r3eDMpwOXztoRdUYviyaZrf4j5i X-Received: by 2002:a6b:b409:: with SMTP id d9mr14343693iof.57.1621859519599; Mon, 24 May 2021 05:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621859519; cv=none; d=google.com; s=arc-20160816; b=ZcasOd5t83fhx4/uTieObAtAgsx64jx8oqEXYvcpt5+WClJbLBWEs5rrIGfQatSGjd oNhwxdr4dMbQAz4tmjAnOSdKTGsFG4AzQthAyVglW0mdsbEIyTv8ISxEHUd5jz+S0kfp KTRm6KYW0lA/SIrGwLg9LsB6qqtPhTAmZySPEDWMpCMgl+Vmx9cBqNhcbLClk2M9liH5 W69MV+vPfd+oYHXS+MytfzPpDxPV3MSufQAr9tKTFrQjCrn1RpjLv5XrbmQ977uj0AMq 1aGTagEswnBEhiRafghPlKB+IlaIeMauAq2I14ZVB1+5e7REe5e9helEXF1XikgQVAPh 8ngA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=86M4B8/epc9C5RV4Nb7eHhIWUif5lLsG5iDK4yseark=; b=kttGovKA/579PRFkfbt/ttn+eSseMcOwy0mPnbh4YkR4/yyPXCK2Zs3JeB5pXkFxxA AhPrTlB5zoGtfuP8jknUWkr13W5ERE/Y0PIPSuyKepsemVJu0PhAoDl0nsdpaloW/jUQ fLcjhRYJSWxbYDI14Rlf4hPPaicz31Ll8jFjbbuBDLuo7BTrgPVrCRuO+T359Zjws3S8 31i4390E9UTGm7Ctn5nZJBLbqtoxi12hfm9OnnQzxxEMq10Wm8+zzq6z2pA/mvh4+lRb IhgMjnIJRYpT+rqV8vQY0FpghLYVJUR+4BX0v8CSzn0+9Y4c9VuCx+E9IHtlXe80/GxZ ZM0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f2si15955649ioz.41.2021.05.24.05.31.46; Mon, 24 May 2021 05:31:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232867AbhEXMai (ORCPT + 99 others); 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: linux-kernel@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.