PCI: pnv_php: Add missing of_node_put()
[linux-2.6-block.git] / include / linux / bitops.h
index d03c5dd6185daafd871e8ad8e685fa1c0af5cd8e..4cac4e1a72ffc8d81f5c2acc6d88cea0c32117b2 100644 (file)
@@ -228,6 +228,30 @@ static inline unsigned long __ffs64(u64 word)
        return __ffs((unsigned long)word);
 }
 
+/**
+ * assign_bit - Assign value to a bit in memory
+ * @nr: the bit to set
+ * @addr: the address to start counting from
+ * @value: the value to assign
+ */
+static __always_inline void assign_bit(long nr, volatile unsigned long *addr,
+                                      bool value)
+{
+       if (value)
+               set_bit(nr, addr);
+       else
+               clear_bit(nr, addr);
+}
+
+static __always_inline void __assign_bit(long nr, volatile unsigned long *addr,
+                                        bool value)
+{
+       if (value)
+               __set_bit(nr, addr);
+       else
+               __clear_bit(nr, addr);
+}
+
 #ifdef __KERNEL__
 
 #ifndef set_mask_bits
@@ -237,7 +261,7 @@ static inline unsigned long __ffs64(u64 word)
        typeof(*ptr) old, new;                                  \
                                                                \
        do {                                                    \
-               old = ACCESS_ONCE(*ptr);                        \
+               old = READ_ONCE(*ptr);                  \
                new = (old & ~mask) | bits;                     \
        } while (cmpxchg(ptr, old, new) != old);                \
                                                                \
@@ -252,7 +276,7 @@ static inline unsigned long __ffs64(u64 word)
        typeof(*ptr) old, new;                                  \
                                                                \
        do {                                                    \
-               old = ACCESS_ONCE(*ptr);                        \
+               old = READ_ONCE(*ptr);                  \
                new = old & ~clear;                             \
        } while (!(old & test) &&                               \
                 cmpxchg(ptr, old, new) != old);                \