GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / include / linux / irqflags.h
blob835a249918bf1720322f3777e9b2ae757b4edbe6
1 /* Modified by Broadcom Corp. Portions Copyright (c) Broadcom Corp, 2012. */
2 /*
3 * include/linux/irqflags.h
5 * IRQ flags tracing: follow the state of the hardirq and softirq flags and
6 * provide callbacks for transitions between ON and OFF states.
8 * This file gets included from lowlevel asm headers too, to provide
9 * wrapped versions of the local_irq_*() APIs, based on the
10 * raw_local_irq_*() macros from the lowlevel headers.
12 #ifndef _LINUX_TRACE_IRQFLAGS_H
13 #define _LINUX_TRACE_IRQFLAGS_H
15 #include <linux/typecheck.h>
17 #ifndef BCMDBG
18 #undef CONFIG_TRACE_IRQFLAGS
19 #endif
21 #ifdef CONFIG_TRACE_IRQFLAGS
22 extern void trace_softirqs_on(unsigned long ip);
23 extern void trace_softirqs_off(unsigned long ip);
24 extern void trace_hardirqs_on(void);
25 extern void trace_hardirqs_off(void);
26 # define trace_hardirq_context(p) ((p)->hardirq_context)
27 # define trace_softirq_context(p) ((p)->softirq_context)
28 # define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled)
29 # define trace_softirqs_enabled(p) ((p)->softirqs_enabled)
30 # define trace_hardirq_enter() do { current->hardirq_context++; } while (0)
31 # define trace_hardirq_exit() do { current->hardirq_context--; } while (0)
32 # define lockdep_softirq_enter() do { current->softirq_context++; } while (0)
33 # define lockdep_softirq_exit() do { current->softirq_context--; } while (0)
34 # define INIT_TRACE_IRQFLAGS .softirqs_enabled = 1,
35 #else
36 # define trace_hardirqs_on() do { } while (0)
37 # define trace_hardirqs_off() do { } while (0)
38 # define trace_softirqs_on(ip) do { } while (0)
39 # define trace_softirqs_off(ip) do { } while (0)
40 # define trace_hardirq_context(p) 0
41 # define trace_softirq_context(p) 0
42 # define trace_hardirqs_enabled(p) 0
43 # define trace_softirqs_enabled(p) 0
44 # define trace_hardirq_enter() do { } while (0)
45 # define trace_hardirq_exit() do { } while (0)
46 # define lockdep_softirq_enter() do { } while (0)
47 # define lockdep_softirq_exit() do { } while (0)
48 # define INIT_TRACE_IRQFLAGS
49 #endif
51 #if defined(CONFIG_IRQSOFF_TRACER) || defined(CONFIG_PREEMPT_TRACER)
52 extern void stop_critical_timings(void);
53 extern void start_critical_timings(void);
54 #else
55 # define stop_critical_timings() do { } while (0)
56 # define start_critical_timings() do { } while (0)
57 #endif
59 #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
61 #include <asm/irqflags.h>
63 #define local_irq_enable() \
64 do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)
65 #define local_irq_disable() \
66 do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0)
67 #define local_irq_save(flags) \
68 do { \
69 typecheck(unsigned long, flags); \
70 raw_local_irq_save(flags); \
71 trace_hardirqs_off(); \
72 } while (0)
75 #define local_irq_restore(flags) \
76 do { \
77 typecheck(unsigned long, flags); \
78 if (raw_irqs_disabled_flags(flags)) { \
79 raw_local_irq_restore(flags); \
80 trace_hardirqs_off(); \
81 } else { \
82 trace_hardirqs_on(); \
83 raw_local_irq_restore(flags); \
84 } \
85 } while (0)
86 #else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */
88 * The local_irq_*() APIs are equal to the raw_local_irq*()
89 * if !TRACE_IRQFLAGS.
91 # define raw_local_irq_disable() local_irq_disable()
92 # define raw_local_irq_enable() local_irq_enable()
93 # define raw_local_irq_save(flags) \
94 do { \
95 typecheck(unsigned long, flags); \
96 local_irq_save(flags); \
97 } while (0)
98 # define raw_local_irq_restore(flags) \
99 do { \
100 typecheck(unsigned long, flags); \
101 local_irq_restore(flags); \
102 } while (0)
103 #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */
105 #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
106 #define safe_halt() \
107 do { \
108 trace_hardirqs_on(); \
109 raw_safe_halt(); \
110 } while (0)
112 #define local_save_flags(flags) \
113 do { \
114 typecheck(unsigned long, flags); \
115 raw_local_save_flags(flags); \
116 } while (0)
118 #define irqs_disabled() \
119 ({ \
120 unsigned long _flags; \
122 raw_local_save_flags(_flags); \
123 raw_irqs_disabled_flags(_flags); \
126 #define irqs_disabled_flags(flags) \
127 ({ \
128 typecheck(unsigned long, flags); \
129 raw_irqs_disabled_flags(flags); \
131 #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */
133 #endif