Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/x86/linux-2.6-generic-bitops-v3

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-generic-bitops-v3:
  x86, bitops: select the generic bitmap search functions
  x86: include/asm-x86/pgalloc.h/bitops.h: checkpatch cleanups - formatting only
  x86: finalize bitops unification
  x86, UML: remove x86-specific implementations of find_first_bit
  x86: optimize find_first_bit for small bitmaps
  x86: switch 64-bit to generic find_first_bit
  x86: generic versions of find_first_(zero_)bit, convert i386
  bitops: use __fls for fls64 on 64-bit archs
  generic: implement __fls on all 64-bit archs
  generic: introduce a generic __fls implementation
  x86: merge the simple bitops and move them to bitops.h
  x86, generic: optimize find_next_(zero_)bit for small constant-size bitmaps
  x86, uml: fix uml with generic find_next_bit for x86
  x86: change x86 to use generic find_next_bit
  uml: Kconfig cleanup
  uml: fix build error
  • Loading branch information
Linus Torvalds committed Apr 26, 2008
2 parents a52b0d2 + 19870de commit 9b79ed9
Show file tree
Hide file tree
Showing 26 changed files with 467 additions and 603 deletions.
7 changes: 7 additions & 0 deletions arch/um/Kconfig.x86_64
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@

menu "Host processor type and features"

source "arch/x86/Kconfig.cpu"

endmenu

config UML_X86
bool
default y
Expand Down
1 change: 1 addition & 0 deletions arch/um/os-Linux/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "os.h"
#include "um_malloc.h"
#include "user.h"
#include <linux/limits.h>

struct helper_data {
void (*pre_exec)(void*);
Expand Down
2 changes: 1 addition & 1 deletion arch/um/sys-i386/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
ptrace_user.o setjmp.o signal.o stub.o stub_segv.o syscalls.o sysrq.o \
sys_call_table.o tls.o

subarch-obj-y = lib/bitops_32.o lib/semaphore_32.o lib/string_32.o
subarch-obj-y = lib/semaphore_32.o lib/string_32.o
subarch-obj-$(CONFIG_HIGHMEM) += mm/highmem_32.o
subarch-obj-$(CONFIG_MODULES) += kernel/module_32.o

Expand Down
2 changes: 1 addition & 1 deletion arch/um/sys-x86_64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ obj-y = bug.o bugs.o delay.o fault.o ldt.o mem.o ptrace.o ptrace_user.o \

obj-$(CONFIG_MODULES) += um_module.o

subarch-obj-y = lib/bitops_64.o lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o
subarch-obj-y = lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o
subarch-obj-$(CONFIG_MODULES) += kernel/module_64.o

ldt-y = ../sys-i386/ldt.o
Expand Down
7 changes: 6 additions & 1 deletion arch/x86/Kconfig.cpu
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -398,7 +403,7 @@ config X86_TSC
# generates cmov.
config X86_CMOV
def_bool y
depends on (MK7 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7)
depends on (MK7 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || X86_64)

config X86_MINIMUM_CPU_FAMILY
int
Expand Down
3 changes: 1 addition & 2 deletions arch/x86/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ lib-y += memcpy_$(BITS).o
ifeq ($(CONFIG_X86_32),y)
lib-y += checksum_32.o
lib-y += strstr_32.o
lib-y += bitops_32.o semaphore_32.o string_32.o
lib-y += semaphore_32.o string_32.o

lib-$(CONFIG_X86_USE_3DNOW) += mmx_32.o
else
Expand All @@ -21,7 +21,6 @@ else

lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o
lib-y += thunk_64.o clear_page_64.o copy_page_64.o
lib-y += bitops_64.o
lib-y += memmove_64.o memset_64.o
lib-y += copy_user_64.o rwlock_64.o copy_user_nocache_64.o
endif
70 changes: 0 additions & 70 deletions arch/x86/lib/bitops_32.c

This file was deleted.

175 changes: 0 additions & 175 deletions arch/x86/lib/bitops_64.c

This file was deleted.

5 changes: 5 additions & 0 deletions include/asm-alpha/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ static inline int fls64(unsigned long x)
}
#endif

static inline unsigned long __fls(unsigned long x)
{
return fls64(x) - 1;
}

static inline int fls(int x)
{
return fls64((unsigned int) x);
Expand Down
43 changes: 43 additions & 0 deletions include/asm-generic/bitops/__fls.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#ifndef _ASM_GENERIC_BITOPS___FLS_H_
#define _ASM_GENERIC_BITOPS___FLS_H_

#include <asm/types.h>

/**
* __fls - find last (most-significant) set bit in a long word
* @word: the word to search
*
* Undefined if no set bit exists, so code should check against 0 first.
*/
static inline unsigned long __fls(unsigned long word)
{
int num = BITS_PER_LONG - 1;

#if BITS_PER_LONG == 64
if (!(word & (~0ul << 32))) {
num -= 32;
word <<= 32;
}
#endif
if (!(word & (~0ul << (BITS_PER_LONG-16)))) {
num -= 16;
word <<= 16;
}
if (!(word & (~0ul << (BITS_PER_LONG-8)))) {
num -= 8;
word <<= 8;
}
if (!(word & (~0ul << (BITS_PER_LONG-4)))) {
num -= 4;
word <<= 4;
}
if (!(word & (~0ul << (BITS_PER_LONG-2)))) {
num -= 2;
word <<= 2;
}
if (!(word & (~0ul << (BITS_PER_LONG-1))))
num -= 1;
return num;
}

#endif /* _ASM_GENERIC_BITOPS___FLS_H_ */
2 changes: 2 additions & 0 deletions include/asm-generic/bitops/find.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#ifndef _ASM_GENERIC_BITOPS_FIND_H_
#define _ASM_GENERIC_BITOPS_FIND_H_

#ifndef CONFIG_GENERIC_FIND_NEXT_BIT
extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
size, unsigned long offset);

extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned
long size, unsigned long offset);
#endif

#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
Expand Down
Loading

0 comments on commit 9b79ed9

Please sign in to comment.