Skip to content

Commit

Permalink
[PATCH] bitops: ia64: use generic bitops
Browse files Browse the repository at this point in the history
- remove generic_fls64()
- remove find_{next,first}{,_zero}_bit()
- remove ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
- remove minix_{test,set,test_and_clear,test,find_first_zero}_bit()
- remove sched_find_first_bit()

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Akinobu Mita authored and Linus Torvalds committed Mar 26, 2006
1 parent 1cc2b99 commit 2875aef
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 139 deletions.
4 changes: 4 additions & 0 deletions arch/ia64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ config RWSEM_XCHGADD_ALGORITHM
bool
default y

config GENERIC_FIND_NEXT_BIT
bool
default y

config GENERIC_CALIBRATE_DELAY
bool
default y
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ obj-y := io.o

lib-y := __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o \
__divdi3.o __udivdi3.o __moddi3.o __umoddi3.o \
bitop.o checksum.o clear_page.o csum_partial_copy.o \
checksum.o clear_page.o csum_partial_copy.o \
clear_user.o strncpy_from_user.o strlen_user.o strnlen_user.o \
flush.o ip_fast_csum.o do_csum.o \
memset.o strlen.o
Expand Down
88 changes: 0 additions & 88 deletions arch/ia64/lib/bitop.c

This file was deleted.

67 changes: 17 additions & 50 deletions include/asm-ia64/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* Copyright (C) 1998-2003 Hewlett-Packard Co
* David Mosberger-Tang <davidm@hpl.hp.com>
*
* 02/06/02 find_next_bit() and find_first_bit() added from Erich Focht's ia64 O(1)
* scheduler patch
* 02/06/02 find_next_bit() and find_first_bit() added from Erich Focht's ia64
* O(1) scheduler patch
*/

#include <linux/compiler.h>
Expand All @@ -25,9 +25,9 @@
* restricted to acting on a single-word quantity.
*
* The address must be (at least) "long" aligned.
* Note that there are driver (e.g., eepro100) which use these operations to operate on
* hw-defined data-structures, so we can't easily change these operations to force a
* bigger alignment.
* Note that there are driver (e.g., eepro100) which use these operations to
* operate on hw-defined data-structures, so we can't easily change these
* operations to force a bigger alignment.
*
* bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
*/
Expand Down Expand Up @@ -284,8 +284,8 @@ test_bit (int nr, const volatile void *addr)
* ffz - find the first zero bit in a long word
* @x: The long word to find the bit in
*
* Returns the bit-number (0..63) of the first (least significant) zero bit. Undefined if
* no zero exists, so code should check against ~0UL first...
* Returns the bit-number (0..63) of the first (least significant) zero bit.
* Undefined if no zero exists, so code should check against ~0UL first...
*/
static inline unsigned long
ffz (unsigned long x)
Expand Down Expand Up @@ -345,13 +345,14 @@ fls (int t)
x |= x >> 16;
return ia64_popcnt(x);
}
#define fls64(x) generic_fls64(x)

#include <asm-generic/bitops/fls64.h>

/*
* ffs: find first bit set. This is defined the same way as the libc and compiler builtin
* ffs routines, therefore differs in spirit from the above ffz (man ffs): it operates on
* "int" values only and the result value is the bit number + 1. ffs(0) is defined to
* return zero.
* ffs: find first bit set. This is defined the same way as the libc and
* compiler builtin ffs routines, therefore differs in spirit from the above
* ffz (man ffs): it operates on "int" values only and the result value is the
* bit number + 1. ffs(0) is defined to return zero.
*/
#define ffs(x) __builtin_ffs(x)

Expand All @@ -373,51 +374,17 @@ hweight64 (unsigned long x)

#endif /* __KERNEL__ */

extern int __find_next_zero_bit (const void *addr, unsigned long size,
unsigned long offset);
extern int __find_next_bit(const void *addr, unsigned long size,
unsigned long offset);

#define find_next_zero_bit(addr, size, offset) \
__find_next_zero_bit((addr), (size), (offset))
#define find_next_bit(addr, size, offset) \
__find_next_bit((addr), (size), (offset))

/*
* The optimizer actually does good code for this case..
*/
#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)

#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
#include <asm-generic/bitops/find.h>

#ifdef __KERNEL__

#define __clear_bit(nr, addr) clear_bit(nr, addr)
#include <asm-generic/bitops/ext2-non-atomic.h>

#define ext2_set_bit __test_and_set_bit
#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a)
#define ext2_clear_bit __test_and_clear_bit
#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
#define ext2_test_bit test_bit
#define ext2_find_first_zero_bit find_first_zero_bit
#define ext2_find_next_zero_bit find_next_zero_bit

/* Bitmap functions for the minix filesystem. */
#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
#define minix_set_bit(nr,addr) __set_bit(nr,addr)
#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
#define minix_test_bit(nr,addr) test_bit(nr,addr)
#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)

static inline int
sched_find_first_bit (unsigned long *b)
{
if (unlikely(b[0]))
return __ffs(b[0]);
if (unlikely(b[1]))
return 64 + __ffs(b[1]);
return __ffs(b[2]) + 128;
}
#include <asm-generic/bitops/minix.h>
#include <asm-generic/bitops/sched.h>

#endif /* __KERNEL__ */

Expand Down

0 comments on commit 2875aef

Please sign in to comment.