diff options
Diffstat (limited to 'arch/sparc/lib/atomic32.c')
-rw-r--r-- | arch/sparc/lib/atomic32.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c index de84f8534bac..53ddcd9d1e60 100644 --- a/arch/sparc/lib/atomic32.c +++ b/arch/sparc/lib/atomic32.c | |||
@@ -76,3 +76,42 @@ void atomic_set(atomic_t *v, int i) | |||
76 | spin_unlock_irqrestore(ATOMIC_HASH(v), flags); | 76 | spin_unlock_irqrestore(ATOMIC_HASH(v), flags); |
77 | } | 77 | } |
78 | EXPORT_SYMBOL(atomic_set); | 78 | EXPORT_SYMBOL(atomic_set); |
79 | |||
80 | unsigned long ___set_bit(unsigned long *addr, unsigned long mask) | ||
81 | { | ||
82 | unsigned long old, flags; | ||
83 | |||
84 | spin_lock_irqsave(ATOMIC_HASH(addr), flags); | ||
85 | old = *addr; | ||
86 | *addr = old | mask; | ||
87 | spin_unlock_irqrestore(ATOMIC_HASH(addr), flags); | ||
88 | |||
89 | return old & mask; | ||
90 | } | ||
91 | EXPORT_SYMBOL(___set_bit); | ||
92 | |||
93 | unsigned long ___clear_bit(unsigned long *addr, unsigned long mask) | ||
94 | { | ||
95 | unsigned long old, flags; | ||
96 | |||
97 | spin_lock_irqsave(ATOMIC_HASH(addr), flags); | ||
98 | old = *addr; | ||
99 | *addr = old & ~mask; | ||
100 | spin_unlock_irqrestore(ATOMIC_HASH(addr), flags); | ||
101 | |||
102 | return old & mask; | ||
103 | } | ||
104 | EXPORT_SYMBOL(___clear_bit); | ||
105 | |||
106 | unsigned long ___change_bit(unsigned long *addr, unsigned long mask) | ||
107 | { | ||
108 | unsigned long old, flags; | ||
109 | |||
110 | spin_lock_irqsave(ATOMIC_HASH(addr), flags); | ||
111 | old = *addr; | ||
112 | *addr = old ^ mask; | ||
113 | spin_unlock_irqrestore(ATOMIC_HASH(addr), flags); | ||
114 | |||
115 | return old & mask; | ||
116 | } | ||
117 | EXPORT_SYMBOL(___change_bit); | ||