Rev 3031 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3031 | Rev 5272 | ||
---|---|---|---|
Line 22... | Line 22... | ||
22 | * In the UP-nondebug case there's no real locking going on, so the |
22 | * In the UP-nondebug case there's no real locking going on, so the |
23 | * only thing we have to do is to keep the preempt counts and irq |
23 | * only thing we have to do is to keep the preempt counts and irq |
24 | * flags straight, to suppress compiler warnings of unused lock |
24 | * flags straight, to suppress compiler warnings of unused lock |
25 | * variables, and to add the proper checker annotations: |
25 | * variables, and to add the proper checker annotations: |
26 | */ |
26 | */ |
- | 27 | #define ___LOCK(lock) \ |
|
- | 28 | do { __acquire(lock); (void)(lock); } while (0) |
|
- | 29 | ||
27 | #define __LOCK(lock) \ |
30 | #define __LOCK(lock) \ |
28 | do { preempt_disable(); __acquire(lock); (void)(lock); } while (0) |
31 | do { preempt_disable(); ___LOCK(lock); } while (0) |
Line 29... | Line 32... | ||
29 | 32 | ||
30 | #define __LOCK_BH(lock) \ |
33 | #define __LOCK_BH(lock) \ |
Line 31... | Line 34... | ||
31 | do { local_bh_disable(); __LOCK(lock); } while (0) |
34 | do { __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_LOCK_OFFSET); ___LOCK(lock); } while (0) |
32 | 35 | ||
Line 33... | Line 36... | ||
33 | #define __LOCK_IRQ(lock) \ |
36 | #define __LOCK_IRQ(lock) \ |
34 | do { asm volatile ("cli \n"); __LOCK(lock); } while (0) |
- | |
35 | - | ||
36 | #define __LOCK_IRQSAVE(lock, flags) \ |
- | |
37 | do { \ |
- | |
38 | __asm__ __volatile__ ( \ |
- | |
39 | "pushf\n\t" \ |
37 | do { local_irq_disable(); __LOCK(lock); } while (0) |
- | 38 | ||
40 | "popl %0\n\t" \ |
39 | #define __LOCK_IRQSAVE(lock, flags) \ |
41 | "cli\n" \ |
40 | do { local_irq_save(flags); __LOCK(lock); } while (0) |
Line 42... | Line 41... | ||
42 | : "=r" (flags)); \ |
41 | |
43 | __LOCK(lock); \ |
42 | #define ___UNLOCK(lock) \ |
Line 44... | Line 43... | ||
44 | } while (0) \ |
43 | do { __release(lock); (void)(lock); } while (0) |
45 | 44 | ||
46 | #define __UNLOCK(lock) \ |
45 | #define __UNLOCK(lock) \ |
Line 47... | Line 46... | ||
47 | do { preempt_enable(); __release(lock); (void)(lock); } while (0) |
46 | do { preempt_enable(); ___UNLOCK(lock); } while (0) |
48 | 47 | ||
Line 49... | Line 48... | ||
49 | #define __UNLOCK_BH(lock) \ |
48 | #define __UNLOCK_BH(lock) \ |
50 | do { preempt_enable_no_resched(); local_bh_enable(); \ |
- | |
51 | __release(lock); (void)(lock); } while (0) |
- | |
52 | 49 | do { __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_LOCK_OFFSET); \ |
|
53 | #define __UNLOCK_IRQ(lock) \ |
- | |
54 | do { asm volatile ("sti \n"); __UNLOCK(lock); } while (0) |
- | |
55 | 50 | ___UNLOCK(lock); } while (0) |
|
56 | #define __UNLOCK_IRQRESTORE(lock, flags) \ |
51 | |
57 | do { \ |
52 | #define __UNLOCK_IRQ(lock) \ |
58 | if (flags & (1<<9)) \ |
53 | do { local_irq_enable(); __UNLOCK(lock); } while (0) |
59 | __asm__ __volatile__ ("sti"); \ |
54 | |
60 | __UNLOCK(lock); \ |
55 | #define __UNLOCK_IRQRESTORE(lock, flags) \ |
61 | } while (0) |
56 | do { local_irq_restore(flags); __UNLOCK(lock); } while (0) |
62 | 57 | ||
63 | #define _spin_lock(lock) __LOCK(lock) |
58 | #define _raw_spin_lock(lock) __LOCK(lock) |
64 | #define _spin_lock_nested(lock, subclass) __LOCK(lock) |
59 | #define _raw_spin_lock_nested(lock, subclass) __LOCK(lock) |
65 | #define _read_lock(lock) __LOCK(lock) |
60 | #define _raw_read_lock(lock) __LOCK(lock) |
66 | #define _write_lock(lock) __LOCK(lock) |
61 | #define _raw_write_lock(lock) __LOCK(lock) |
67 | #define _spin_lock_bh(lock) __LOCK_BH(lock) |
62 | #define _raw_spin_lock_bh(lock) __LOCK_BH(lock) |
68 | #define _read_lock_bh(lock) __LOCK_BH(lock) |
63 | #define _raw_read_lock_bh(lock) __LOCK_BH(lock) |
69 | #define _write_lock_bh(lock) __LOCK_BH(lock) |
64 | #define _raw_write_lock_bh(lock) __LOCK_BH(lock) |
70 | #define _spin_lock_irq(lock) __LOCK_IRQ(lock) |
65 | #define _raw_spin_lock_irq(lock) __LOCK_IRQ(lock) |
71 | #define _read_lock_irq(lock) __LOCK_IRQ(lock) |
66 | #define _raw_read_lock_irq(lock) __LOCK_IRQ(lock) |
72 | #define _write_lock_irq(lock) __LOCK_IRQ(lock) |
67 | #define _raw_write_lock_irq(lock) __LOCK_IRQ(lock) |
73 | #define _spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) |
68 | #define _raw_spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) |
74 | #define _read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) |
69 | #define _raw_read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) |
75 | #define _write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) |
70 | #define _raw_write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) |
76 | #define _spin_trylock(lock) ({ __LOCK(lock); 1; }) |
71 | #define _raw_spin_trylock(lock) ({ __LOCK(lock); 1; }) |
77 | #define _read_trylock(lock) ({ __LOCK(lock); 1; }) |
72 | #define _raw_read_trylock(lock) ({ __LOCK(lock); 1; }) |
78 | #define _write_trylock(lock) ({ __LOCK(lock); 1; }) |
73 | #define _raw_write_trylock(lock) ({ __LOCK(lock); 1; }) |
79 | #define _spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; }) |
74 | #define _raw_spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; }) |
80 | #define _spin_unlock(lock) __UNLOCK(lock) |
75 | #define _raw_spin_unlock(lock) __UNLOCK(lock) |
81 | #define _read_unlock(lock) __UNLOCK(lock) |
76 | #define _raw_read_unlock(lock) __UNLOCK(lock) |
82 | #define _write_unlock(lock) __UNLOCK(lock) |
77 | #define _raw_write_unlock(lock) __UNLOCK(lock) |
- | 78 | #define _raw_spin_unlock_bh(lock) __UNLOCK_BH(lock) |
|
83 | #define _spin_unlock_bh(lock) __UNLOCK_BH(lock) |
79 | #define _raw_write_unlock_bh(lock) __UNLOCK_BH(lock) |
- | 80 | #define _raw_read_unlock_bh(lock) __UNLOCK_BH(lock) |
|
84 | #define _write_unlock_bh(lock) __UNLOCK_BH(lock) |
81 | #define _raw_spin_unlock_irq(lock) __UNLOCK_IRQ(lock) |
- | 82 | #define _raw_read_unlock_irq(lock) __UNLOCK_IRQ(lock) |
|
Line 85... | Line 83... | ||
85 | #define _read_unlock_bh(lock) __UNLOCK_BH(lock) |
83 | #define _raw_write_unlock_irq(lock) __UNLOCK_IRQ(lock) |