Commit f51a05c16d3d051f5e000c50bccc4be91fe5f9f3
Committed by
Linus Torvalds
1 parent
d4337aa528
Exists in
master
and in
39 other branches
[PATCH] bitops: update include/asm-generic/bitops.h
Currently include/asm-generic/bitops.h is not referenced from anywhere. But it will be the benefit of those who are trying to port Linux to another architecture. So update it by same manner Signed-off-by: Akinobu Mita <mita@miraclelinux.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 1 changed file with 13 additions and 63 deletions Side-by-side Diff
include/asm-generic/bitops.h
... | ... | @@ -5,77 +5,27 @@ |
5 | 5 | * For the benefit of those who are trying to port Linux to another |
6 | 6 | * architecture, here are some C-language equivalents. You should |
7 | 7 | * recode these in the native assembly language, if at all possible. |
8 | - * To guarantee atomicity, these routines call cli() and sti() to | |
9 | - * disable interrupts while they operate. (You have to provide inline | |
10 | - * routines to cli() and sti().) | |
11 | - * | |
12 | - * Also note, these routines assume that you have 32 bit longs. | |
13 | - * You will have to change this if you are trying to port Linux to the | |
14 | - * Alpha architecture or to a Cray. :-) | |
15 | 8 | * |
16 | 9 | * C language equivalents written by Theodore Ts'o, 9/26/92 |
17 | 10 | */ |
18 | 11 | |
19 | -extern __inline__ int set_bit(int nr,long * addr) | |
20 | -{ | |
21 | - int mask, retval; | |
12 | +#include <asm-generic/bitops/atomic.h> | |
13 | +#include <asm-generic/bitops/non-atomic.h> | |
14 | +#include <asm-generic/bitops/__ffs.h> | |
15 | +#include <asm-generic/bitops/ffz.h> | |
16 | +#include <asm-generic/bitops/fls.h> | |
17 | +#include <asm-generic/bitops/fls64.h> | |
18 | +#include <asm-generic/bitops/find.h> | |
22 | 19 | |
23 | - addr += nr >> 5; | |
24 | - mask = 1 << (nr & 0x1f); | |
25 | - cli(); | |
26 | - retval = (mask & *addr) != 0; | |
27 | - *addr |= mask; | |
28 | - sti(); | |
29 | - return retval; | |
30 | -} | |
31 | - | |
32 | -extern __inline__ int clear_bit(int nr, long * addr) | |
33 | -{ | |
34 | - int mask, retval; | |
35 | - | |
36 | - addr += nr >> 5; | |
37 | - mask = 1 << (nr & 0x1f); | |
38 | - cli(); | |
39 | - retval = (mask & *addr) != 0; | |
40 | - *addr &= ~mask; | |
41 | - sti(); | |
42 | - return retval; | |
43 | -} | |
44 | - | |
45 | -extern __inline__ int test_bit(int nr, const unsigned long * addr) | |
46 | -{ | |
47 | - int mask; | |
48 | - | |
49 | - addr += nr >> 5; | |
50 | - mask = 1 << (nr & 0x1f); | |
51 | - return ((mask & *addr) != 0); | |
52 | -} | |
53 | - | |
54 | -/* | |
55 | - * fls: find last bit set. | |
56 | - */ | |
57 | - | |
58 | -#define fls(x) generic_fls(x) | |
59 | -#define fls64(x) generic_fls64(x) | |
60 | - | |
61 | 20 | #ifdef __KERNEL__ |
62 | 21 | |
63 | -/* | |
64 | - * ffs: find first bit set. This is defined the same way as | |
65 | - * the libc and compiler builtin ffs routines, therefore | |
66 | - * differs in spirit from the above ffz (man ffs). | |
67 | - */ | |
22 | +#include <asm-generic/bitops/sched.h> | |
23 | +#include <asm-generic/bitops/ffs.h> | |
24 | +#include <asm-generic/bitops/hweight.h> | |
68 | 25 | |
69 | -#define ffs(x) generic_ffs(x) | |
70 | - | |
71 | -/* | |
72 | - * hweightN: returns the hamming weight (i.e. the number | |
73 | - * of bits set) of a N-bit word | |
74 | - */ | |
75 | - | |
76 | -#define hweight32(x) generic_hweight32(x) | |
77 | -#define hweight16(x) generic_hweight16(x) | |
78 | -#define hweight8(x) generic_hweight8(x) | |
26 | +#include <asm-generic/bitops/ext2-non-atomic.h> | |
27 | +#include <asm-generic/bitops/ext2-atomic.h> | |
28 | +#include <asm-generic/bitops/minix.h> | |
79 | 29 | |
80 | 30 | #endif /* __KERNEL__ */ |
81 | 31 |