[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1767975412.git.ptesarik@suse.com>
Date: Fri, 9 Jan 2026 17:41:34 +0100
From: Petr Tesarik <ptesarik@...e.com>
To: Yury Norov <yury.norov@...il.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: 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,
Petr Tesarik <ptesarik@...e.com>
Subject: [RFC PATCH 0/2] Helper to isolate least-significant bit
Isolation of the least significant bit can be achieved with 3 basic
ALU operations which are already open-coded in various places in the
kernel.
However, since other places less efficient constructs, for example
`1UL << ffs(x)`, I assume the trick is known only to some authors, and
it's worth adding a helper to promote its use.
Petr Tesarik (2):
bits: introduce ffs_val()
treewide, bits: use ffs_val() where it is open-coded
arch/alpha/include/asm/bitops.h | 2 +-
arch/alpha/kernel/core_cia.c | 2 +-
arch/alpha/kernel/smp.c | 2 +-
arch/arc/include/asm/bitops.h | 2 +-
arch/m68k/include/asm/bitops.h | 12 +++++------
arch/mips/dec/ecc-berr.c | 2 +-
arch/mips/include/asm/bitops.h | 4 ++--
arch/mips/pci/pci-malta.c | 4 ++--
arch/powerpc/include/asm/bitops.h | 4 ++--
arch/powerpc/kvm/e500_mmu_host.c | 2 +-
arch/powerpc/lib/sstep.c | 2 +-
arch/powerpc/xmon/ppc-dis.c | 3 ++-
arch/powerpc/xmon/ppc-opc.c | 6 +++---
arch/s390/include/asm/bitops.h | 2 +-
arch/xtensa/include/asm/bitops.h | 6 +++---
arch/xtensa/kernel/traps.c | 2 +-
drivers/gpu/drm/gma500/psb_intel_sdvo.c | 2 +-
drivers/iommu/dma-iommu.c | 2 +-
drivers/net/ethernet/netronome/nfp/bpf/jit.c | 2 +-
drivers/net/usb/cdc_ncm.c | 4 ++--
include/asm-generic/div64.h | 4 ++--
include/linux/bitfield.h | 3 ++-
include/linux/bitops.h | 1 +
include/linux/ffs_val.h | 21 ++++++++++++++++++++
include/linux/log2.h | 2 +-
include/linux/min_heap.h | 5 +++--
lib/math/gcd.c | 4 ++--
lib/sort.c | 3 ++-
net/bluetooth/mgmt.c | 2 +-
net/netfilter/nft_set_pipapo.c | 2 +-
30 files changed, 70 insertions(+), 44 deletions(-)
create mode 100644 include/linux/ffs_val.h
--
2.52.0
Powered by blists - more mailing lists