diff options
| -rw-r--r-- | lib/Kconfig | 12 | ||||
| -rw-r--r-- | lib/Makefile | 2 | ||||
| -rw-r--r-- | lib/bitrev.c | 3 |
3 files changed, 13 insertions, 4 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index d8e7e89ae320..a33988adfaa3 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -54,6 +54,7 @@ config PACKING_KUNIT_TEST config BITREVERSE tristate + select GENERIC_BITREVERSE if !HAVE_ARCH_BITREVERSE config HAVE_ARCH_BITREVERSE bool @@ -63,6 +64,17 @@ config HAVE_ARCH_BITREVERSE This option enables the use of hardware bit-reversal instructions on architectures which support such operations. +config GENERIC_BITREVERSE + tristate + depends on BITREVERSE + help + Generic bit reversal implementation. Drivers should never enable + it explicitly. Instead, enable BITREVERSE. + + Architectures may want to select it as a fall-back option for + HAVE_ARCH_BITREVERSE, when the hardware-accelerated bit reverse + instruction set is optional, like RISC-V ZBKB extension. + config ARCH_HAS_STRNCPY_FROM_USER bool diff --git a/lib/Makefile b/lib/Makefile index f33a24bf1c19..23e07d19d01c 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -145,7 +145,7 @@ obj-$(CONFIG_DEBUG_PREEMPT) += smp_processor_id.o obj-$(CONFIG_LIST_HARDENED) += list_debug.o obj-$(CONFIG_DEBUG_OBJECTS) += debugobjects.o -obj-$(CONFIG_BITREVERSE) += bitrev.o +obj-$(CONFIG_GENERIC_BITREVERSE) += bitrev.o obj-$(CONFIG_LINEAR_RANGES) += linear_ranges.o obj-$(CONFIG_PACKING) += packing.o obj-$(CONFIG_PACKING_KUNIT_TEST) += packing_test.o diff --git a/lib/bitrev.c b/lib/bitrev.c index 81b56e0a7f32..05088231f31f 100644 --- a/lib/bitrev.c +++ b/lib/bitrev.c @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0-only -#ifndef CONFIG_HAVE_ARCH_BITREVERSE #include <linux/types.h> #include <linux/module.h> #include <linux/bitrev.h> @@ -43,5 +42,3 @@ const u8 byte_rev_table[256] = { 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, }; EXPORT_SYMBOL_GPL(byte_rev_table); - -#endif /* CONFIG_HAVE_ARCH_BITREVERSE */ |
