aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/percpu.h
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2009-02-20 02:29:08 -0500
committerTejun Heo <tj@kernel.org>2009-02-20 02:29:08 -0500
commitb36128c830a8f5bd7d4981f5b0b69950f5928ee6 (patch)
treec1cec2c2b374b53372ab2e0592321aae9f5ba245 /include/linux/percpu.h
parent6b588c18f8dacfa6d7957c33c5ff832096e752d3 (diff)
alloc_percpu: change percpu_ptr to per_cpu_ptr
Impact: cleanup There are two allocated per-cpu accessor macros with almost identical spelling. The original and far more popular is per_cpu_ptr (44 files), so change over the other 4 files. tj: kill percpu_ptr() and update UP too Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: mingo@redhat.com Cc: lenb@kernel.org Cc: cpufreq@vger.kernel.org Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/percpu.h')
-rw-r--r--include/linux/percpu.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 3577ffd90d4..c80cfe1260e 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -81,23 +81,13 @@ struct percpu_data {
81}; 81};
82 82
83#define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) 83#define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata)
84/*
85 * Use this to get to a cpu's version of the per-cpu object dynamically
86 * allocated. Non-atomic access to the current CPU's version should
87 * probably be combined with get_cpu()/put_cpu().
88 */
89#define percpu_ptr(ptr, cpu) \
90({ \
91 struct percpu_data *__p = __percpu_disguise(ptr); \
92 (__typeof__(ptr))__p->ptrs[(cpu)]; \
93})
94 84
95extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask); 85extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask);
96extern void percpu_free(void *__pdata); 86extern void percpu_free(void *__pdata);
97 87
98#else /* CONFIG_SMP */ 88#else /* CONFIG_SMP */
99 89
100#define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 90#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
101 91
102static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) 92static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask)
103{ 93{
@@ -122,6 +112,15 @@ static inline void percpu_free(void *__pdata)
122 cpu_possible_map) 112 cpu_possible_map)
123#define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type)) 113#define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type))
124#define free_percpu(ptr) percpu_free((ptr)) 114#define free_percpu(ptr) percpu_free((ptr))
125#define per_cpu_ptr(ptr, cpu) percpu_ptr((ptr), (cpu)) 115/*
116 * Use this to get to a cpu's version of the per-cpu object dynamically
117 * allocated. Non-atomic access to the current CPU's version should
118 * probably be combined with get_cpu()/put_cpu().
119 */
120#define per_cpu_ptr(ptr, cpu) \
121({ \
122 struct percpu_data *__p = __percpu_disguise(ptr); \
123 (__typeof__(ptr))__p->ptrs[(cpu)]; \
124})
126 125
127#endif /* __LINUX_PERCPU_H */ 126#endif /* __LINUX_PERCPU_H */