aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-cris/bitops.h
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-07-28 09:30:20 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-07-28 09:30:20 +0100
commit661299d9d0437a0ff72240f3d60016ac3a361a6e (patch)
tree765512576314fc3612b503f182b9ae4e60fcf849 /include/asm-cris/bitops.h
parent05caac585f8abd6c0113856bc8858e3ef214d8a6 (diff)
parent41c018b7ecb60b1c2c4d5dee0cd37d32a94c45af (diff)
downloadkernel_samsung_tuna-661299d9d0437a0ff72240f3d60016ac3a361a6e.zip
kernel_samsung_tuna-661299d9d0437a0ff72240f3d60016ac3a361a6e.tar.gz
kernel_samsung_tuna-661299d9d0437a0ff72240f3d60016ac3a361a6e.tar.bz2
Merge with Linus' 2.6 tree
Diffstat (limited to 'include/asm-cris/bitops.h')
-rw-r--r--include/asm-cris/bitops.h35
1 files changed, 17 insertions, 18 deletions
diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h
index d786111..e3da57f 100644
--- a/include/asm-cris/bitops.h
+++ b/include/asm-cris/bitops.h
@@ -16,6 +16,7 @@
#include <asm/arch/bitops.h>
#include <asm/system.h>
+#include <asm/atomic.h>
#include <linux/compiler.h>
/*
@@ -88,7 +89,7 @@ struct __dummy { unsigned long a[100]; };
* It also implies a memory barrier.
*/
-extern inline int test_and_set_bit(int nr, void *addr)
+extern inline int test_and_set_bit(int nr, volatile unsigned long *addr)
{
unsigned int mask, retval;
unsigned long flags;
@@ -96,15 +97,15 @@ extern inline int test_and_set_bit(int nr, void *addr)
adr += nr >> 5;
mask = 1 << (nr & 0x1f);
- local_save_flags(flags);
- local_irq_disable();
+ cris_atomic_save(addr, flags);
retval = (mask & *adr) != 0;
*adr |= mask;
+ cris_atomic_restore(addr, flags);
local_irq_restore(flags);
return retval;
}
-extern inline int __test_and_set_bit(int nr, void *addr)
+extern inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
{
unsigned int mask, retval;
unsigned int *adr = (unsigned int *)addr;
@@ -131,7 +132,7 @@ extern inline int __test_and_set_bit(int nr, void *addr)
* It also implies a memory barrier.
*/
-extern inline int test_and_clear_bit(int nr, void *addr)
+extern inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
{
unsigned int mask, retval;
unsigned long flags;
@@ -139,11 +140,10 @@ extern inline int test_and_clear_bit(int nr, void *addr)
adr += nr >> 5;
mask = 1 << (nr & 0x1f);
- local_save_flags(flags);
- local_irq_disable();
+ cris_atomic_save(addr, flags);
retval = (mask & *adr) != 0;
*adr &= ~mask;
- local_irq_restore(flags);
+ cris_atomic_restore(addr, flags);
return retval;
}
@@ -157,7 +157,7 @@ extern inline int test_and_clear_bit(int nr, void *addr)
* but actually fail. You must protect multiple accesses with a lock.
*/
-extern inline int __test_and_clear_bit(int nr, void *addr)
+extern inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
{
unsigned int mask, retval;
unsigned int *adr = (unsigned int *)addr;
@@ -177,24 +177,23 @@ extern inline int __test_and_clear_bit(int nr, void *addr)
* It also implies a memory barrier.
*/
-extern inline int test_and_change_bit(int nr, void *addr)
+extern inline int test_and_change_bit(int nr, volatile unsigned long *addr)
{
unsigned int mask, retval;
unsigned long flags;
unsigned int *adr = (unsigned int *)addr;
adr += nr >> 5;
mask = 1 << (nr & 0x1f);
- local_save_flags(flags);
- local_irq_disable();
+ cris_atomic_save(addr, flags);
retval = (mask & *adr) != 0;
*adr ^= mask;
- local_irq_restore(flags);
+ cris_atomic_restore(addr, flags);
return retval;
}
/* WARNING: non atomic and it can be reordered! */
-extern inline int __test_and_change_bit(int nr, void *addr)
+extern inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
{
unsigned int mask, retval;
unsigned int *adr = (unsigned int *)addr;
@@ -215,7 +214,7 @@ extern inline int __test_and_change_bit(int nr, void *addr)
* This routine doesn't need to be atomic.
*/
-extern inline int test_bit(int nr, const void *addr)
+extern inline int test_bit(int nr, const volatile unsigned long *addr)
{
unsigned int mask;
unsigned int *adr = (unsigned int *)addr;
@@ -259,7 +258,7 @@ extern inline int test_bit(int nr, const void *addr)
* @offset: The bitnumber to start searching at
* @size: The maximum size to search
*/
-extern inline int find_next_zero_bit (void * addr, int size, int offset)
+extern inline int find_next_zero_bit (const unsigned long * addr, int size, int offset)
{
unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
unsigned long result = offset & ~31UL;
@@ -301,7 +300,7 @@ extern inline int find_next_zero_bit (void * addr, int size, int offset)
* @offset: The bitnumber to start searching at
* @size: The maximum size to search
*/
-static __inline__ int find_next_bit(void *addr, int size, int offset)
+static __inline__ int find_next_bit(const unsigned long *addr, int size, int offset)
{
unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
unsigned long result = offset & ~31UL;
@@ -367,7 +366,7 @@ found_middle:
#define minix_test_bit(nr,addr) test_bit(nr,addr)
#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
-extern inline int sched_find_first_bit(unsigned long *b)
+extern inline int sched_find_first_bit(const unsigned long *b)
{
if (unlikely(b[0]))
return __ffs(b[0]);