diff options
-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 f782f98004db..94cd90afadac 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h | |||
@@ -215,15 +215,8 @@ | |||
215 | RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)); \ | 215 | RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)); \ |
216 | }) | 216 | }) |
217 | 217 | ||
218 | /* | 218 | #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) |
219 | * A percpu variable may point to a discarded regions. The following are | 219 | #define raw_cpu_ptr(ptr) arch_raw_cpu_ptr(ptr) |
220 | * established ways to produce a usable pointer from the percpu variable | ||
221 | * offset. | ||
222 | */ | ||
223 | #define per_cpu(var, cpu) \ | ||
224 | (*SHIFT_PERCPU_PTR(&(var), per_cpu_offset(cpu))) | ||
225 | |||
226 | #define raw_cpu_ptr(ptr) arch_raw_cpu_ptr(ptr) | ||
227 | 220 | ||
228 | #ifdef CONFIG_DEBUG_PREEMPT | 221 | #ifdef CONFIG_DEBUG_PREEMPT |
229 | #define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset) | 222 | #define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset) |
@@ -231,9 +224,6 @@ | |||
231 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) | 224 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) |
232 | #endif | 225 | #endif |
233 | 226 | ||
234 | #define __get_cpu_var(var) (*this_cpu_ptr(&(var))) | ||
235 | #define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var))) | ||
236 | |||
237 | #else /* CONFIG_SMP */ | 227 | #else /* CONFIG_SMP */ |
238 | 228 | ||
239 | #define VERIFY_PERCPU_PTR(__p) ({ \ | 229 | #define VERIFY_PERCPU_PTR(__p) ({ \ |
@@ -241,14 +231,16 @@ | |||
241 | (typeof(*(__p)) __kernel __force *)(__p); \ | 231 | (typeof(*(__p)) __kernel __force *)(__p); \ |
242 | }) | 232 | }) |
243 | 233 | ||
244 | #define per_cpu(var, cpu) (*((void)(cpu), VERIFY_PERCPU_PTR(&(var)))) | 234 | #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR((ptr)); }) |
245 | #define __get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var))) | 235 | #define raw_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) |
246 | #define __raw_get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var))) | 236 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) |
247 | #define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) | ||
248 | #define raw_cpu_ptr(ptr) this_cpu_ptr(ptr) | ||
249 | 237 | ||
250 | #endif /* CONFIG_SMP */ | 238 | #endif /* CONFIG_SMP */ |
251 | 239 | ||
240 | #define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu)) | ||
241 | #define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var))) | ||
242 | #define __get_cpu_var(var) (*this_cpu_ptr(&(var))) | ||
243 | |||
252 | /* keep until we have removed all uses of __this_cpu_ptr */ | 244 | /* keep until we have removed all uses of __this_cpu_ptr */ |
253 | #define __this_cpu_ptr(ptr) raw_cpu_ptr(ptr) | 245 | #define __this_cpu_ptr(ptr) raw_cpu_ptr(ptr) |
254 | 246 | ||
@@ -278,11 +270,5 @@ | |||
278 | preempt_enable(); \ | 270 | preempt_enable(); \ |
279 | } while (0) | 271 | } while (0) |
280 | 272 | ||
281 | #ifdef CONFIG_SMP | ||
282 | #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) | ||
283 | #else | ||
284 | #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR((ptr)); }) | ||
285 | #endif | ||
286 | |||
287 | #endif /* __ASSEMBLY__ */ | 273 | #endif /* __ASSEMBLY__ */ |
288 | #endif /* _LINUX_PERCPU_DEFS_H */ | 274 | #endif /* _LINUX_PERCPU_DEFS_H */ |