diff options
Diffstat (limited to 'include/linux/percpu-defs.h')
-rw-r--r-- | include/linux/percpu-defs.h | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index f782f98004d..94cd90afada 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h @@ -215,15 +215,8 @@ RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)); \ }) -/* - * A percpu variable may point to a discarded regions. The following are - * established ways to produce a usable pointer from the percpu variable - * offset. - */ -#define per_cpu(var, cpu) \ - (*SHIFT_PERCPU_PTR(&(var), per_cpu_offset(cpu))) - -#define raw_cpu_ptr(ptr) arch_raw_cpu_ptr(ptr) +#define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) +#define raw_cpu_ptr(ptr) arch_raw_cpu_ptr(ptr) #ifdef CONFIG_DEBUG_PREEMPT #define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset) @@ -231,9 +224,6 @@ #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) #endif -#define __get_cpu_var(var) (*this_cpu_ptr(&(var))) -#define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var))) - #else /* CONFIG_SMP */ #define VERIFY_PERCPU_PTR(__p) ({ \ @@ -241,14 +231,16 @@ (typeof(*(__p)) __kernel __force *)(__p); \ }) -#define per_cpu(var, cpu) (*((void)(cpu), VERIFY_PERCPU_PTR(&(var)))) -#define __get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var))) -#define __raw_get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var))) -#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) -#define raw_cpu_ptr(ptr) this_cpu_ptr(ptr) +#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR((ptr)); }) +#define raw_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) +#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) #endif /* CONFIG_SMP */ +#define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu)) +#define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var))) +#define __get_cpu_var(var) (*this_cpu_ptr(&(var))) + /* keep until we have removed all uses of __this_cpu_ptr */ #define __this_cpu_ptr(ptr) raw_cpu_ptr(ptr) @@ -278,11 +270,5 @@ preempt_enable(); \ } while (0) -#ifdef CONFIG_SMP -#define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) -#else -#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR((ptr)); }) -#endif - #endif /* __ASSEMBLY__ */ #endif /* _LINUX_PERCPU_DEFS_H */ |