Pārlūkot izejas kodu

percpu: make alloc_percpu() handle array types

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 <tj@kernel.org>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Reviewed-by: Christoph Lameter <cl@linux-foundation.org>
Tejun Heo 15 gadi atpakaļ
vecāks
revīzija
64ef291f46
1 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. 2 2
      include/linux/percpu.h

+ 2 - 2
include/linux/percpu.h

@@ -164,8 +164,8 @@ static inline void *pcpu_lpage_remapped(void *kaddr)
 
 
 #endif /* CONFIG_SMP */
 #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.
  * Optional methods for optimized non-lvalue per-cpu variable access.