mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
x86, UML: remove x86-specific implementations of find_first_bit
x86 has been switched to the generic versions of find_first_bit and find_first_zero_bit, but the original versions were retained. This patch just removes the now unused x86-specific versions. also update UML. Signed-off-by: Alexander van Heukelum <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
3a48305028
commit
5245698f66
8 changed files with 10 additions and 193 deletions
|
|
@ -4,64 +4,6 @@
|
|||
/*
|
||||
* Copyright 1992, Linus Torvalds.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_GENERIC_FIND_FIRST_BIT
|
||||
/**
|
||||
* find_first_zero_bit - find the first zero bit in a memory region
|
||||
* @addr: The address to start the search at
|
||||
* @size: The maximum size to search
|
||||
*
|
||||
* Returns the bit number of the first zero bit, not the number of the byte
|
||||
* containing a bit.
|
||||
*/
|
||||
static inline int find_first_zero_bit(const unsigned long *addr, unsigned size)
|
||||
{
|
||||
int d0, d1, d2;
|
||||
int res;
|
||||
|
||||
if (!size)
|
||||
return 0;
|
||||
/* This looks at memory.
|
||||
* Mark it volatile to tell gcc not to move it around
|
||||
*/
|
||||
asm volatile("movl $-1,%%eax\n\t"
|
||||
"xorl %%edx,%%edx\n\t"
|
||||
"repe; scasl\n\t"
|
||||
"je 1f\n\t"
|
||||
"xorl -4(%%edi),%%eax\n\t"
|
||||
"subl $4,%%edi\n\t"
|
||||
"bsfl %%eax,%%edx\n"
|
||||
"1:\tsubl %%ebx,%%edi\n\t"
|
||||
"shll $3,%%edi\n\t"
|
||||
"addl %%edi,%%edx"
|
||||
: "=d" (res), "=&c" (d0), "=&D" (d1), "=&a" (d2)
|
||||
: "1" ((size + 31) >> 5), "2" (addr),
|
||||
"b" (addr) : "memory");
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* find_first_bit - find the first set bit in a memory region
|
||||
* @addr: The address to start the search at
|
||||
* @size: The maximum size to search
|
||||
*
|
||||
* Returns the bit number of the first set bit, not the number of the byte
|
||||
* containing a bit.
|
||||
*/
|
||||
static inline unsigned find_first_bit(const unsigned long *addr, unsigned size)
|
||||
{
|
||||
unsigned x = 0;
|
||||
|
||||
while (x < size) {
|
||||
unsigned long val = *addr++;
|
||||
if (val)
|
||||
return __ffs(val) + x;
|
||||
x += sizeof(*addr) << 3;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <asm-generic/bitops/sched.h>
|
||||
|
|
|
|||
|
|
@ -4,29 +4,6 @@
|
|||
/*
|
||||
* Copyright 1992, Linus Torvalds.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_GENERIC_FIND_FIRST_BIT
|
||||
extern long find_first_zero_bit(const unsigned long *addr, unsigned long size);
|
||||
extern long find_first_bit(const unsigned long *addr, unsigned long size);
|
||||
|
||||
/* return index of first bet set in val or max when no bit is set */
|
||||
static inline long __scanbit(unsigned long val, unsigned long max)
|
||||
{
|
||||
asm("bsfq %1,%0 ; cmovz %2,%0" : "=&r" (val) : "r" (val), "r" (max));
|
||||
return val;
|
||||
}
|
||||
|
||||
#define find_first_bit(addr, size) \
|
||||
((__builtin_constant_p((size)) && (size) <= BITS_PER_LONG \
|
||||
? (__scanbit(*(unsigned long *)(addr), (size))) \
|
||||
: find_first_bit((addr), (size))))
|
||||
|
||||
#define find_first_zero_bit(addr, size) \
|
||||
((__builtin_constant_p((size)) && (size) <= BITS_PER_LONG \
|
||||
? (__scanbit(~*(unsigned long *)(addr), (size))) \
|
||||
: find_first_zero_bit((addr), (size))))
|
||||
#endif
|
||||
|
||||
static inline void set_bit_string(unsigned long *bitmap, unsigned long i,
|
||||
int len)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue