[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aWFaiEvJyj_35-NK@yury>
Date: Fri, 9 Jan 2026 14:44:08 -0500
From: Yury Norov <ynorov@...dia.com>
To: Petr Tesarik <ptesarik@...e.com>
Cc: Yury Norov <yury.norov@...il.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Richard Henderson <richard.henderson@...aro.org>,
Matt Turner <mattst88@...il.com>,
Magnus Lindholm <linmag7@...il.com>,
Vineet Gupta <vgupta@...nel.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
"Maciej W. Rozycki" <macro@...am.me.uk>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>,
Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Chris Zankel <chris@...kel.net>, Max Filippov <jcmvbkbc@...il.com>,
Patrik Jakobsson <patrik.r.jakobsson@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Robin Murphy <robin.murphy@....com>, Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>, Jakub Kicinski <kuba@...nel.org>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Oliver Neukum <oliver@...kum.org>, Arnd Bergmann <arnd@...db.de>,
Kuan-Wei Chiu <visitorckw@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Marcel Holtmann <marcel@...tmann.org>,
Johan Hedberg <johan.hedberg@...il.com>,
Luiz Augusto von Dentz <luiz.dentz@...il.com>,
Pablo Neira Ayuso <pablo@...filter.org>,
Florian Westphal <fw@...len.de>, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 1/2] bits: introduce ffs_val()
On Fri, Jan 09, 2026 at 08:27:11PM +0100, Petr Tesarik wrote:
> On Fri, 9 Jan 2026 13:26:30 -0500
> Yury Norov <ynorov@...dia.com> wrote:
...
> > In bitops world, something_mask() has a very clear meaning. Consider
> > GENMASK(), BITMAP_FIRST_BYTE_MASK(), __BF_FIELD_CHECK_MASK(), and so
> > on.
> >
> > lsb_mask(), or LSB_MASK() if you prefer, is just right.
>
> I assume you mean BITMAP_FIRST_WORD_MASK(), not btrfs-specific
> BITMAP_FIRST_BYTE_MASK(), defined in fs/btrfs/extent_io.h.
>
> But then it nicely illustrate exactly what I mean:
They all have a consistent meaning:
> BIT_MASK(4) = 0x0000000000000010
A mask constructed from bit #4.
> GENMASK(4, 0) = 0x000000000000001f
A mask constructed from bits #0..4.
> BITMAP_FIRST_WORD_MASK(4) == 0xfffffffffffffff0
A mask constructed from all bits starting #4.
Don't see any misalignment here.
> > > The only issue is that LSB may also refer to least-significant BYTE. :-(
> >
> > It will never mean byte because it hosts in bitops.h, not byteops.h
>
> I'm afraid that identifiers from various sources end up next to each
> other and they do not carry tags where each of them came from...
You can name it lsb_bitmask() if you want, either way works. But to me
shorter is better.
Powered by blists - more mailing lists