[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190611154746.GF4324@fuggles.cambridge.arm.com>
Date: Tue, 11 Jun 2019 16:47:46 +0100
From: Will Deacon <will.deacon@....com>
To: Masahiro Yamada <yamada.masahiro@...ionext.com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Catalin Marinas <catalin.marinas@....com>
Subject: Re: [PATCH 1/2] linux/bits.h: make BIT(), GENMASK(), and friends
available in assembly
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 <yamada.masahiro@...ionext.com>
> ---
>
> include/linux/bits.h | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
Acked-by: Will Deacon <will.deacon@....com>
Will
Powered by blists - more mailing lists