From a26698b43c3560d0bf269d66c6568f5352b2384b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 18 Jul 2003 05:23:55 -0700 Subject: [PATCH] [PATCH] Make percpu_modcopy a macro davidm@hpl.hp.com writes: "I'm working on updating the ia64 tree with local_t etc. One thing that would really help me: could you make asm-generic/percpu_modcopy() a macro? The routine depends on cpu_possible(), but I can't including smp.h in percpu.h since that would lead to recusive header-file dependencies (and in my opinion, percpu.h should be more "primitive" than smp.h, so that it can be included virtually everywhere)." --- include/asm-generic/percpu.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index 902567b6fad53..96d909da9ae7c 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h @@ -15,14 +15,15 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) #define __get_cpu_var(var) per_cpu(var, smp_processor_id()) -static inline void percpu_modcopy(void *pcpudst, const void *src, - unsigned long size) -{ - unsigned int i; - for (i = 0; i < NR_CPUS; i++) - if (cpu_possible(i)) - memcpy(pcpudst + __per_cpu_offset[i], src, size); -} +/* A macro to avoid #include hell... */ +#define percpu_modcopy(pcpudst, src, size) \ +do { \ + unsigned int __i; \ + for (__i = 0; __i < NR_CPUS; __i++) \ + if (cpu_possible(__i)) \ + memcpy((pcpudst)+__per_cpu_offset[__i], \ + (src), (size)); \ +} while (0) #else /* ! SMP */ #define DEFINE_PER_CPU(type, name) \ -- 2.53.0