bitops.h (03ab8e6297acd1bc0eedaa050e2a1635c576fd11) bitops.h (0e862838f290147ea9c16db852d8d494b552d38d)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ALPHA_BITOPS_H
3#define _ALPHA_BITOPS_H
4
5#ifndef _LINUX_BITOPS_H
6#error only <linux/bitops.h> can be included directly
7#endif
8

--- 32 unchanged lines hidden (view full) ---

41 ".previous"
42 :"=&r" (temp), "=m" (*m)
43 :"Ir" (1UL << (nr & 31)), "m" (*m));
44}
45
46/*
47 * WARNING: non atomic version.
48 */
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ALPHA_BITOPS_H
3#define _ALPHA_BITOPS_H
4
5#ifndef _LINUX_BITOPS_H
6#error only <linux/bitops.h> can be included directly
7#endif
8

--- 32 unchanged lines hidden (view full) ---

41 ".previous"
42 :"=&r" (temp), "=m" (*m)
43 :"Ir" (1UL << (nr & 31)), "m" (*m));
44}
45
46/*
47 * WARNING: non atomic version.
48 */
49static inline void
50__set_bit(unsigned long nr, volatile void * addr)
49static __always_inline void
50arch___set_bit(unsigned long nr, volatile unsigned long *addr)
51{
52 int *m = ((int *) addr) + (nr >> 5);
53
54 *m |= 1 << (nr & 31);
55}
56
57static inline void
58clear_bit(unsigned long nr, volatile void * addr)

--- 18 unchanged lines hidden (view full) ---

77{
78 smp_mb();
79 clear_bit(nr, addr);
80}
81
82/*
83 * WARNING: non atomic version.
84 */
51{
52 int *m = ((int *) addr) + (nr >> 5);
53
54 *m |= 1 << (nr & 31);
55}
56
57static inline void
58clear_bit(unsigned long nr, volatile void * addr)

--- 18 unchanged lines hidden (view full) ---

77{
78 smp_mb();
79 clear_bit(nr, addr);
80}
81
82/*
83 * WARNING: non atomic version.
84 */
85static __inline__ void
86__clear_bit(unsigned long nr, volatile void * addr)
85static __always_inline void
86arch___clear_bit(unsigned long nr, volatile unsigned long *addr)
87{
88 int *m = ((int *) addr) + (nr >> 5);
89
90 *m &= ~(1 << (nr & 31));
91}
92
93static inline void
94__clear_bit_unlock(unsigned long nr, volatile void * addr)
95{
96 smp_mb();
87{
88 int *m = ((int *) addr) + (nr >> 5);
89
90 *m &= ~(1 << (nr & 31));
91}
92
93static inline void
94__clear_bit_unlock(unsigned long nr, volatile void * addr)
95{
96 smp_mb();
97 __clear_bit(nr, addr);
97 arch___clear_bit(nr, addr);
98}
99
100static inline void
101change_bit(unsigned long nr, volatile void * addr)
102{
103 unsigned long temp;
104 int *m = ((int *) addr) + (nr >> 5);
105

--- 7 unchanged lines hidden (view full) ---

113 ".previous"
114 :"=&r" (temp), "=m" (*m)
115 :"Ir" (1UL << (nr & 31)), "m" (*m));
116}
117
118/*
119 * WARNING: non atomic version.
120 */
98}
99
100static inline void
101change_bit(unsigned long nr, volatile void * addr)
102{
103 unsigned long temp;
104 int *m = ((int *) addr) + (nr >> 5);
105

--- 7 unchanged lines hidden (view full) ---

113 ".previous"
114 :"=&r" (temp), "=m" (*m)
115 :"Ir" (1UL << (nr & 31)), "m" (*m));
116}
117
118/*
119 * WARNING: non atomic version.
120 */
121static __inline__ void
122__change_bit(unsigned long nr, volatile void * addr)
121static __always_inline void
122arch___change_bit(unsigned long nr, volatile unsigned long *addr)
123{
124 int *m = ((int *) addr) + (nr >> 5);
125
126 *m ^= 1 << (nr & 31);
127}
128
129static inline int
130test_and_set_bit(unsigned long nr, volatile void *addr)

--- 50 unchanged lines hidden (view full) ---

181 :"Ir" (1UL << (nr & 31)), "m" (*m) : "memory");
182
183 return oldbit != 0;
184}
185
186/*
187 * WARNING: non atomic version.
188 */
123{
124 int *m = ((int *) addr) + (nr >> 5);
125
126 *m ^= 1 << (nr & 31);
127}
128
129static inline int
130test_and_set_bit(unsigned long nr, volatile void *addr)

--- 50 unchanged lines hidden (view full) ---

