aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/irqflags.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2010-10-07 09:08:55 -0400
committerDavid Howells <dhowells@redhat.com>2010-10-07 09:08:55 -0400
commitdf9ee29270c11dba7d0fe0b83ce47a4d8e8d2101 (patch)
tree0c9a87ef1ea042c4432f122c3d03614d21156fc1 /include/linux/irqflags.h
parentca4d3e6746bdcfccb517349bce2d2c5b5614fb6f (diff)
Fix IRQ flag handling naming
Fix the IRQ flag handling naming. In linux/irqflags.h under one configuration, it maps: local_irq_enable() -> raw_local_irq_enable() local_irq_disable() -> raw_local_irq_disable() local_irq_save() -> raw_local_irq_save() ... and under the other configuration, it maps: raw_local_irq_enable() -> local_irq_enable() raw_local_irq_disable() -> local_irq_disable() raw_local_irq_save() -> local_irq_save() ... This is quite confusing. There should be one set of names expected of the arch, and this should be wrapped to give another set of names that are expected by users of this facility. Change this to have the arch provide: flags = arch_local_save_flags() flags = arch_local_irq_save() arch_local_irq_restore(flags) arch_local_irq_disable() arch_local_irq_enable() arch_irqs_disabled_flags(flags) arch_irqs_disabled() arch_safe_halt() Then linux/irqflags.h wraps these to provide: raw_local_save_flags(flags) raw_local_irq_save(flags) raw_local_irq_restore(flags) raw_local_irq_disable() raw_local_irq_enable() raw_irqs_disabled_flags(flags) raw_irqs_disabled() raw_safe_halt() with type checking on the flags 'arguments', and then wraps those to provide: local_save_flags(flags) local_irq_save(flags) local_irq_restore(flags) local_irq_disable() local_irq_enable() irqs_disabled_flags(flags) irqs_disabled() safe_halt() with tracing included if enabled. The arch functions can now all be inline functions rather than some of them having to be macros. Signed-off-by: David Howells <dhowells@redhat.com> [X86, FRV, MN10300] Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> [Tile] Signed-off-by: Michal Simek <monstr@monstr.eu> [Microblaze] Tested-by: Catalin Marinas <catalin.marinas@arm.com> [ARM] Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> [AVR] Acked-by: Tony Luck <tony.luck@intel.com> [IA-64] Acked-by: Hirokazu Takata <takata@linux-m32r.org> [M32R] Acked-by: Greg Ungerer <gerg@uclinux.org> [M68K/M68KNOMMU] Acked-by: Ralf Baechle <ralf@linux-mips.org> [MIPS] Acked-by: Kyle McMartin <kyle@mcmartin.ca> [PA-RISC] Acked-by: Paul Mackerras <paulus@samba.org> [PowerPC] Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> [S390] Acked-by: Chen Liqin <liqin.chen@sunplusct.com> [Score] Acked-by: Matt Fleming <matt@console-pimps.org> [SH] Acked-by: David S. Miller <davem@davemloft.net> [Sparc] Acked-by: Chris Zankel <chris@zankel.net> [Xtensa] Reviewed-by: Richard Henderson <rth@twiddle.net> [Alpha] Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp> [H8300] Cc: starvik@axis.com [CRIS] Cc: jesper.nilsson@axis.com [CRIS] Cc: linux-cris-kernel@axis.com
Diffstat (limited to 'include/linux/irqflags.h')
-rw-r--r--include/linux/irqflags.h107
1 files changed, 64 insertions, 43 deletions
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