diff options
Diffstat (limited to 'include/linux/irqflags.h')
-rw-r--r-- | include/linux/irqflags.h | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h index 2b1c2e58566e..74bde13224c9 100644 --- a/include/linux/irqflags.h +++ b/include/linux/irqflags.h | |||
@@ -11,6 +11,8 @@ | |||
11 | #ifndef _LINUX_TRACE_IRQFLAGS_H | 11 | #ifndef _LINUX_TRACE_IRQFLAGS_H |
12 | #define _LINUX_TRACE_IRQFLAGS_H | 12 | #define _LINUX_TRACE_IRQFLAGS_H |
13 | 13 | ||
14 | #include <linux/typecheck.h> | ||
15 | |||
14 | #ifdef CONFIG_TRACE_IRQFLAGS | 16 | #ifdef CONFIG_TRACE_IRQFLAGS |
15 | extern void trace_softirqs_on(unsigned long ip); | 17 | extern void trace_softirqs_on(unsigned long ip); |
16 | extern void trace_softirqs_off(unsigned long ip); | 18 | extern void trace_softirqs_off(unsigned long ip); |
@@ -58,18 +60,24 @@ | |||
58 | do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0) | 60 | do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0) |
59 | #define local_irq_disable() \ | 61 | #define local_irq_disable() \ |
60 | do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0) | 62 | do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0) |
61 | #define local_irq_save(flags) \ | 63 | #define local_irq_save(flags) \ |
62 | do { raw_local_irq_save(flags); trace_hardirqs_off(); } while (0) | 64 | do { \ |
65 | typecheck(unsigned long, flags); \ | ||
66 | raw_local_irq_save(flags); \ | ||
67 | trace_hardirqs_off(); \ | ||
68 | } while (0) | ||
63 | 69 | ||
64 | #define local_irq_restore(flags) \ | 70 | |
65 | do { \ | 71 | #define local_irq_restore(flags) \ |
66 | if (raw_irqs_disabled_flags(flags)) { \ | 72 | do { \ |
67 | raw_local_irq_restore(flags); \ | 73 | typecheck(unsigned long, flags); \ |
68 | trace_hardirqs_off(); \ | 74 | if (raw_irqs_disabled_flags(flags)) { \ |
69 | } else { \ | 75 | raw_local_irq_restore(flags); \ |
70 | trace_hardirqs_on(); \ | 76 | trace_hardirqs_off(); \ |
71 | raw_local_irq_restore(flags); \ | 77 | } else { \ |
72 | } \ | 78 | trace_hardirqs_on(); \ |
79 | raw_local_irq_restore(flags); \ | ||
80 | } \ | ||
73 | } while (0) | 81 | } while (0) |
74 | #else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */ | 82 | #else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */ |
75 | /* | 83 | /* |
@@ -78,8 +86,16 @@ | |||
78 | */ | 86 | */ |
79 | # define raw_local_irq_disable() local_irq_disable() | 87 | # define raw_local_irq_disable() local_irq_disable() |
80 | # define raw_local_irq_enable() local_irq_enable() | 88 | # define raw_local_irq_enable() local_irq_enable() |
81 | # define raw_local_irq_save(flags) local_irq_save(flags) | 89 | # define raw_local_irq_save(flags) \ |
82 | # define raw_local_irq_restore(flags) local_irq_restore(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 { \ | ||
96 | typecheck(unsigned long, flags); \ | ||
97 | local_irq_restore(flags); \ | ||
98 | } while (0) | ||
83 | #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ | 99 | #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ |
84 | 100 | ||
85 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT | 101 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT |
@@ -89,7 +105,11 @@ | |||
89 | raw_safe_halt(); \ | 105 | raw_safe_halt(); \ |
90 | } while (0) | 106 | } while (0) |
91 | 107 | ||
92 | #define local_save_flags(flags) raw_local_save_flags(flags) | 108 | #define local_save_flags(flags) \ |
109 | do { \ | ||
110 | typecheck(unsigned long, flags); \ | ||
111 | raw_local_save_flags(flags); \ | ||
112 | } while (0) | ||
93 | 113 | ||
94 | #define irqs_disabled() \ | 114 | #define irqs_disabled() \ |
95 | ({ \ | 115 | ({ \ |
@@ -99,7 +119,11 @@ | |||
99 | raw_irqs_disabled_flags(_flags); \ | 119 | raw_irqs_disabled_flags(_flags); \ |
100 | }) | 120 | }) |
101 | 121 | ||
102 | #define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags) | 122 | #define irqs_disabled_flags(flags) \ |
123 | ({ \ | ||
124 | typecheck(unsigned long, flags); \ | ||
125 | raw_irqs_disabled_flags(flags); \ | ||
126 | }) | ||
103 | #endif /* CONFIG_X86 */ | 127 | #endif /* CONFIG_X86 */ |
104 | 128 | ||
105 | #endif | 129 | #endif |