diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-generic/atomic.h | 5 | ||||
| -rw-r--r-- | include/asm-generic/cmpxchg-local.h | 1 | ||||
| -rw-r--r-- | include/asm-generic/irqflags.h | 52 | ||||
| -rw-r--r-- | include/linux/hardirq.h | 1 | ||||
| -rw-r--r-- | include/linux/irqflags.h | 107 | ||||
| -rw-r--r-- | include/linux/list.h | 1 | ||||
| -rw-r--r-- | include/linux/spinlock.h | 1 |
7 files changed, 92 insertions, 76 deletions
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h index e53347fbf1da..fd57b8477fab 100644 --- a/include/asm-generic/atomic.h +++ b/include/asm-generic/atomic.h | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | */ | 43 | */ |
| 44 | #define atomic_set(v, i) (((v)->counter) = (i)) | 44 | #define atomic_set(v, i) (((v)->counter) = (i)) |
| 45 | 45 | ||
| 46 | #include <linux/irqflags.h> | ||
| 46 | #include <asm/system.h> | 47 | #include <asm/system.h> |
| 47 | 48 | ||
| 48 | /** | 49 | /** |
| @@ -57,7 +58,7 @@ static inline int atomic_add_return(int i, atomic_t *v) | |||
| 57 | unsigned long flags; | 58 | unsigned long flags; |
| 58 | int temp; | 59 | int temp; |
| 59 | 60 | ||
| 60 | raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */ | 61 | raw_local_irq_save(flags); /* Don't trace it in an irqsoff handler */ |
| 61 | temp = v->counter; | 62 | temp = v->counter; |
| 62 | temp += i; | 63 | temp += i; |
| 63 | v->counter = temp; | 64 | v->counter = temp; |
| @@ -78,7 +79,7 @@ static inline int atomic_sub_return(int i, atomic_t *v) | |||
| 78 | unsigned long flags; | 79 | unsigned long flags; |
| 79 | int temp; | 80 | int temp; |
| 80 | 81 | ||
| 81 | raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */ | 82 | raw_local_irq_save(flags); /* Don't trace it in an irqsoff handler */ |
| 82 | temp = v->counter; | 83 | temp = v->counter; |
| 83 | temp -= i; | 84 | temp -= i; |
| 84 | v->counter = temp; | 85 | v->counter = temp; |
diff --git a/include/asm-generic/cmpxchg-local.h b/include/asm-generic/cmpxchg-local.h index b2ba2fc8829a..2533fddd34a6 100644 --- a/include/asm-generic/cmpxchg-local.h +++ b/include/asm-generic/cmpxchg-local.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define __ASM_GENERIC_CMPXCHG_LOCAL_H | 2 | #define __ASM_GENERIC_CMPXCHG_LOCAL_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <linux/irqflags.h> | ||
| 5 | 6 | ||
| 6 | extern unsigned long wrong_size_cmpxchg(volatile void *ptr); | 7 | extern unsigned long wrong_size_cmpxchg(volatile void *ptr); |
| 7 | 8 | ||
diff --git a/include/asm-generic/irqflags.h b/include/asm-generic/irqflags.h index 9aebf618275a..1f40d0024cf3 100644 --- a/include/asm-generic/irqflags.h +++ b/include/asm-generic/irqflags.h | |||
| @@ -5,68 +5,62 @@ | |||
| 5 | * All architectures should implement at least the first two functions, | 5 | * All architectures should implement at least the first two functions, |
| 6 | * usually inline assembly will be the best way. | 6 | * usually inline assembly will be the best way. |
| 7 | */ | 7 | */ |
| 8 | #ifndef RAW_IRQ_DISABLED | 8 | #ifndef ARCH_IRQ_DISABLED |
| 9 | #define RAW_IRQ_DISABLED 0 | 9 | #define ARCH_IRQ_DISABLED 0 |
| 10 | #define RAW_IRQ_ENABLED 1 | 10 | #define ARCH_IRQ_ENABLED 1 |
| 11 | #endif | 11 | #endif |
| 12 | 12 | ||
| 13 | /* read interrupt enabled status */ | 13 | /* read interrupt enabled status */ |
| 14 | #ifndef __raw_local_save_flags | 14 | #ifndef arch_local_save_flags |
| 15 | unsigned long __raw_local_save_flags(void); | 15 | unsigned long arch_local_save_flags(void); |
| 16 | #endif | 16 | #endif |
| 17 | 17 | ||
| 18 | /* set interrupt enabled status */ | 18 | /* set interrupt enabled status */ |
| 19 | #ifndef raw_local_irq_restore | 19 | #ifndef arch_local_irq_restore |
| 20 | void raw_local_irq_restore(unsigned long flags); | 20 | void arch_local_irq_restore(unsigned long flags); |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | /* get status and disable interrupts */ | 23 | /* get status and disable interrupts */ |
| 24 | #ifndef __raw_local_irq_save | 24 | #ifndef arch_local_irq_save |
| 25 | static inline unsigned long __raw_local_irq_save(void) | 25 | static inline unsigned long arch_local_irq_save(void) |
| 26 | { | 26 | { |
| 27 | unsigned long flags; | 27 | unsigned long flags; |
| 28 | flags = __raw_local_save_flags(); | 28 | flags = arch_local_save_flags(); |
| 29 | raw_local_irq_restore(RAW_IRQ_DISABLED); | 29 | arch_local_irq_restore(ARCH_IRQ_DISABLED); |
| 30 | return flags; | 30 | return flags; |
| 31 | } | 31 | } |
| 32 | #endif | 32 | #endif |
| 33 | 33 | ||
| 34 | /* test flags */ | 34 | /* test flags */ |
| 35 | #ifndef raw_irqs_disabled_flags | 35 | #ifndef arch_irqs_disabled_flags |
| 36 | static inline int raw_irqs_disabled_flags(unsigned long flags) | 36 | static inline int arch_irqs_disabled_flags(unsigned long flags) |
| 37 | { | 37 | { |
| 38 | return flags == RAW_IRQ_DISABLED; | 38 | return flags == ARCH_IRQ_DISABLED; |
| 39 | } | 39 | } |
| 40 | #endif | 40 | #endif |
| 41 | 41 | ||
| 42 | /* unconditionally enable interrupts */ | 42 | /* unconditionally enable interrupts */ |
| 43 | #ifndef raw_local_irq_enable | 43 | #ifndef arch_local_irq_enable |
| 44 | static inline void raw_local_irq_enable(void) | 44 | static inline void arch_local_irq_enable(void) |
| 45 | { | 45 | { |
| 46 | raw_local_irq_restore(RAW_IRQ_ENABLED); | 46 | arch_local_irq_restore(ARCH_IRQ_ENABLED); |
| 47 | } | 47 | } |
| 48 | #endif | 48 | #endif |
| 49 | 49 | ||
| 50 | /* unconditionally disable interrupts */ | 50 | /* unconditionally disable interrupts */ |
| 51 | #ifndef raw_local_irq_disable | 51 | #ifndef arch_local_irq_disable |
| 52 | static inline void raw_local_irq_disable(void) | 52 | static inline void arch_local_irq_disable(void) |
| 53 | { | 53 | { |
| 54 | raw_local_irq_restore(RAW_IRQ_DISABLED); | 54 | arch_local_irq_restore(ARCH_IRQ_DISABLED); |
| 55 | } | 55 | } |
| 56 | #endif | 56 | #endif |
| 57 | 57 | ||
| 58 | /* test hardware interrupt enable bit */ | 58 | /* test hardware interrupt enable bit */ |
| 59 | #ifndef raw_irqs_disabled | 59 | #ifndef arch_irqs_disabled |
| 60 | static inline int raw_irqs_disabled(void) | 60 | static inline int arch_irqs_disabled(void) |
| 61 | { | 61 | { |
| 62 | return raw_irqs_disabled_flags(__raw_local_save_flags()); | 62 | return arch_irqs_disabled_flags(arch_local_save_flags()); |
| 63 | } | 63 | } |
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | #define raw_local_save_flags(flags) \ | ||
| 67 | do { (flags) = __raw_local_save_flags(); } while (0) | ||
| 68 | |||
| 69 | #define raw_local_irq_save(flags) \ | ||
| 70 | do { (flags) = __raw_local_irq_save(); } while (0) | ||
| 71 | |||
| 72 | #endif /* __ASM_GENERIC_IRQFLAGS_H */ | 66 | #endif /* __ASM_GENERIC_IRQFLAGS_H */ |
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 96c323ac44df..8a389b608ce3 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | #include <linux/lockdep.h> | 8 | #include <linux/lockdep.h> |
| 9 | #include <linux/ftrace_irq.h> | 9 | #include <linux/ftrace_irq.h> |
| 10 | #include <asm/hardirq.h> | 10 | #include <asm/hardirq.h> |
| 11 | #include <asm/system.h> | ||
| 12 | 11 | ||
| 13 | /* | 12 | /* |
| 14 | * We put the hardirq and softirq counter into the preemption | 13 | * We put the hardirq and softirq counter into the preemption |
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h index 006bf45eae30..d176d658fe25 100644 --- a/include/linux/irqflags.h +++ b/include/linux/irqflags.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #define _LINUX_TRACE_IRQFLAGS_H | 12 | #define _LINUX_TRACE_IRQFLAGS_H |
| 13 | 13 | ||
| 14 | #include <linux/typecheck.h> | 14 | #include <linux/typecheck.h> |
| 15 | #include <asm/irqflags.h> | ||
| 15 | 16 | ||
| 16 | #ifdef CONFIG_TRACE_IRQFLAGS | 17 | #ifdef CONFIG_TRACE_IRQFLAGS |
| 17 | extern void trace_softirqs_on(unsigned long ip); | 18 | extern void trace_softirqs_on(unsigned long ip); |
| @@ -52,17 +53,45 @@ | |||
| 52 | # define start_critical_timings() do { } while (0) | 53 | # define start_critical_timings() do { } while (0) |
| 53 | #endif | 54 | #endif |
| 54 | 55 | ||
| 55 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT | 56 | /* |
| 56 | 57 | * Wrap the arch provided IRQ routines to provide appropriate checks. | |
| 57 | #include <asm/irqflags.h> | 58 | */ |
| 59 | #define raw_local_irq_disable() arch_local_irq_disable() | ||
| 60 | #define raw_local_irq_enable() arch_local_irq_enable() | ||
| 61 | #define raw_local_irq_save(flags) \ | ||
| 62 | do { \ | ||
| 63 | typecheck(unsigned long, flags); \ | ||
| 64 | flags = arch_local_irq_save(); \ | ||
| 65 | } while (0) | ||
| 66 | #define raw_local_irq_restore(flags) \ | ||
| 67 | do { \ | ||
| 68 | typecheck(unsigned long, flags); \ | ||
| 69 | arch_local_irq_restore(flags); \ | ||
| 70 | } while (0) | ||
| 71 | #define raw_local_save_flags(flags) \ | ||
| 72 | do { \ | ||
| 73 | typecheck(unsigned long, flags); \ | ||
| 74 | flags = arch_local_save_flags(); \ | ||
| 75 | } while (0) | ||
| 76 | #define raw_irqs_disabled_flags(flags) \ | ||
| 77 | ({ \ | ||
| 78 | typecheck(unsigned long, flags); \ | ||
| 79 | arch_irqs_disabled_flags(flags); \ | ||
| 80 | }) | ||
| 81 | #define raw_irqs_disabled() (arch_irqs_disabled()) | ||
| 82 | #define raw_safe_halt() arch_safe_halt() | ||
| 58 | 83 | ||
| 84 | /* | ||
| 85 | * The local_irq_*() APIs are equal to the raw_local_irq*() | ||
| 86 | * if !TRACE_IRQFLAGS. | ||
| 87 | */ | ||
| 88 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT | ||
| 59 | #define local_irq_enable() \ | 89 | #define local_irq_enable() \ |
| 60 | do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0) | 90 | do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0) |
| 61 | #define local_irq_disable() \ | 91 | #define local_irq_disable() \ |
| 62 | do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0) | 92 | do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0) |
| 63 | #define local_irq_save(flags) \ | 93 | #define local_irq_save(flags) \ |
| 64 | do { \ | 94 | do { \ |
| 65 | typecheck(unsigned long, flags); \ | ||
| 66 | raw_local_irq_save(flags); \ | 95 | raw_local_irq_save(flags); \ |
| 67 | trace_hardirqs_off(); \ | 96 | trace_hardirqs_off(); \ |
| 68 | } while (0) | 97 | } while (0) |
| @@ -70,7 +99,6 @@ | |||
| 70 | 99 | ||
| 71 | #define local_irq_restore(flags) \ | 100 | #define local_irq_restore(flags) \ |
| 72 | do { \ | 101 | do { \ |
| 73 | typecheck(unsigned long, flags); \ | ||
| 74 | if (raw_irqs_disabled_flags(flags)) { \ | 102 | if (raw_irqs_disabled_flags(flags)) { \ |
| 75 | raw_local_irq_restore(flags); \ | 103 | raw_local_irq_restore(flags); \ |
| 76 | trace_hardirqs_off(); \ | 104 | trace_hardirqs_off(); \ |
| @@ -79,51 +107,44 @@ | |||
| 79 | raw_local_irq_restore(flags); \ | 107 | raw_local_irq_restore(flags); \ |
| 80 | } \ | 108 | } \ |
| 81 | } while (0) | 109 | } while (0) |
| 82 | #else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */ | 110 | #define local_save_flags(flags) \ |
| 83 | /* | ||
| 84 | * The local_irq_*() APIs are equal to the raw_local_irq*() | ||
| 85 | * if !TRACE_IRQFLAGS. | ||
| 86 | */ | ||
| 87 | # define raw_local_irq_disable() local_irq_disable() | ||
| 88 | # define raw_local_irq_enable() local_irq_enable() | ||
| 89 | # define raw_local_irq_save(flags) \ | ||
| 90 | do { \ | ||
| 91 | typecheck(unsigned long, flags); \ | ||
| 92 | local_irq_save(flags); \ | ||
| 93 | } while (0) | ||
| 94 | # define raw_local_irq_restore(flags) \ | ||
| 95 | do { \ | 111 | do { \ |
| 96 | typecheck(unsigned long, flags); \ | 112 | raw_local_save_flags(flags); \ |
| 97 | local_irq_restore(flags); \ | ||
| 98 | } while (0) | 113 | } while (0) |
| 99 | #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ | ||
| 100 | 114 | ||
| 101 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT | 115 | #define irqs_disabled_flags(flags) \ |
| 102 | #define safe_halt() \ | 116 | ({ \ |
| 103 | do { \ | 117 | raw_irqs_disabled_flags(flags); \ |
| 104 | trace_hardirqs_on(); \ | 118 | }) |
| 105 | raw_safe_halt(); \ | ||
| 106 | } while (0) | ||
| 107 | 119 | ||
| 108 | #define local_save_flags(flags) \ | 120 | #define irqs_disabled() \ |
| 109 | do { \ | 121 | ({ \ |
| 110 | typecheck(unsigned long, flags); \ | 122 | unsigned long _flags; \ |
| 111 | raw_local_save_flags(flags); \ | 123 | raw_local_save_flags(_flags); \ |
| 124 | raw_irqs_disabled_flags(_flags); \ | ||
| 125 | }) | ||
| 126 | |||
| 127 | #define safe_halt() \ | ||
| 128 | do { \ | ||
| 129 | trace_hardirqs_on(); \ | ||
| 130 | raw_safe_halt(); \ | ||
| 112 | } while (0) | 131 | } while (0) |
| 113 | 132 | ||
| 114 | #define irqs_disabled() \ | ||
| 115 | ({ \ | ||
| 116 | unsigned long _flags; \ | ||
| 117 | \ | ||
| 118 | raw_local_save_flags(_flags); \ | ||
| 119 | raw_irqs_disabled_flags(_flags); \ | ||
| 120 | }) | ||
| 121 | 133 | ||
| 122 | #define irqs_disabled_flags(flags) \ | 134 | #else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */ |
| 123 | ({ \ | 135 | |
| 124 | typecheck(unsigned long, flags); \ | 136 | #define local_irq_enable() do { raw_local_irq_enable(); } while (0) |
| 125 | raw_irqs_disabled_flags(flags); \ | 137 | #define local_irq_disable() do { raw_local_irq_disable(); } while (0) |
| 126 | }) | 138 | #define local_irq_save(flags) \ |
| 139 | do { \ | ||
| 140 | raw_local_irq_save(flags); \ | ||
| 141 | } while (0) | ||
| 142 | #define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0) | ||
| 143 | #define local_save_flags(flags) do { raw_local_save_flags(flags); } while (0) | ||
| 144 | #define irqs_disabled() (raw_irqs_disabled()) | ||
| 145 | #define irqs_disabled_flags(flags) (raw_irqs_disabled_flags(flags)) | ||
| 146 | #define safe_halt() do { raw_safe_halt(); } while (0) | ||
| 147 | |||
| 127 | #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ | 148 | #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ |
| 128 | 149 | ||
| 129 | #endif | 150 | #endif |
diff --git a/include/linux/list.h b/include/linux/list.h index d167b5d7c0ac..88a000617d77 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | #include <linux/stddef.h> | 5 | #include <linux/stddef.h> |
| 6 | #include <linux/poison.h> | 6 | #include <linux/poison.h> |
| 7 | #include <linux/prefetch.h> | 7 | #include <linux/prefetch.h> |
| 8 | #include <asm/system.h> | ||
| 9 | 8 | ||
| 10 | /* | 9 | /* |
| 11 | * Simple doubly linked list implementation. | 10 | * Simple doubly linked list implementation. |
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index f8854655860e..80e535897de6 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | #include <linux/preempt.h> | 50 | #include <linux/preempt.h> |
| 51 | #include <linux/linkage.h> | 51 | #include <linux/linkage.h> |
| 52 | #include <linux/compiler.h> | 52 | #include <linux/compiler.h> |
| 53 | #include <linux/irqflags.h> | ||
| 53 | #include <linux/thread_info.h> | 54 | #include <linux/thread_info.h> |
| 54 | #include <linux/kernel.h> | 55 | #include <linux/kernel.h> |
| 55 | #include <linux/stringify.h> | 56 | #include <linux/stringify.h> |
