]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/metag/include/asm/bitops.h
1 #ifndef __ASM_METAG_BITOPS_H
2 #define __ASM_METAG_BITOPS_H
4 #include <linux/compiler.h>
5 #include <asm/barrier.h>
6 #include <asm/global_lock.h>
10 * These functions are the basis of our bit ops.
12 static inline void set_bit(unsigned int bit
, volatile unsigned long *p
)
15 unsigned long mask
= 1UL << (bit
& 31);
19 __global_lock1(flags
);
22 __global_unlock1(flags
);
25 static inline void clear_bit(unsigned int bit
, volatile unsigned long *p
)
28 unsigned long mask
= 1UL << (bit
& 31);
32 __global_lock1(flags
);
35 __global_unlock1(flags
);
38 static inline void change_bit(unsigned int bit
, volatile unsigned long *p
)
41 unsigned long mask
= 1UL << (bit
& 31);
45 __global_lock1(flags
);
48 __global_unlock1(flags
);
51 static inline int test_and_set_bit(unsigned int bit
, volatile unsigned long *p
)
55 unsigned long mask
= 1UL << (bit
& 31);
59 __global_lock1(flags
);
65 __global_unlock1(flags
);
67 return (old
& mask
) != 0;
70 static inline int test_and_clear_bit(unsigned int bit
,
71 volatile unsigned long *p
)
75 unsigned long mask
= 1UL << (bit
& 31);
79 __global_lock1(flags
);
85 __global_unlock1(flags
);
87 return (old
& mask
) != 0;
90 static inline int test_and_change_bit(unsigned int bit
,
91 volatile unsigned long *p
)
95 unsigned long mask
= 1UL << (bit
& 31);
99 __global_lock1(flags
);
103 __global_unlock1(flags
);
105 return (old
& mask
) != 0;
109 #include <asm-generic/bitops/atomic.h>
110 #endif /* CONFIG_SMP */
112 #include <asm-generic/bitops/non-atomic.h>
113 #include <asm-generic/bitops/find.h>
114 #include <asm-generic/bitops/ffs.h>
115 #include <asm-generic/bitops/__ffs.h>
116 #include <asm-generic/bitops/ffz.h>
117 #include <asm-generic/bitops/fls.h>
118 #include <asm-generic/bitops/__fls.h>
119 #include <asm-generic/bitops/fls64.h>
120 #include <asm-generic/bitops/hweight.h>
121 #include <asm-generic/bitops/lock.h>
122 #include <asm-generic/bitops/sched.h>
123 #include <asm-generic/bitops/le.h>
124 #include <asm-generic/bitops/ext2-atomic.h>
126 #endif /* __ASM_METAG_BITOPS_H */