[PATCH] x86, bitops: select the generic bitmap search functions

From: Alexander van Heukelum
Date: Fri Apr 25 2008 - 07:14:54 EST


Introduce GENERIC_FIND_FIRST_BIT and GENERIC_FIND_NEXT_BIT in
lib/Kconfig, defaulting to off. An arch that wants to use the
generic implementation now only has to use a select statement
to include them.

I added an always-y option (X86_CPU) to arch/x86/Kconfig.cpu
and used that to select the generic search functions. This
way ARCH=um SUBARCH=i386 automatically picks up the change
too, and arch/um/Kconfig.i386 can therefore be simplified a
bit. ARCH=um SUBARCH=x86_64 does things differently, but
still compiles fine. It seems that a "def_bool y" always
wins over a "def_bool n"?

Signed-off-by: Alexander van Heukelum <heukelum@xxxxxxxxxxx>

---

arch/um/Kconfig.i386 | 8 --------
arch/x86/Kconfig | 6 ------
arch/x86/Kconfig.cpu | 5 +++++
lib/Kconfig | 6 ++++++
4 files changed, 11 insertions(+), 14 deletions(-)

Hello Linus,

I think this is close to what you had in mind?

The patch applies on top of:

git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-generic-bitops.git for-linus

Compile tested um/i386, um/x86_64. Boot-tested using
qemu for i386 and x86_64.

Greetings,
Alexander

diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386
index 49990ea..e09edfa 100644
--- a/arch/um/Kconfig.i386
+++ b/arch/um/Kconfig.i386
@@ -39,14 +39,6 @@ config ARCH_REUSE_HOST_VSYSCALL_AREA
bool
default y

-config GENERIC_FIND_FIRST_BIT
- bool
- default y
-
-config GENERIC_FIND_NEXT_BIT
- bool
- default y
-
config GENERIC_HWEIGHT
bool
default y
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 004aad8..4d350b5 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -77,12 +77,6 @@ config GENERIC_BUG
def_bool y
depends on BUG

-config GENERIC_FIND_FIRST_BIT
- def_bool y
-
-config GENERIC_FIND_NEXT_BIT
- def_bool y
-
config GENERIC_HWEIGHT
def_bool y

diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index b9368f5..b94b04e 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -278,6 +278,11 @@ config GENERIC_CPU

endchoice

+config X86_CPU
+ def_bool y
+ select GENERIC_FIND_FIRST_BIT
+ select GENERIC_FIND_NEXT_BIT
+
config X86_GENERIC
bool "Generic x86 support"
depends on X86_32
diff --git a/lib/Kconfig b/lib/Kconfig
index 2d53dc0..8cc8e87 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -7,6 +7,12 @@ menu "Library routines"
config BITREVERSE
tristate

+config GENERIC_FIND_FIRST_BIT
+ def_bool n
+
+config GENERIC_FIND_NEXT_BIT
+ def_bool n
+
config CRC_CCITT
tristate "CRC-CCITT functions"
help
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/