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=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_MUTT 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 614D0C4321A for ; Tue, 11 Jun 2019 15:47:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3043620665 for ; Tue, 11 Jun 2019 15:47:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405444AbfFKPru (ORCPT ); Tue, 11 Jun 2019 11:47:50 -0400 Received: from foss.arm.com ([217.140.110.172]:36418 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405425AbfFKPru (ORCPT ); Tue, 11 Jun 2019 11:47:50 -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 71FB8337; Tue, 11 Jun 2019 08:47:49 -0700 (PDT) Received: from fuggles.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BED713F246; Tue, 11 Jun 2019 08:47:48 -0700 (PDT) Date: Tue, 11 Jun 2019 16:47:46 +0100 From: Will Deacon To: Masahiro Yamada Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Catalin Marinas Subject: Re: [PATCH 1/2] linux/bits.h: make BIT(), GENMASK(), and friends available in assembly Message-ID: <20190611154746.GF4324@fuggles.cambridge.arm.com> References: <20190527083412.26651-1-yamada.masahiro@socionext.com> <20190527083412.26651-2-yamada.masahiro@socionext.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190527083412.26651-2-yamada.masahiro@socionext.com> User-Agent: Mutt/1.11.1+86 (6f28e57d73f2) () Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 27, 2019 at 05:34:11PM +0900, Masahiro Yamada wrote: > BIT(), GENMASK(), etc. are useful to define register bits of hardware. > However, low-level code is often written in assembly, where they are > not available due to the hard-coded 1UL, 0UL. > > In fact, in-kernel headers such as arch/arm64/include/asm/sysreg.h > use _BITUL() instead of BIT() so that the register bit macros are > available in assembly. > > Using macros in include/uapi/linux/const.h have two reasons: > > [1] For use in uapi headers > We should use underscore-prefixed variants for user-space. > > [2] For use in assembly code > Since _BITUL() does not use hard-coded 1UL, it can be used as an > alternative of BIT(). > > For [2], it is pretty easy to change BIT() etc. for use in assembly. > > This allows to replace _BUTUL() in kernel headers with BIT(). > > Signed-off-by: Masahiro Yamada > --- > > include/linux/bits.h | 17 ++++++++++------- > 1 file changed, 10 insertions(+), 7 deletions(-) Acked-by: Will Deacon Will