diff options
| author | Rusty Russell <rusty@rustcorp.com.au> | 2003-07-18 05:23:55 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2003-07-18 05:23:55 -0700 |
| commit | a26698b43c3560d0bf269d66c6568f5352b2384b (patch) | |
| tree | 800e0e1a6853d92f9cfda7871caf1c7e25419968 /include | |
| parent | 38fe9ed4ce5c8d099d9737ec5765387ed95979d6 (diff) | |
[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)."
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-generic/percpu.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index 902567b6fad5..96d909da9ae7 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) \ |
