diff options
-rw-r--r-- | include/linux/percpu.h | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index e12410e55e05..f965f833a643 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -27,10 +27,13 @@ | |||
27 | * we force a syntax error here if it isn't. | 27 | * we force a syntax error here if it isn't. |
28 | */ | 28 | */ |
29 | #define get_cpu_var(var) (*({ \ | 29 | #define get_cpu_var(var) (*({ \ |
30 | extern int simple_identifier_##var(void); \ | ||
31 | preempt_disable(); \ | 30 | preempt_disable(); \ |
32 | &__get_cpu_var(var); })) | 31 | &__get_cpu_var(var); })) |
33 | #define put_cpu_var(var) preempt_enable() | 32 | |
33 | #define put_cpu_var(var) do { \ | ||
34 | (void)(var); \ | ||
35 | preempt_enable(); \ | ||
36 | } while (0) | ||
34 | 37 | ||
35 | #ifdef CONFIG_SMP | 38 | #ifdef CONFIG_SMP |
36 | 39 | ||
@@ -182,17 +185,19 @@ static inline void *pcpu_lpage_remapped(void *kaddr) | |||
182 | #ifndef percpu_read | 185 | #ifndef percpu_read |
183 | # define percpu_read(var) \ | 186 | # define percpu_read(var) \ |
184 | ({ \ | 187 | ({ \ |
185 | typeof(var) __tmp_var__; \ | 188 | typeof(var) *pr_ptr__ = &(var); \ |
186 | __tmp_var__ = get_cpu_var(var); \ | 189 | typeof(var) pr_ret__; \ |
187 | put_cpu_var(var); \ | 190 | pr_ret__ = get_cpu_var(*pr_ptr__); \ |
188 | __tmp_var__; \ | 191 | put_cpu_var(*pr_ptr__); \ |
192 | pr_ret__; \ | ||
189 | }) | 193 | }) |
190 | #endif | 194 | #endif |
191 | 195 | ||
192 | #define __percpu_generic_to_op(var, val, op) \ | 196 | #define __percpu_generic_to_op(var, val, op) \ |
193 | do { \ | 197 | do { \ |
194 | get_cpu_var(var) op val; \ | 198 | typeof(var) *pgto_ptr__ = &(var); \ |
195 | put_cpu_var(var); \ | 199 | get_cpu_var(*pgto_ptr__) op val; \ |
200 | put_cpu_var(*pgto_ptr__); \ | ||
196 | } while (0) | 201 | } while (0) |
197 | 202 | ||
198 | #ifndef percpu_write | 203 | #ifndef percpu_write |
@@ -304,7 +309,7 @@ do { \ | |||
304 | #define _this_cpu_generic_to_op(pcp, val, op) \ | 309 | #define _this_cpu_generic_to_op(pcp, val, op) \ |
305 | do { \ | 310 | do { \ |
306 | preempt_disable(); \ | 311 | preempt_disable(); \ |
307 | *__this_cpu_ptr(&pcp) op val; \ | 312 | *__this_cpu_ptr(&(pcp)) op val; \ |
308 | preempt_enable(); \ | 313 | preempt_enable(); \ |
309 | } while (0) | 314 | } while (0) |
310 | 315 | ||