diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/asm-generic/bitops | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'include/asm-generic/bitops')
-rw-r--r-- | include/asm-generic/bitops/ext2-atomic.h | 4 | ||||
-rw-r--r-- | include/asm-generic/bitops/ext2-non-atomic.h | 20 | ||||
-rw-r--r-- | include/asm-generic/bitops/find.h | 41 | ||||
-rw-r--r-- | include/asm-generic/bitops/le.h | 96 | ||||
-rw-r--r-- | include/asm-generic/bitops/minix-le.h | 17 | ||||
-rw-r--r-- | include/asm-generic/bitops/minix.h | 15 |
6 files changed, 105 insertions, 88 deletions
diff --git a/include/asm-generic/bitops/ext2-atomic.h b/include/asm-generic/bitops/ext2-atomic.h index ab1c875efb74..ecf1c9d8a7cc 100644 --- a/include/asm-generic/bitops/ext2-atomic.h +++ b/include/asm-generic/bitops/ext2-atomic.h | |||
@@ -5,7 +5,7 @@ | |||
5 | ({ \ | 5 | ({ \ |
6 | int ret; \ | 6 | int ret; \ |
7 | spin_lock(lock); \ | 7 | spin_lock(lock); \ |
8 | ret = ext2_set_bit((nr), (unsigned long *)(addr)); \ | 8 | ret = __test_and_set_bit_le(nr, addr); \ |
9 | spin_unlock(lock); \ | 9 | spin_unlock(lock); \ |
10 | ret; \ | 10 | ret; \ |
11 | }) | 11 | }) |
@@ -14,7 +14,7 @@ | |||
14 | ({ \ | 14 | ({ \ |
15 | int ret; \ | 15 | int ret; \ |
16 | spin_lock(lock); \ | 16 | spin_lock(lock); \ |
17 | ret = ext2_clear_bit((nr), (unsigned long *)(addr)); \ | 17 | ret = __test_and_clear_bit_le(nr, addr); \ |
18 | spin_unlock(lock); \ | 18 | spin_unlock(lock); \ |
19 | ret; \ | 19 | ret; \ |
20 | }) | 20 | }) |
diff --git a/include/asm-generic/bitops/ext2-non-atomic.h b/include/asm-generic/bitops/ext2-non-atomic.h deleted file mode 100644 index 63cf822431a2..000000000000 --- a/include/asm-generic/bitops/ext2-non-atomic.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | #ifndef _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ | ||
2 | #define _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ | ||
3 | |||
4 | #include <asm-generic/bitops/le.h> | ||
5 | |||
6 | #define ext2_set_bit(nr,addr) \ | ||
7 | generic___test_and_set_le_bit((nr),(unsigned long *)(addr)) | ||
8 | #define ext2_clear_bit(nr,addr) \ | ||
9 | generic___test_and_clear_le_bit((nr),(unsigned long *)(addr)) | ||
10 | |||
11 | #define ext2_test_bit(nr,addr) \ | ||
12 | generic_test_le_bit((nr),(unsigned long *)(addr)) | ||
13 | #define ext2_find_first_zero_bit(addr, size) \ | ||
14 | generic_find_first_zero_le_bit((unsigned long *)(addr), (size)) | ||
15 | #define ext2_find_next_zero_bit(addr, size, off) \ | ||
16 | generic_find_next_zero_le_bit((unsigned long *)(addr), (size), (off)) | ||
17 | #define ext2_find_next_bit(addr, size, off) \ | ||
18 | generic_find_next_le_bit((unsigned long *)(addr), (size), (off)) | ||
19 | |||
20 | #endif /* _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ */ | ||
diff --git a/include/asm-generic/bitops/find.h b/include/asm-generic/bitops/find.h index 1914e9742512..71c778033f57 100644 --- a/include/asm-generic/bitops/find.h +++ b/include/asm-generic/bitops/find.h | |||
@@ -1,15 +1,54 @@ | |||
1 | #ifndef _ASM_GENERIC_BITOPS_FIND_H_ | 1 | #ifndef _ASM_GENERIC_BITOPS_FIND_H_ |
2 | #define _ASM_GENERIC_BITOPS_FIND_H_ | 2 | #define _ASM_GENERIC_BITOPS_FIND_H_ |
3 | 3 | ||
4 | #ifndef CONFIG_GENERIC_FIND_NEXT_BIT | 4 | #ifndef find_next_bit |
5 | /** | ||
6 | * find_next_bit - find the next set bit in a memory region | ||
7 | * @addr: The address to base the search on | ||
8 | * @offset: The bitnumber to start searching at | ||
9 | * @size: The bitmap size in bits | ||
10 | */ | ||
5 | extern unsigned long find_next_bit(const unsigned long *addr, unsigned long | 11 | extern unsigned long find_next_bit(const unsigned long *addr, unsigned long |
6 | size, unsigned long offset); | 12 | size, unsigned long offset); |
13 | #endif | ||
7 | 14 | ||
15 | #ifndef find_next_zero_bit | ||
16 | /** | ||
17 | * find_next_zero_bit - find the next cleared bit in a memory region | ||
18 | * @addr: The address to base the search on | ||
19 | * @offset: The bitnumber to start searching at | ||
20 | * @size: The bitmap size in bits | ||
21 | */ | ||
8 | extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned | 22 | extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned |
9 | long size, unsigned long offset); | 23 | long size, unsigned long offset); |
10 | #endif | 24 | #endif |
11 | 25 | ||
26 | #ifdef CONFIG_GENERIC_FIND_FIRST_BIT | ||
27 | |||
28 | /** | ||
29 | * find_first_bit - find the first set bit in a memory region | ||
30 | * @addr: The address to start the search at | ||
31 | * @size: The maximum size to search | ||
32 | * | ||
33 | * Returns the bit number of the first set bit. | ||
34 | */ | ||
35 | extern unsigned long find_first_bit(const unsigned long *addr, | ||
36 | unsigned long size); | ||
37 | |||
38 | /** | ||
39 | * find_first_zero_bit - find the first cleared bit in a memory region | ||
40 | * @addr: The address to start the search at | ||
41 | * @size: The maximum size to search | ||
42 | * | ||
43 | * Returns the bit number of the first cleared bit. | ||
44 | */ | ||
45 | extern unsigned long find_first_zero_bit(const unsigned long *addr, | ||
46 | unsigned long size); | ||
47 | #else /* CONFIG_GENERIC_FIND_FIRST_BIT */ | ||
48 | |||
12 | #define find_first_bit(addr, size) find_next_bit((addr), (size), 0) | 49 | #define find_first_bit(addr, size) find_next_bit((addr), (size), 0) |
13 | #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) | 50 | #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) |
14 | 51 | ||
52 | #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ | ||
53 | |||
15 | #endif /*_ASM_GENERIC_BITOPS_FIND_H_ */ | 54 | #endif /*_ASM_GENERIC_BITOPS_FIND_H_ */ |
diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h index 80e3bf13b2b9..f95c663a6a41 100644 --- a/include/asm-generic/bitops/le.h +++ b/include/asm-generic/bitops/le.h | |||
@@ -4,54 +4,84 @@ | |||
4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
5 | #include <asm/byteorder.h> | 5 | #include <asm/byteorder.h> |
6 | 6 | ||
7 | #define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) | ||
8 | #define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7) | ||
9 | |||
10 | #if defined(__LITTLE_ENDIAN) | 7 | #if defined(__LITTLE_ENDIAN) |
11 | 8 | ||
12 | #define generic_test_le_bit(nr, addr) test_bit(nr, addr) | 9 | #define BITOP_LE_SWIZZLE 0 |
13 | #define generic___set_le_bit(nr, addr) __set_bit(nr, addr) | ||
14 | #define generic___clear_le_bit(nr, addr) __clear_bit(nr, addr) | ||
15 | 10 | ||
16 | #define generic_test_and_set_le_bit(nr, addr) test_and_set_bit(nr, addr) | 11 | static inline unsigned long find_next_zero_bit_le(const void *addr, |
17 | #define generic_test_and_clear_le_bit(nr, addr) test_and_clear_bit(nr, addr) | 12 | unsigned long size, unsigned long offset) |
13 | { | ||
14 | return find_next_zero_bit(addr, size, offset); | ||
15 | } | ||
18 | 16 | ||
19 | #define generic___test_and_set_le_bit(nr, addr) __test_and_set_bit(nr, addr) | 17 | static inline unsigned long find_next_bit_le(const void *addr, |
20 | #define generic___test_and_clear_le_bit(nr, addr) __test_and_clear_bit(nr, addr) | 18 | unsigned long size, unsigned long offset) |
19 | { | ||
20 | return find_next_bit(addr, size, offset); | ||
21 | } | ||
21 | 22 | ||
22 | #define generic_find_next_zero_le_bit(addr, size, offset) find_next_zero_bit(addr, size, offset) | 23 | static inline unsigned long find_first_zero_bit_le(const void *addr, |
23 | #define generic_find_next_le_bit(addr, size, offset) \ | 24 | unsigned long size) |
24 | find_next_bit(addr, size, offset) | 25 | { |
26 | return find_first_zero_bit(addr, size); | ||
27 | } | ||
25 | 28 | ||
26 | #elif defined(__BIG_ENDIAN) | 29 | #elif defined(__BIG_ENDIAN) |
27 | 30 | ||
28 | #define generic_test_le_bit(nr, addr) \ | 31 | #define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7) |
29 | test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) | ||
30 | #define generic___set_le_bit(nr, addr) \ | ||
31 | __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) | ||
32 | #define generic___clear_le_bit(nr, addr) \ | ||
33 | __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) | ||
34 | |||
35 | #define generic_test_and_set_le_bit(nr, addr) \ | ||
36 | test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) | ||
37 | #define generic_test_and_clear_le_bit(nr, addr) \ | ||
38 | test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) | ||
39 | |||
40 | #define generic___test_and_set_le_bit(nr, addr) \ | ||
41 | __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) | ||
42 | #define generic___test_and_clear_le_bit(nr, addr) \ | ||
43 | __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) | ||
44 | 32 | ||
45 | extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, | 33 | #ifndef find_next_zero_bit_le |
34 | extern unsigned long find_next_zero_bit_le(const void *addr, | ||
46 | unsigned long size, unsigned long offset); | 35 | unsigned long size, unsigned long offset); |
47 | extern unsigned long generic_find_next_le_bit(const unsigned long *addr, | 36 | #endif |
37 | |||
38 | #ifndef find_next_bit_le | ||
39 | extern unsigned long find_next_bit_le(const void *addr, | ||
48 | unsigned long size, unsigned long offset); | 40 | unsigned long size, unsigned long offset); |
41 | #endif | ||
42 | |||
43 | #ifndef find_first_zero_bit_le | ||
44 | #define find_first_zero_bit_le(addr, size) \ | ||
45 | find_next_zero_bit_le((addr), (size), 0) | ||
46 | #endif | ||
49 | 47 | ||
50 | #else | 48 | #else |
51 | #error "Please fix <asm/byteorder.h>" | 49 | #error "Please fix <asm/byteorder.h>" |
52 | #endif | 50 | #endif |
53 | 51 | ||
54 | #define generic_find_first_zero_le_bit(addr, size) \ | 52 | static inline int test_bit_le(int nr, const void *addr) |
55 | generic_find_next_zero_le_bit((addr), (size), 0) | 53 | { |
54 | return test_bit(nr ^ BITOP_LE_SWIZZLE, addr); | ||
55 | } | ||
56 | |||
57 | static inline void __set_bit_le(int nr, void *addr) | ||
58 | { | ||
59 | __set_bit(nr ^ BITOP_LE_SWIZZLE, addr); | ||
60 | } | ||
61 | |||
62 | static inline void __clear_bit_le(int nr, void *addr) | ||
63 | { | ||
64 | __clear_bit(nr ^ BITOP_LE_SWIZZLE, addr); | ||
65 | } | ||
66 | |||
67 | static inline int test_and_set_bit_le(int nr, void *addr) | ||
68 | { | ||
69 | return test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr); | ||
70 | } | ||
71 | |||
72 | static inline int test_and_clear_bit_le(int nr, void *addr) | ||
73 | { | ||
74 | return test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr); | ||
75 | } | ||
76 | |||
77 | static inline int __test_and_set_bit_le(int nr, void *addr) | ||
78 | { | ||
79 | return __test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr); | ||
80 | } | ||
81 | |||
82 | static inline int __test_and_clear_bit_le(int nr, void *addr) | ||
83 | { | ||
84 | return __test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr); | ||
85 | } | ||
56 | 86 | ||
57 | #endif /* _ASM_GENERIC_BITOPS_LE_H_ */ | 87 | #endif /* _ASM_GENERIC_BITOPS_LE_H_ */ |
diff --git a/include/asm-generic/bitops/minix-le.h b/include/asm-generic/bitops/minix-le.h deleted file mode 100644 index 4a981c1bb1ae..000000000000 --- a/include/asm-generic/bitops/minix-le.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | #ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_ | ||
2 | #define _ASM_GENERIC_BITOPS_MINIX_LE_H_ | ||
3 | |||
4 | #include <asm-generic/bitops/le.h> | ||
5 | |||
6 | #define minix_test_and_set_bit(nr,addr) \ | ||
7 | generic___test_and_set_le_bit((nr),(unsigned long *)(addr)) | ||
8 | #define minix_set_bit(nr,addr) \ | ||
9 | generic___set_le_bit((nr),(unsigned long *)(addr)) | ||
10 | #define minix_test_and_clear_bit(nr,addr) \ | ||
11 | generic___test_and_clear_le_bit((nr),(unsigned long *)(addr)) | ||
12 | #define minix_test_bit(nr,addr) \ | ||
13 | generic_test_le_bit((nr),(unsigned long *)(addr)) | ||
14 | #define minix_find_first_zero_bit(addr,size) \ | ||
15 | generic_find_first_zero_le_bit((unsigned long *)(addr),(size)) | ||
16 | |||
17 | #endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */ | ||
diff --git a/include/asm-generic/bitops/minix.h b/include/asm-generic/bitops/minix.h deleted file mode 100644 index 91f42e87aa51..000000000000 --- a/include/asm-generic/bitops/minix.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | #ifndef _ASM_GENERIC_BITOPS_MINIX_H_ | ||
2 | #define _ASM_GENERIC_BITOPS_MINIX_H_ | ||
3 | |||
4 | #define minix_test_and_set_bit(nr,addr) \ | ||
5 | __test_and_set_bit((nr),(unsigned long *)(addr)) | ||
6 | #define minix_set_bit(nr,addr) \ | ||
7 | __set_bit((nr),(unsigned long *)(addr)) | ||
8 | #define minix_test_and_clear_bit(nr,addr) \ | ||
9 | __test_and_clear_bit((nr),(unsigned long *)(addr)) | ||
10 | #define minix_test_bit(nr,addr) \ | ||
11 | test_bit((nr),(unsigned long *)(addr)) | ||
12 | #define minix_find_first_zero_bit(addr,size) \ | ||
13 | find_first_zero_bit((unsigned long *)(addr),(size)) | ||
14 | |||
15 | #endif /* _ASM_GENERIC_BITOPS_MINIX_H_ */ | ||