x86, ticketlock: Clean up types and accessors
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / x86 / include / asm / spinlock_types.h
blob1c51bd231e49416efb67fdf7619f3c1cdf9a1eb9
1 #ifndef _ASM_X86_SPINLOCK_TYPES_H
2 #define _ASM_X86_SPINLOCK_TYPES_H
4 #ifndef __LINUX_SPINLOCK_TYPES_H
5 # error "please don't include this file directly"
6 #endif
8 #include <linux/types.h>
10 #if (CONFIG_NR_CPUS < 256)
11 typedef u8 __ticket_t;
12 #else
13 typedef u16 __ticket_t;
14 #endif
16 #define TICKET_SHIFT (sizeof(__ticket_t) * 8)
17 #define TICKET_MASK ((__ticket_t)((1 << TICKET_SHIFT) - 1))
19 typedef struct arch_spinlock {
20 union {
21 unsigned int slock;
22 struct __raw_tickets {
23 __ticket_t head, tail;
24 } tickets;
26 } arch_spinlock_t;
28 #define __ARCH_SPIN_LOCK_UNLOCKED { { .slock = 0 } }
30 #include <asm/rwlock.h>
32 #endif /* _ASM_X86_SPINLOCK_TYPES_H */