181 :"Ir" (1UL << (nr & 31)), "m" (*m) : "memory");
182
183 return oldbit != 0;
184}
185
186/*
187 * WARNING: non atomic version.
188 */
189static inline int
190__test_and_set_bit(unsigned long nr, volatile void * addr)
189static __always_inline bool
190arch___test_and_set_bit(unsigned long nr, volatile unsigned long *addr)
191{
192 unsigned long mask = 1 << (nr & 0x1f);
193 int *m = ((int *) addr) + (nr >> 5);
194 int old = *m;
195
196 *m = old | mask;
197 return (old & mask) != 0;
198}

--- 26 unchanged lines hidden (view full) ---

225 :"Ir" (1UL << (nr & 31)), "m" (*m) : "memory");
226
227 return oldbit != 0;
228}
229
230/*
231 * WARNING: non atomic version.
232 */
191{
192 unsigned long mask = 1 << (nr & 0x1f);
193 int *m = ((int *) addr) + (nr >> 5);
194 int old = *m;
195
196 *m = old | mask;
197 return (old & mask) != 0;
198}

--- 26 unchanged lines hidden (view full) ---

225 :"Ir" (1UL << (nr & 31)), "m" (*m) : "memory");
226
227 return oldbit != 0;
228}
229
230/*
231 * WARNING: non atomic version.
232 */
233static inline int
234__test_and_clear_bit(unsigned long nr, volatile void * addr)
233static __always_inline bool
234arch___test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
235{
236 unsigned long mask = 1 << (nr & 0x1f);
237 int *m = ((int *) addr) + (nr >> 5);
238 int old = *m;
239
240 *m = old & ~mask;
241 return (old & mask) != 0;
242}

--- 24 unchanged lines hidden (view full) ---

267 :"Ir" (1UL << (nr & 31)), "m" (*m) : "memory");
268
269 return oldbit != 0;
270}
271
272/*
273 * WARNING: non atomic version.
274 */
235{
236 unsigned long mask = 1 << (nr & 0x1f);
237 int *m = ((int *) addr) + (nr >> 5);
238 int old = *m;
239
240 *m = old & ~mask;
241 return (old & mask) != 0;
242}

--- 24 unchanged lines hidden (view full) ---

267 :"Ir" (1UL << (nr & 31)), "m" (*m) : "memory");
268
269 return oldbit != 0;
270}
271
272/*
273 * WARNING: non atomic version.
274 */
275static __inline__ int
276__test_and_change_bit(unsigned long nr, volatile void * addr)
275static __always_inline bool
276arch___test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
277{
278 unsigned long mask = 1 << (nr & 0x1f);
279 int *m = ((int *) addr) + (nr >> 5);
280 int old = *m;
281
282 *m = old ^ mask;
283 return (old & mask) != 0;
284}
285
277{
278 unsigned long mask = 1 << (nr & 0x1f);
279 int *m = ((int *) addr) + (nr >> 5);
280 int old = *m;
281
282 *m = old ^ mask;
283 return (old & mask) != 0;
284}
285
286static inline int
287test_bit(int nr, const volatile void * addr)
286static __always_inline bool
287arch_test_bit(unsigned long nr, const volatile unsigned long *addr)
288{
289 return (1UL & (((const int *) addr)[nr >> 5] >> (nr & 31))) != 0UL;
290}
291
292/*
293 * ffz = Find First Zero in word. Undefined if no zero exists,
294 * so code should check against ~0UL first..
295 *

--- 149 unchanged lines hidden (view full) ---

445 b0 = b[0];
446 b1 = b[1];
447 ofs = (b0 ? 0 : 64);
448 tmp = (b0 ? b0 : b1);
449
450 return __ffs(tmp) + ofs;
451}
452
288{
289 return (1UL & (((const int *) addr)[nr >> 5] >> (nr & 31))) != 0UL;
290}
291
292/*
293 * ffz = Find First Zero in word. Undefined if no zero exists,
294 * so code should check against ~0UL first..
295 *

--- 149 unchanged lines hidden (view full) ---

445 b0 = b[0];
446 b1 = b[1];
447 ofs = (b0 ? 0 : 64);
448 tmp = (b0 ? b0 : b1);
449
450 return __ffs(tmp) + ofs;
451}
452
453#include <asm-generic/bitops/non-instrumented-non-atomic.h>
454
453#include <asm-generic/bitops/le.h>
454
455#include <asm-generic/bitops/ext2-atomic-setbit.h>
456
457#endif /* __KERNEL__ */
458
459#endif /* _ALPHA_BITOPS_H */
455#include <asm-generic/bitops/le.h>
456
457#include <asm-generic/bitops/ext2-atomic-setbit.h>
458
459#endif /* __KERNEL__ */
460
461#endif /* _ALPHA_BITOPS_H */