Linux-libre 3.6.3-gnu1
[librecmc/linux-libre.git] / arch / x86 / include / asm / spinlock_types.h
1 #ifndef _ASM_X86_SPINLOCK_TYPES_H
2 #define _ASM_X86_SPINLOCK_TYPES_H
3
4 #ifndef __LINUX_SPINLOCK_TYPES_H
5 # error "please don't include this file directly"
6 #endif
7
8 #include <linux/types.h>
9
10 #if (CONFIG_NR_CPUS < 256)
11 typedef u8  __ticket_t;
12 typedef u16 __ticketpair_t;
13 #else
14 typedef u16 __ticket_t;
15 typedef u32 __ticketpair_t;
16 #endif
17
18 #define TICKET_SHIFT    (sizeof(__ticket_t) * 8)
19
20 typedef struct arch_spinlock {
21         union {
22                 __ticketpair_t head_tail;
23                 struct __raw_tickets {
24                         __ticket_t head, tail;
25                 } tickets;
26         };
27 } arch_spinlock_t;
28
29 #define __ARCH_SPIN_LOCK_UNLOCKED       { { 0 } }
30
31 #include <asm/rwlock.h>
32
33 #endif /* _ASM_X86_SPINLOCK_TYPES_H */