s5pc1xx: support serial driver
[oweals/u-boot.git] / include / asm-arm / bitops.h
index 854e225c2f615a35f6503ac75c7739ae5d02aa99..270f163eee3fb5ebe190cec4352c19901361eba9 100644 (file)
@@ -17,6 +17,8 @@
 
 #ifdef __KERNEL__
 
+#include <asm/proc/system.h>
+
 #define smp_mb__before_clear_bit()     do { } while (0)
 #define smp_mb__after_clear_bit()      do { } while (0)
 
@@ -37,8 +39,6 @@ static inline void __change_bit(int nr, volatile void *addr)
        *p ^= mask;
 }
 
-extern int test_and_set_bit(int nr, volatile void * addr);
-
 static inline int __test_and_set_bit(int nr, volatile void *addr)
 {
        unsigned long mask = BIT_MASK(nr);
@@ -49,7 +49,17 @@ static inline int __test_and_set_bit(int nr, volatile void *addr)
        return (old & mask) != 0;
 }
 
-extern int test_and_clear_bit(int nr, volatile void * addr);
+static inline int test_and_set_bit(int nr, volatile void * addr)
+{
+       unsigned long flags;
+       int out;
+
+       local_irq_save(flags);
+       out = __test_and_set_bit(nr, addr);
+       local_irq_restore(flags);
+
+       return out;
+}
 
 static inline int __test_and_clear_bit(int nr, volatile void *addr)
 {
@@ -61,6 +71,18 @@ static inline int __test_and_clear_bit(int nr, volatile void *addr)
        return (old & mask) != 0;
 }
 
+static inline int test_and_clear_bit(int nr, volatile void * addr)
+{
+       unsigned long flags;
+       int out;
+
+       local_irq_save(flags);
+       out = __test_and_clear_bit(nr, addr);
+       local_irq_restore(flags);
+
+       return out;
+}
+
 extern int test_and_change_bit(int nr, volatile void * addr);
 
 static inline int __test_and_change_bit(int nr, volatile void *addr)
@@ -102,14 +124,6 @@ static inline unsigned long ffz(unsigned long word)
        return k;
 }
 
-/*
- * ffs: find first bit set. This is defined the same way as
- * the libc and compiler builtin ffs routines, therefore
- * differs in spirit from the above ffz (man ffs).
- */
-
-#define ffs(x) generic_ffs(x)
-
 /*
  * hweightN: returns the hamming weight (i.e. the number
  * of bits set) of a N-bit word