diff options
Diffstat (limited to 'arch/sparc64')
-rw-r--r-- | arch/sparc64/Kconfig | 8 | ||||
-rw-r--r-- | arch/sparc64/kernel/sparc64_ksyms.c | 5 | ||||
-rw-r--r-- | arch/sparc64/lib/Makefile | 2 | ||||
-rw-r--r-- | arch/sparc64/lib/find_bit.c | 127 |
4 files changed, 9 insertions, 133 deletions
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 267afddf63cf..d1e2fc566486 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig | |||
@@ -162,6 +162,14 @@ config RWSEM_XCHGADD_ALGORITHM | |||
162 | bool | 162 | bool |
163 | default y | 163 | default y |
164 | 164 | ||
165 | config GENERIC_FIND_NEXT_BIT | ||
166 | bool | ||
167 | default y | ||
168 | |||
169 | config GENERIC_HWEIGHT | ||
170 | bool | ||
171 | default y if !ULTRA_HAS_POPULATION_COUNT | ||
172 | |||
165 | config GENERIC_CALIBRATE_DELAY | 173 | config GENERIC_CALIBRATE_DELAY |
166 | bool | 174 | bool |
167 | default y | 175 | default y |
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c index 9914a17651b4..c7fbbcfce824 100644 --- a/arch/sparc64/kernel/sparc64_ksyms.c +++ b/arch/sparc64/kernel/sparc64_ksyms.c | |||
@@ -175,11 +175,6 @@ EXPORT_SYMBOL(set_bit); | |||
175 | EXPORT_SYMBOL(clear_bit); | 175 | EXPORT_SYMBOL(clear_bit); |
176 | EXPORT_SYMBOL(change_bit); | 176 | EXPORT_SYMBOL(change_bit); |
177 | 177 | ||
178 | /* Bit searching */ | ||
179 | EXPORT_SYMBOL(find_next_bit); | ||
180 | EXPORT_SYMBOL(find_next_zero_bit); | ||
181 | EXPORT_SYMBOL(find_next_zero_le_bit); | ||
182 | |||
183 | EXPORT_SYMBOL(ivector_table); | 178 | EXPORT_SYMBOL(ivector_table); |
184 | EXPORT_SYMBOL(enable_irq); | 179 | EXPORT_SYMBOL(enable_irq); |
185 | EXPORT_SYMBOL(disable_irq); | 180 | EXPORT_SYMBOL(disable_irq); |
diff --git a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile index 8812ded19f01..4a725d8985f1 100644 --- a/arch/sparc64/lib/Makefile +++ b/arch/sparc64/lib/Makefile | |||
@@ -14,6 +14,6 @@ lib-y := PeeCeeI.o copy_page.o clear_page.o strlen.o strncmp.o \ | |||
14 | NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o NGpatch.o \ | 14 | NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o NGpatch.o \ |
15 | NGpage.o NGbzero.o \ | 15 | NGpage.o NGbzero.o \ |
16 | copy_in_user.o user_fixup.o memmove.o \ | 16 | copy_in_user.o user_fixup.o memmove.o \ |
17 | mcount.o ipcsum.o rwsem.o xor.o find_bit.o delay.o | 17 | mcount.o ipcsum.o rwsem.o xor.o delay.o |
18 | 18 | ||
19 | obj-y += iomap.o | 19 | obj-y += iomap.o |
diff --git a/arch/sparc64/lib/find_bit.c b/arch/sparc64/lib/find_bit.c deleted file mode 100644 index 6059557067b4..000000000000 --- a/arch/sparc64/lib/find_bit.c +++ /dev/null | |||
@@ -1,127 +0,0 @@ | |||
1 | #include <linux/bitops.h> | ||
2 | |||
3 | /** | ||
4 | * find_next_bit - find the next set bit in a memory region | ||
5 | * @addr: The address to base the search on | ||
6 | * @offset: The bitnumber to start searching at | ||
7 | * @size: The maximum size to search | ||
8 | */ | ||
9 | unsigned long find_next_bit(const unsigned long *addr, unsigned long size, | ||
10 | unsigned long offset) | ||
11 | { | ||
12 | const unsigned long *p = addr + (offset >> 6); | ||
13 | unsigned long result = offset & ~63UL; | ||
14 | unsigned long tmp; | ||
15 | |||
16 | if (offset >= size) | ||
17 | return size; | ||
18 | size -= result; | ||
19 | offset &= 63UL; | ||
20 | if (offset) { | ||
21 | tmp = *(p++); | ||
22 | tmp &= (~0UL << offset); | ||
23 | if (size < 64) | ||
24 | goto found_first; | ||
25 | if (tmp) | ||
26 | goto found_middle; | ||
27 | size -= 64; | ||
28 | result += 64; | ||
29 | } | ||
30 | while (size & ~63UL) { | ||
31 | if ((tmp = *(p++))) | ||
32 | goto found_middle; | ||
33 | result += 64; | ||
34 | size -= 64; | ||
35 | } | ||
36 | if (!size) | ||
37 | return result; | ||
38 | tmp = *p; | ||
39 | |||
40 | found_first: | ||
41 | tmp &= (~0UL >> (64 - size)); | ||
42 | if (tmp == 0UL) /* Are any bits set? */ | ||
43 | return result + size; /* Nope. */ | ||
44 | found_middle: | ||
45 | return result + __ffs(tmp); | ||
46 | } | ||
47 | |||
48 | /* find_next_zero_bit() finds the first zero bit in a bit string of length | ||
49 | * 'size' bits, starting the search at bit 'offset'. This is largely based | ||
50 | * on Linus's ALPHA routines, which are pretty portable BTW. | ||
51 | */ | ||
52 | |||
53 | unsigned long find_next_zero_bit(const unsigned long *addr, | ||
54 | unsigned long size, unsigned long offset) | ||
55 | { | ||
56 | const unsigned long *p = addr + (offset >> 6); | ||
57 | unsigned long result = offset & ~63UL; | ||
58 | unsigned long tmp; | ||
59 | |||
60 | if (offset >= size) | ||
61 | return size; | ||
62 | size -= result; | ||
63 | offset &= 63UL; | ||
64 | if (offset) { | ||
65 | tmp = *(p++); | ||
66 | tmp |= ~0UL >> (64-offset); | ||
67 | if (size < 64) | ||
68 | goto found_first; | ||
69 | if (~tmp) | ||
70 | goto found_middle; | ||
71 | size -= 64; | ||
72 | result += 64; | ||
73 | } | ||
74 | while (size & ~63UL) { | ||
75 | if (~(tmp = *(p++))) | ||
76 | goto found_middle; | ||
77 | result += 64; | ||
78 | size -= 64; | ||
79 | } | ||
80 | if (!size) | ||
81 | return result; | ||
82 | tmp = *p; | ||
83 | |||
84 | found_first: | ||
85 | tmp |= ~0UL << size; | ||
86 | if (tmp == ~0UL) /* Are any bits zero? */ | ||
87 | return result + size; /* Nope. */ | ||
88 | found_middle: | ||
89 | return result + ffz(tmp); | ||
90 | } | ||
91 | |||
92 | unsigned long find_next_zero_le_bit(unsigned long *addr, unsigned long size, unsigned long offset) | ||
93 | { | ||
94 | unsigned long *p = addr + (offset >> 6); | ||
95 | unsigned long result = offset & ~63UL; | ||
96 | unsigned long tmp; | ||
97 | |||
98 | if (offset >= size) | ||
99 | return size; | ||
100 | size -= result; | ||
101 | offset &= 63UL; | ||
102 | if(offset) { | ||
103 | tmp = __swab64p(p++); | ||
104 | tmp |= (~0UL >> (64-offset)); | ||
105 | if(size < 64) | ||
106 | goto found_first; | ||
107 | if(~tmp) | ||
108 | goto found_middle; | ||
109 | size -= 64; | ||
110 | result += 64; | ||
111 | } | ||
112 | while(size & ~63) { | ||
113 | if(~(tmp = __swab64p(p++))) | ||
114 | goto found_middle; | ||
115 | result += 64; | ||
116 | size -= 64; | ||
117 | } | ||
118 | if(!size) | ||
119 | return result; | ||
120 | tmp = __swab64p(p); | ||
121 | found_first: | ||
122 | tmp |= (~0UL << size); | ||
123 | if (tmp == ~0UL) /* Are any bits zero? */ | ||
124 | return result + size; /* Nope. */ | ||
125 | found_middle: | ||
126 | return result + ffz(tmp); | ||
127 | } | ||