Skip to content

Commit

Permalink
percpu: make alloc_percpu() handle array types
Browse files Browse the repository at this point in the history
alloc_percpu() couldn't handle array types like "int [100]" due to the
way return type was casted.  Fix it by using typeof() instead.

Signed-off-by: Tejun Heo <[email protected]>
Reviewed-by: Frederic Weisbecker <[email protected]>
Reviewed-by: Christoph Lameter <[email protected]>
  • Loading branch information
htejun committed Oct 29, 2009
1 parent 3f04ba8 commit 64ef291
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/linux/percpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ static inline void *pcpu_lpage_remapped(void *kaddr)

#endif /* CONFIG_SMP */

#define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type), \
__alignof__(type))
#define alloc_percpu(type) \
(typeof(type) *)__alloc_percpu(sizeof(type), __alignof__(type))

/*
* Optional methods for optimized non-lvalue per-cpu variable access.
Expand Down

0 comments on commit 64ef291

Please sign in to comment.